Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
Tools/GitHubGitHub/moshe-ship/bidi-guard
Static AnalysisVulnerability AnalysisCode AnalysisDevSecOpsSupply Chain SecurityLearning & Education
GitHubmoshe-ship/bidi-guard

bidi-guard

Scan code for invisible bidirectional Unicode characters (Trojan Source attack prevention, CVE-2021-42574)

View Repository
5317 months agoNot yet reviewed
Website
Share

bidi-guard

Scan code for invisible bidirectional Unicode characters

MIT License Python 3.9+


Why This Exists

Invisible Unicode bidirectional characters can make source code display differently than it executes. This is CVE-2021-42574 — the Trojan Source attack.

An attacker embeds characters that reverse text direction. In a code review, you see:

access_level = "admin"

But the compiler sees:

access_level = "user"

The characters are invisible. Your editor won't show them. Your reviewer won't catch them. bidi-guard will.

Install

pip install bidi-guard

Quick Start

# Scan current directory recursively
bidi-guard scan .

# Scan a specific file
bidi-guard scan src/auth.py

Finds all bidirectional Unicode characters, shows their exact position, context, and severity.

Commands

CommandWhat it does
scanScan files for bidi characters, show findings with context
ciCI mode — exits non-zero if any dangerous characters found
fixRemove all bidi characters from files (interactive by default)
explainShow what each bidi character does with visual examples
initGenerate a .bidi-guard.yml config file for your project

CI Integration

GitHub Action

name: BiDi Guard
on: [push, pull_request]
jobs:
  bidi-scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - run: pip install bidi-guard
      - run: bidi-guard ci .

Pre-commit

Add to your .pre-commit-config.yaml:

repos:
  - repo: https://github.com/Moshe-ship/bidi-guard
    rev: v0.1.0
    hooks:
      - id: bidi-guard

Detected Characters

All 16 Unicode bidirectional control characters:

Code PointNameAbbreviationSeverity
U+200ELeft-to-Right MarkLRMLow
U+200FRight-to-Left MarkRLMLow
U+061CArabic Letter MarkALMLow
U+200DZero Width JoinerZWJLow
U+200CZero Width Non-JoinerZWNJLow
U+2066Left-to-Right IsolateLRIMedium
U+2067Right-to-Left IsolateRLIHigh
U+2068First Strong IsolateFSIHigh
U+2069Pop Directional IsolatePDIMedium
U+202ALeft-to-Right EmbeddingLREMedium
U+202BRight-to-Left EmbeddingRLEHigh
U+202CPop Directional FormattingPDFMedium
U+202DLeft-to-Right OverrideLROHigh
U+202ERight-to-Left OverrideRLOCritical
U+2028Line SeparatorLSMedium
U+2029Paragraph SeparatorPSMedium

Characters marked High or Critical can actively reorder displayed text — these are the ones used in Trojan Source attacks.

As a Library

from bidi_guard import scan_file, Finding

findings = scan_file("src/auth.py")
for f in findings:
    print(f"{f.char_name} at line {f.line}:{f.col} — severity: {f.severity}")

Why Not Just grep?

These characters are invisible. Literally invisible:

grep "RLO" file.py    # finds nothing
cat file.py            # looks completely normal

bidi-guard shows you what grep cannot: the exact character, its position, surrounding context, severity level, and what it does. It can also auto-fix by stripping them out.

License

MIT — Musa the Carpenter


Brought to you by the Saudi AI Community — for Arabs first, and the world at large.

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    755
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    510
  • 3

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    415
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    343
  • 5

    antifox

    antifox-ai/antifox

    AI multi-agent autonomous penetration testing platform that runs recon, attack-surface discovery, exploitation validation and evidence-backed report delivery.

    259
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    258

Explore all tools

Browse our collection of tools

View all tools →