AG-021: Zero-Width Characters Detected (Invisible Content)

HIGH AG-021 OWASP ASI01 · ASI07

What this rule means

A tool description or parameter contains zero-width or invisible Unicode (checked on non-trivial strings, >50 characters). The model reads those bytes; a human reviewer does not. Two different documents, one visible and one executed.

Why it matters

Invisible-character prompt injection has been demonstrated publicly against multiple LLM products — the payload survives code review precisely because it renders as nothing.

How to fix it

Normalise and strip zero-width/bidi/format characters from tool metadata at load time, and diff descriptions on their normalised form.

Detect it

pip install lucin
lucin scan .                  # all rules
lucin explain AG-021          # this rule, in your terminal

Findings carry a file:line and, where the rule supports it, a witness path showing the flow that triggered it. Precision and recall for the whole rule set, with the commands that regenerate them, are on the benchmarks page — and the gaps are on limits.

← All detection rules