Deception and Anti-Analysis¶
Overview¶
These rules target the reviewer, not the shell. R012 and R013 are the two
FATAL rules: reviewer-directed template text, and codepoints that make displayed
text differ from executed text. Both contribute weight 0 and name themselves in
the verdict label (Low (FATAL: R012)). Neither
establishes an author's intent: R012 is a high-severity template tripwire for
reviewer manipulation, while R013 identifies a concrete display/execution
deception mechanism. When neither fires, nothing has been established.
H067 and the reserved H012/H013 are the inverse direction: the recipe checking whether it is being watched. A build script that probes for a debugger, a VM or a CI runner has no legitimate reason to care.
See Rule Mechanics for the field table, the severity weights and the reserved identifier ranges.
Threat context¶
This is sleight of hand. A magician does not change the world, only what the audience sees; a deceiving recipe does not change what the shell runs, only what the reviewer reads. The family is the class of tricks aimed at the audience rather than at the compiler: homoglyphs and lookalike characters, right-to-left overrides that reorder displayed text, invisible or zero-width bytes, and control characters that render differently than they parse.
A homoglyph here is the equivalent of a counterfeit note: it passes a glance, and fails only when someone bothers to compare it character by character against the real thing. These attacks do nothing at build time. Their whole purpose is to make what the reviewer sees differ from what the shell runs, which is why they are read as anti-analysis evidence rather than as build behaviour.
Detection mechanisms¶
The rules that make up this category are listed below, each with the series that implements it and the severity it carries. Scoring, matching and identifier allocation are shared across every category: see Rule Mechanics.
Individual rules¶
| Rule | Name | Severity |
|---|---|---|
| C012 | Source Domain Resembles Declared Upstream | MEDIUM |
| H012 | Strace detection attempt (TracerPid check) | - |
| H013 | Strace log truncated (possible flood evasion) | - |
| H067 | Anti-Analysis Check | HIGH |
| R012 | LLM Prompt Injection | FATAL |
| R013 | Unicode Bidi Override | FATAL |
R012: LLM Prompt Injection¶
- Target:
resolved - Severity: FATAL (weight 0; names itself in the verdict label, e.g.
Low (FATAL: R012)) -
Category:
injection -
Pattern:
\b(?:ignore|disregard|forget|override|bypass)\s+(?:all\s+|any\s+|the\s+)*(?:previous|above|prior|earlier|preceding|foregoing|existing)\b|^[^\S\n]*(?:#[^\S\n]*)?(?:system|assistant)[^\S\n]*:[^\S\n]*\S|</?(?:system|instructions?|admin|prompt|assistant)\s*>|\byou\s+are\s+(?:an?|the)\s+[^.\n]{0,48}?(?:model|assistant|ai\b)|\bnew\s+instructions?\s*:|\bdo(?:\s+not|n['’]t)\s+(?:flag|warn|analy[sz]e|review|scan)\b|\bdo(?:\s+not|n['’]t)\s+report\s+(?:any\s+|the\s+)?(?:security|issues?|concerns?|problems?|findings?|warnings?|anything)\b|\b(?:mark|classify|report|treat|label|approve)\b[^.\n]{0,24}?\bas\s+(?:safe|benign|clean|harmless|trusted|ok)\b|\b(?:claude|chatgpt|gpt-?[0-9]?|copilot|gemini|llm|ai\s+assistant)\b[^.\n]{0,60}?\b(?:ignore|approve|skip|overlook|flag)\s+(?:this|that|the|these|those|all|any|it|them|above|previous|prior|suspicious|following|everything|anything)\b - Comments: scanned (
include_comments) - Description: Detects template-shaped text addressed to whoever reads the PKGBUILD rather than to the shell that runs it: instruction overrides ("ignore the previous instructions"), role markers (
system:,assistant:), tag-like injections (<system>,<instructions>), personas ("you are a helpful model..."), suppression orders ("do not flag/warn/analyze") and pre-declared verdicts ("mark this as safe"). Comment lines are scanned, unlike every rule that describes what the shell executes, because this is reviewer-facing text. Calibrated at 22/22 labelled injection fixtures with 0 fires across the historical v1 benign corpus. This is a reviewer-directed template tripwire, not proof of an author's intent or a general prompt-injection detector: a match requires reviewer scrutiny, and a non-match establishes nothing. The finding contributes weight 0; its signal is the unsuppressible FATAL entry inscore_breakdownand the FATAL name in the verdict label.
R013: Unicode Bidi Override¶
- Target:
raw_line - Severity: FATAL (weight 0; names itself in the verdict label, e.g.
Low (FATAL: R012)) -
Category:
unicode -
Pattern:
[\u202A-\u202E\u2066-\u2069\u2060-\u2064\U000E0000-\U000E007F]|(?<![^\x00-\x7F])[\u200B-\u200F\uFEFF](?![^\x00-\x7F]) - Description: Detects directionality overrides, isolates, invisible operators, tag characters, and zero-width joiners placed between ASCII neighbours. These codepoints can make displayed text differ from executed text. The ASCII-neighbour restriction preserves attacks hidden inside ASCII commands or URLs while dropping legitimate use in localized
GenericName[...]lines.
The rule splits deceptive codepoints into two classes, because they are not equally suspicious.
Fires unconditionally: bidi overrides and isolates (U+202A-U+202E, U+2066-U+2069), invisible operators (U+2060-U+2064), and tag characters (U+E0000-U+E007F). None has a legitimate use in a build recipe. These are the characters that make displayed text differ from executed text.
Fires only between ASCII neighbours: zero-width and directional characters (U+200B-U+200F, U+FEFF). U+200B-U+200D are mandatory joiners in Malayalam, Lao, Devanagari and other scripts: a localized GenericName[ml]= line in a browser package legitimately contains U+200D. Because R013 is FATAL, firing on one scored an entirely benign package 100/100. Two packages in the benign corpus (brave-origin-bin, zen-browser-bin) did exactly this. Requiring ASCII on both sides preserves the attack (a joiner hidden inside an ASCII command or URL, such as https://evil.com<U+200D>/pkg.tar.gz) while dropping the false positive.
- Note: Contributes weight 0; the FATAL signal rides the unsuppressible
score_breakdownentry and the FATAL name in the verdict label. The previous pattern omitted U+200E/U+200F, U+2060-U+2064 and the tag block, which is where the documented recall gap came from;unicode.pyalready listed them.
H012: Strace detection attempt (TracerPid check)¶
H012 is retained as a documentation anchor for a reserved runtime id. No
code emits it: reading TracerPid is post-install behaviour a static diff
cannot observe. H067 claims the static anti-analysis probe.
H013: Strace log truncated (possible flood evasion)¶
H013 is retained as a documentation anchor for a reserved runtime id. No
code emits it; it is held alongside H012.
H067: Anti-Analysis Check¶
- Severity: HIGH (weight 25)
-
Category:
anti_analysis -
Condition: A build or install function probes for a debugger (
TracerPid), a VM (systemd-detect-virt, DMI or hypervisor strings), a sandbox, or CI ($CI,$GITHUB_ACTIONS,$CONTAINER,/.dockerenv), from[patterns] anti_analysis_probes. The udev/chroot guardsystemd-detect-virt --chrootis excluded: it asks whether udev is present, not whether the build is being watched.
A build script checking whether it is being watched has no legitimate purpose.
Architecture and feature detection (uname -m, getconf) is not a probe and
does not fire.
Fire rate: 0 on the v1 corpus.
C012: Source Domain Resembles Declared Upstream¶
- Severity: MEDIUM (weight 15)
-
Category:
deception -
Condition: The recipe's declared
url=is on a trusted forge or official project, and an addedsource=URL's registrable domain is one or two Damerau-Levenshtein edits from the upstream's registrable domain, with the same TLD suffix (sogithub.comvsgithab.comfires;github.comvsgithub.iodoes not).
R013b catches only mixed-script homoglyph domains, and the
package/dependency typosquat never looks at domains, so a pure-ASCII mis-spell
of the upstream's own host was invisible. The url= is declared by the same
party under review, so this is a heuristic: it names a near-miss for a reviewer
to judge. Eligibility is limited to a trusted-forge or official upstream, which
keeps the near-miss meaningful - a source host resembling an unknown upstream
is not evidence of impersonation.
Interpretation¶
- The finding is high-confidence by construction: Unicode confusables, bidi overrides, and zero-width characters appearing in a build recipe have essentially no benign reading, so these rules can weigh heavily.
- The matched text is shown escaped so the reviewer sees the concealed character, not a lookalike that hides it.
- Treat a deception finding as an explanation for other findings being hard to see; it often rides alongside an obfuscated payload.
Related documentation¶
- Why Static Analysis; how the tokenizer sees what the terminal hides