StegGuard

Alpha · v0.4.0 on PyPI · Apache-2.0

Find what's hiding in plain sight.

StegGuard scans files for zero-width characters, homoglyphs, whitespace channels and watermark signals. If it finds a hidden message it can decode it, and it writes a clean copy without touching your original. Python standard library only, offline by default.

shell
pip install stegguard

See it run on seven sample files · CLI reference

report.md, line 1

Q3 numbers are final.16 zero-width Please summarize them for the U+202E RLOboard.

Looks like an ordinary sentence. Copy it into a model and it carries more than it shows.Sixteen zero-width characters spell hi in binary, and a right-to-left override flips how the last word renders.

One workflow instead of five one-off tools.

Detect, decode, then sanitize a copy. Your original stays as it is unless you ask for an in-place rewrite.

  1. 01 · Detect

    Point it at a file or a whole repo.

    Runs on the standard library, with no network calls. It exits with 1 when something is flagged, so CI can fail the build.

    stegguard detect
    $ stegguard detect report.md
      • 16 zero-width characters found
      • 1 suspicious control character(s) found
    ⚠ 1/1 file(s) flagged
    
  2. 02 · Decode

    Read the hidden message without touching the file.

    The result is JSON, with a confidence score for each channel.

    stegguard decode
    $ stegguard decode report.md
      "decoded": "hi",
      "confidence": 0.9,
      "occurrences": 16
    
  3. 03 · Sanitize

    Get a clean copy and a record of what changed.

    The copy goes to report.sanitized.md by default. Overwriting the original takes --in-place and --confirm together.

    stegguard sanitize
    $ stegguard sanitize report.md
      "zero_width_removed": 16,
      "bidi_removed": 1,
      "original_preserved": true
    

Hidden content rarely comes in one neat format.

CategoryWhat it looks forWhere
Text and sourceZero-width Unicode, bidirectional overrides, Cyrillic and Greek homoglyphs, trailing-space and tab channels, mixed line endings.any text or source file
Images, audio and mediaPixel-level LSB anomalies (chi-square, RS, entropy, sample-pair), PNG private chunks, JPEG EXIF/XMP/IPTC, PCM audio statistics.images, audio, structured media
Documents and containersPDF embedded files, DOCX/PPTX/XLSX/ZIP members, nested archives, hidden content in SVG and HTML.documents, archives
Watermarks and provenanceMetadata, structural and text-pattern evidence, device fingerprints, and C2PA manifests validated through c2patool.images, audio, video

Where it fits

CI gate
Fail a pull request that adds BIDI overrides or homoglyphs to source files.
LLM input checks
Look for zero-width prompt injection in pasted text and scraped pages before they reach a model.
Pre-publish checks
Scan DOCX, PPTX and PDF files for hidden content before you send them out.
Provenance audits
Validate C2PA Content Credentials and look for watermark signals before you trust an image or audio file.

Everything on this page ships in the open-source package. It is alpha software, so treat what it reports as evidence to check, not a final verdict.

Read the source on GitHub

StegGuard logo: a stag inside a magnifying glass held over binary digits, captioned 'Uncovering hidden data'