Skip to content
KitploitKITPLOIT
StrumentiExploitsBlog
Log in
Invia
StrumentiExploitsBlog
Invia

Strumenti di Hacking, PenTest e Cybersecurity per il tuo Arsenale di Sicurezza!

Kitploit è una directory di strumenti di hacking, cybersecurity e pentesting. Scopri gli ultimi aggiornamenti dei progetti per trovare vulnerabilità, analizzare sistemi, automatizzare i test e rafforzare la tua sicurezza.

FeedContattoPrivacy© 2026 Kitploit

Directory degli strumenti

Categorie

Vedi tutte le categorie
Loading categories
trojan-source-check — CI scanner for Trojan Source attacks: bidi control characters (CVE-2021-42574), mixed-script identifiers (CVE-2021-42694), invisible zero-width chars. Stdlib only. | Kitploit
Strumenti/GitHubGitHub/mehul82099/trojan-source-check
Defensive ToolsStatic AnalysisVulnerability ScannersStatic Code Analysis (SAST)Code AnalysisDevSecOpsSupply Chain Security
GitHubmehul82099/trojan-source-check

trojan-source-check

CI scanner for Trojan Source attacks: bidi control characters (CVE-2021-42574), mixed-script identifiers (CVE-2021-42694), invisible zero-width chars. Stdlib only.

Vedi Repository
28 ott 2026Non ancora revisionato
Condividi
Contenuto non disponibile nella lingua richiesta. Visualizzazione della versione inglese.

trojan-source-check

A CI scanner for the Trojan Source attacks. It reads source files as raw text and flags the characters behind CVE-2021-42574 (bidirectional control characters that make code display differently from how it compiles), CVE-2021-42694 (mixed-script identifiers used in homoglyph attacks), and invisible zero-width characters that can hide tokens.

Pure Python standard library. No language parsing, no dependencies.

The problem

In November 2021, Boucher and Anderson at the University of Cambridge published Trojan Source: Unicode control characters embedded in comments and strings can reorder source code visually, so a human reviewer sees one program while the compiler builds another. Their defense guidance is that toolchains should "throw errors or warnings for unterminated bidirectional control characters in comments or string literals, and for identifiers with mixed-script confusable characters." Most editors still render these characters invisibly. trojan-source-check is that warning, dropped into CI.

Usage

python3 trojan_source_check.py src/
python3 trojan_source_check.py app.py lib/util.py --fail-on-warning
python3 trojan_source_check.py . --format json

Directories are walked recursively (.git, node_modules, __pycache__ and friends are skipped). Binary and non-UTF-8 files are skipped and reported, not scanned.

Exit codes:

CodeMeaning
0Clean (warnings only when --fail-on-warning is off)
1Findings present (errors, or warnings with --fail-on-warning)
2Input problem: an unreadable path

Example output:

app.py:2:16 [error] bidi-control: U+202E RIGHT-TO-LEFT OVERRIDE can visually reorder source code; the Trojan Source attack (CVE-2021-42574) uses these to make code display differently from how it compiles.
trojan-source-check: 1 error(s), 0 warning(s)

Rules

RuleSeverityTriggerGrounding
bidi-controlerrorany of the 9 explicit directional formatting characters: LRE/RLE/PDF/LRO/RLO (U+202A-U+202E) and LRI/RLI/FSI/PDI (U+2066-U+2069)CVE-2021-42574; character semantics from Unicode UAX #9
mixed-script-identifierwarningan identifier-like token mixing Latin letters with Cyrillic or Greek onesCVE-2021-42694 homoglyph attack (heuristic detector, see below)
zero-width-charwarningU+200B ZWSP, U+200C ZWNJ, U+200D ZWJ, U+2060 WORD JOINER, U+00AD SOFT HYPHEN, or U+FEFF anywhere except the very start of a fileinvisible in most editors; can hide tokens or form look-alike identifiers

Honesty notes:

  • bidi-control is stricter than the paper's minimum guidance: the paper asks compilers to warn on unterminated bidi controls inside comments/strings; this scanner flags every occurrence, because any of these characters in source code deserves a human look.
  • mixed-script-identifier is a heuristic, stated as such in its message. It only flags the attack's shape (Latin mixed with Cyrillic/Greek); pure single-script non-Latin identifiers are not flagged, and rare false positives are possible in multilingual code.
  • The scanner reads raw text, not language tokens: a Cyrillic letter inside a string literal is scanned the same as one inside an identifier.

Options

--ignore RULE            suppress a rule by name (repeatable)
--fail-on-warning        exit 1 when only warnings are present
--format text|json       output format (default: text)

Sources

  • Trojan Source: Invisible Vulnerabilities, Boucher & Anderson, University of Cambridge (attack description, CVE-2021-42574 and CVE-2021-42694, defense guidance): https://www.trojansource.codes/
  • Unicode Standard Annex #9, Unicode Bidirectional Algorithm (character names and semantics): https://www.unicode.org/reports/tr9/

Development

42 tests, all fabricated source strings, no network:

python3 -m unittest -v

CI runs the suite on Ubuntu and Windows with Python 3.9 and 3.13.

License

MIT - see LICENSE.

Scarica lo strumento

Strumenti correlati

  • wazuh

    Piattaforma XDR e SIEM open-source per rilevamento delle minacce, analisi dei log, monitoraggio dell'integrità dei file, valutazione delle vulnerabilità e gestione della conformità su endpoint e carichi di lavoro cloud.

  • suricata

    Motore open-source IDS/IPS/NSM di rete per l'ispezione del traffico in tempo reale, rilevamento e prevenzione delle intrusioni, analisi dei protocolli e caccia alle minacce basata su regole.

  • zeek

    Zeek è un potente framework di analisi di rete molto diverso dal tipico IDS che potresti conoscere.

Più Popolari

Vedi tutti →

Scopri gli strumenti più utilizzati dalla nostra community.

  • 1

    ghostlock-app

    yukonga/ghostlock-app

    # App di esecuzione con un tocco GhostLock (CVE-2026-43499)

    745
  • 2

    IMSIcatcher

    28zaaky/imsicatcher

    Piattaforma IMSI Catcher che distribuisce una cella GSM rogue per intercettare SMS, iniettare messaggi e tracciare dispositivi mobili

    732
  • 3

    Callisto

    jetp1ane/callisto

    Strumento automatizzato di analisi delle vulnerabilità binarie che decompila eseguibili tramite Ghidra, esegue la scansione del pseudo-codice C con Semgrep e convalida i risultati utilizzando GPT-3.5-Turbo per ridurre i falsi positivi.

    610
  • 4

    opencti

    opencti-platform/opencti

    Piattaforma aperta di intelligence sulle minacce informatiche

    546
  • 5

    ARTEX

    baarai/artex

    Piattaforma di penetration testing autonoma multi-agente basata su LLM con agenti planner/worker, grafi di asset e di esplorazione, registrazione del traffico MITM e retesting delle vulnerabilità.

    414
  • 6

    DFRoot

    a2333c/dfroot

    Strumento di root per Android per Samsung Galaxy S25 Ultra (SM-S938B) che concatena DirtyFrag CVE-2026-43284 e CVE-2026-43499 per ottenere i privilegi di root automaticamente all'avvio tramite KernelSU.

    413

Esplora tutti gli strumenti

Sfoglia la nostra collezione di strumenti

Vedi tutti gli strumenti →