pAIn
How It Works
⚠️ Authorized Testing Only
This tool interacts with live systems and must only be used for testing that has been explicitly authorized by the asset owner. Unauthorized use of this tool to probe, scan, exploit, or otherwise interact with systems you do not have written permission to test is illegal under computer fraud and abuse laws (CFAA, CMA, and international equivalents). pr0t31n does not condone or recommend any unauthorized use. Always obtain a signed Rules of Engagement (RoE) or Statement of Work (SoW) before beginning any assessment.
pAIn is an AI pipeline prompt-injection red-team tool that generates adversarial test files with canary-bearing payloads embedded in metadata, text layers, and audio content. The tool targets AI transcription and classification pipelines by creating files in multiple formats (PDF, DOCX, PNG, JPG, HEIF, WAV, MP3, FLAC, ALAC, AAC, OGG, ZIP) that contain hidden instructions designed to hijack the AI model's behavior when the file is processed.
Each test file contains a unique canary token — a random string that the embedded payload instructs the AI to include in its response. pAIn then submits the generated file to the target AI pipeline endpoint and inspects the response for the canary token. If the canary appears in the AI's output, the injection was successful: the model followed the embedded adversarial instruction rather than performing its intended task (transcription, classification, summarization, etc.).
Payloads are organized into five categories that test different injection strategies: task_hijack (model abandons its task entirely), prefix_inject (model prepends canary to normal output), classify_override (model returns injected classification instead of real one), system_probe (model reveals its system prompt), and authority_claim (model follows a claimed authority directive). Each category contains multiple payload templates with {C} placeholders that are replaced with unique canary tokens at test time.
pAIn supports both API-based targets (direct HTTP submission) and web application targets (cookie/form authentication with login flow). A dry-run mode generates all test files without submitting them, useful for reviewing payloads before execution. All subprocess invocations (ffmpeg, espeak) are routed through pr0t31n_tool_runner for execution logging.
Phase Pipeline
- Phase 1 — Target File Selection
- Phase 2 — Metadata Extraction
- Phase 3 — Payload Injection
- Phase 4 — Output Generation
Security
CLI tool. Target endpoint URLs and API keys stored in settings. Generated test files are stored locally in the project output directory.
Features
Authentication
Detection
Execution
File Generation
Injection Categories
Testing
Use Cases
AI Pipeline Security Assessment
Test whether an organization's AI document processing pipeline (OCR, transcription, classification) is vulnerable to prompt injection attacks that could cause the model to produce incorrect or attacker-controlled output.
RAG System Injection Testing
Evaluate Retrieval-Augmented Generation systems by submitting adversarial documents that attempt to inject instructions into the model's context when retrieved as reference material.
Medical AI Validation
Assess whether medical image classification or radiology report AI systems can be manipulated through crafted DICOM/image metadata to produce incorrect diagnoses.
Content Moderation Bypass Testing
Test AI-powered content moderation pipelines to determine if adversarial file metadata or embedded instructions can bypass classification filters.
Voice Assistant Injection
Evaluate speech-to-text and voice assistant pipelines by submitting audio files with embedded adversarial speech that attempts to hijack the transcription output.
CLI Reference
Command Examples
Generate and Submit
Generate adversarial test files and submit to the target AI endpoint.
Generate Only
Generate test files without submitting (for manual testing).
Third-Party Tool Invocations
Commands and flags used when this tool invokes third-party dependencies during operation.
Finding Nomenclature
pAIn findings document successful and failed prompt injection attempts against the target AI pipeline. Each finding includes the payload category, file format, specific payload template used, the canary token, and whether the canary was detected in the AI's response.
- Successful Injection (HIGH/CRITICAL) — The AI pipeline followed the embedded adversarial instruction. The canary token was found in the response, proving the model can be manipulated through file content.
- Partial Injection (MEDIUM) — The AI pipeline included the canary in a modified form or alongside normal output, indicating partial susceptibility to prompt injection.
- Failed Injection (INFO) — The AI pipeline correctly ignored the embedded instruction and produced its normal output without the canary token.
Finding titles follow the pattern: Prompt Injection: {category} via {format} (e.g., "Prompt Injection: task_hijack via PDF metadata"). Risk severity scales with the injection category: task_hijack and system_probe successes are rated CRITICAL, while prefix_inject successes are rated HIGH.
Action Items
pAIn generates action items when initial canary testing shows partial success — e.g., "Retry task_hijack with alternate encoding", "Test system_probe payload via different file format", "Manually verify authority_claim bypass in production endpoint".
Output Files
| File | Format | Description |
|---|---|---|
meta.json |
JSON | Tool identity and engagement metadata |
findings.json |
JSON | Universal findings array v1.1 |
findings.csv |
CSV | CSV mirror of findings |
summary.json |
JSON | Aggregated statistics |
scan.log |
TXT | Human-readable timestamped log |
scan.log.json |
JSONL | Machine-readable JSON log events |
errors.log |
TXT | ERROR-level entries only |
Invocation Methods
| Method | Usage |
|---|---|
| CLI — Direct |
cd /opt/pr0t31n/pAIn && python3 pain.py
Run directly with command-line arguments. |
Integration
Used By
- Crucible (manages)
Third-Party Dependencies & Credits
| Tool / Library | Developer | Type | Link |
|---|---|---|---|
| FFmpeg | FFmpeg team | system | https://github.com/FFmpeg/FFmpeg |
| espeak-ng | Reece Dunn / Jonathan Duddington | system | https://github.com/espeak-ng/espeak-ng |
| Pillow | Pillow Team | python | https://github.com/python-pillow/Pillow |
| piexif | hMatoba | python | https://github.com/hMatoba/Piexif |
| ReportLab | ReportLab Inc. | python | https://github.com/MrBitBucket/reportlab-mirror |
| mutagen | Christoph Reiter / Quod Libet | python | https://github.com/quodlibet/mutagen |
| pillow-heif | bigcat88 | python | https://github.com/bigcat88/pillow_heif |
Metadata
| Name | pAIn |
| Category | Exploitation |
| Version | 2.2.2 |
| Install Path | /opt/pr0t31n/pAIn |
| Main File | pain.py |
| GitHub | https://github.com/pr0t31n/pAIn.git |