Skip to content

feat: multilingual injection pattern detection #82

Description

@ksek87

Problem

The static scanner is English-only. Production MCP server surveys (MCPTox, MCPLIB — 2,000+ real-world servers) have found tool-poisoning payloads in Russian, Simplified Chinese, and Arabic. These evade fuzzd entirely today.

The fix doesn't require a translation API or ML model — a targeted set of AC needles covering direct translations of the highest-confidence imperative patterns is sufficient for the first pass.

Scope (first pass)

Translate the ~20 patterns in ImperativeOverride and StealthLanguage that have the highest per-pattern true positive rate in the English scanner into:

Language Example
Russian "игнорируй инструкции" (ignore instructions), "обязательно" (mandatory), "не раскрывай" (do not disclose)
Simplified Chinese "忽略之前的指令" (ignore previous instructions), "必须" (must), "不要告诉" (do not tell)
Arabic "تجاهل التعليمات" (ignore instructions), "يجب" (must)

These can be added as a 5th AC automaton pass (separate OnceLock<AhoCorasick>) so they don't affect the existing English automaton's pattern index.

Acceptance criteria

  • New scanner pass in description.rs with multilingual needles for ImperativeOverride and StealthLanguage
  • Separate OnceLock<AhoCorasick> so the multilingual pass compiles independently of the English pass
  • At minimum: Russian, Simplified Chinese, Arabic translations of top-20 imperative patterns
  • Corpus records covering each language (at least one per language)
  • Benchmark: verify 0 FP change on bench/clean_tools.json (English clean tools)
  • Unit tests for each language

Notes

  • Unicode normalization (NFC/NFD) matters here — ensure the needles and inputs are normalized consistently before matching
  • Do not use String::from_utf8_lossy (prohibited by CLAUDE.md); use str::from_utf8 + explicit error handling for any byte-level input

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions