# raio-x-documental — Hidden Text & Prompt Injection Detector

> Find hidden text and prompt-injection commands in PDFs, Word files and images, in 10 languages, before your AI reads them. Offline, with a formal report.

raio-x-documental — Hidden Text & Prompt Injection Detector is a paid AI agent skill on Agensi by SophiSmart, in Legal & Compliance. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $9.9 (one-time purchase)
- Creator: [SophiSmart](https://www.agensi.io/creators/sophismart)
- Category: [Legal & Compliance](https://www.agensi.io/skills/legal-compliance)
- Version: 1.1
- Last updated: 2026-10-16
- Security: scan passed (2026-10-13); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/raio-x-documental-hidden-text-prompt-injection-detector
- Tags: security, prompt-engineering, legal, python, ocr, pdf-analysis, prompt-injection, offline

## About this skill

**What it does**

Someone can hide instructions for your AI inside a document: white text on a white page, a 1-point font, invisible Unicode characters, a line in the metadata. A human reader sees nothing; the AI reads everything and may obey. This skill finds that content before the document reaches the AI.

It was built after a real case in a Brazilian court, where an expert witness hid a white-on-white command in his report telling the AI to agree with him.

**How it works**

- Compares what a person sees with what a machine reads, format by format.
- Deterministic and offline: no AI reads the hidden text during the analysis, and the file never leaves your computer.
- Hidden content plus a command addressed to an AI is rated CRITICAL.
- Never modifies the original. Optionally creates a sanitized copy (visible text only) and a decoded copy of the hidden content.

**Formats:** PDF (native and scanned), DOCX/DOC, ODT, RTF, TXT/MD, HTML/e-mail and images (PNG/JPG/TIFF/BMP/WEBP).

**Output:** a verdict in the terminal and a formal HTML/JSON report with the file's SHA-256 and the location and transcription of each finding. Folder mode checks every document in a folder and summarizes the suspicious ones.

**What's included**

- The full detection engine (Python) and the agent workflow for Claude Code, Codex and other SKILL.md agents.
- A license for professional use: law firms, consultancies, compliance teams, companies.

**Good to know**

- Requires Python 3.9+ and four pip packages; Tesseract OCR for images and scanned PDFs (with the Tesseract language pack of each script you scan).
- The formal report is in Brazilian Portuguese (Brazilian court standards). Your agent explains the results in your language.
- Hidden-text detection works in any language. Recognizes injection commands in 10 languages: English, Mandarin Chinese, Hindi, Spanish, French, Arabic, Bengali, Russian, Portuguese and Urdu.
- A "clean" verdict means no known vector was found, not an absolute guarantee.

**Known limitations**

- The injection-phrase lists are heuristics, written without review by native speakers.
- Urdu in Nastaliq fonts has weak OCR (Naskh works).
- In PDFs in Arabic, Hindi, Bengali or Urdu whose text layer is scrambled, the hidden text is flagged, but the command may not be recognized (the verdict is MEDIUM instead of CRITICAL).
- Hidden text in a non-Latin script with fewer than about 10 letters in an image may not be read.
- Scanned pages in non-Latin scripts take longer to process, because the OCR makes extra passes for those scripts.
- If the Tesseract language pack of a script is not installed, scanned documents in that script are not read. The tool does not stay silent: the result carries an INFO note naming the languages that were not checked (in the terminal, the report and the folder summary). The verdict itself is not changed, so it can still be clean. `--doctor` lists the 10 languages with ✓ or ✗.
- A legitimate correction notice with a visible polite request (for example "veuillez ignorer les instructions précédentes") can be rated HIGH, because it is the same sentence as the attack. The report transcribes the text and the person judges.
- The Chinese phrases and the Chinese OCR target Simplified characters; Traditional Chinese is only partly recognized.

**Note for reviewers**

This is a defensive detector. `scripts/padroes_injecao.py` contains regular expressions of known prompt-injection phrases in 10 languages (for example "ignore previous instructions") because the tool searches for them inside documents; they are detection patterns, not instructions. The only external program is the Tesseract OCR binary, called through `subprocess.run` with an argument list and without `shell=True`. There is no network access. The tool never writes to or modifies the analyzed file.

## Requires

- Python

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the raio-x-documental — Hidden Text & Prompt Injection Detector skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How is this different from just asking an AI to read the document?

An AI that reads a document also reads the hidden instructions inside it and may follow them. This skill checks the file first with a deterministic Python engine: it compares what a person sees with what a machine reads (text layers, fonts, colors and real pixel contrast, Unicode characters, metadata, OCR of images), so hidden commands are found before the document reaches your AI.

### Which formats can it analyze?

PDF (native and scanned), DOCX/DOC, ODT, RTF, TXT/MD, HTML/e-mail and images (PNG, JPG, TIFF, BMP, WEBP). You can also point it at a folder: it checks every document directly inside it.

### What do I need to run it?

Python 3.9+ and four packages (pip install pymupdf python-docx lxml pillow). Tesseract OCR is needed only for images and scanned PDFs, with the language pack of each script you scan. The --doctor command checks everything for you, including which of the 10 languages are installed.

### Can I use the reports in legal or forensic work?

The formal report (HTML/JSON, in Brazilian Portuguese) follows the structure of Brazilian expert reports (Code of Civil Procedure, art. 473): file identification with SHA-256, method, findings with location and transcription, and a conclusion. It is a technical aid that supports your review, not a substitute for it.

### What exactly is included?

The full Python detection engine, the SKILL.md workflow for your agent, a README, the license and an integrity manifest (--verificar-integridade confirms the files are exactly as published). The engine runs locally and has no network access.

### Does it stop my AI from being hijacked by a malicious document?

It finds hidden content and commands before the document reaches your AI, and it never follows instructions found inside documents. If a file is flagged, you can create a copy with only the visible text (--modo neutralizar) that is safe to give to an AI. A clean verdict means no known technique was found, not an absolute guarantee.

### Which document languages does it support?

Hidden-text detection works in any language. It recognizes injection commands in 10 languages: English, Mandarin Chinese, Hindi, Spanish, French, Arabic, Bengali, Russian, Portuguese and Urdu. For images and scanned PDFs, the OCR detects these scripts on its own; --idiomas-ocr forces a language (for example --idiomas-ocr hin).

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
