analyzing-taint-flow
Tracks untrusted input propagation from sources to sinks in binary code to identify injection vulnerabilities. Use when analyzing data flow, tracing user input to dangerous functions, or detecting command/SQL injection.
When & Why to Use This Skill
This Claude skill specializes in automated taint analysis for binary code, enabling the precise detection of critical injection vulnerabilities. By tracing the propagation of untrusted input from sources to dangerous sinks, it identifies security flaws such as command injection, SQL injection, and buffer overflows, providing a comprehensive risk assessment and exploitability analysis for security researchers and developers.
Use Cases
- Vulnerability Discovery: Automatically trace untrusted user input to dangerous functions in binary files to uncover hidden security flaws like command or SQL injection.
- Security Auditing: Streamline the audit of legacy or third-party software by identifying potential path traversal and memory corruption vulnerabilities through data flow analysis.
- Malware Analysis: Analyze how external data influences program execution to understand potential malicious behaviors, backdoors, or data exfiltration paths.
- Risk Assessment: Evaluate the effectiveness of input sanitization and character filtering to determine the reachability and exploitability of detected taint paths.
| name | analyzing-taint-flow |
|---|---|
| description | Tracks untrusted input propagation from sources to sinks in binary code to identify injection vulnerabilities. Use when analyzing data flow, tracing user input to dangerous functions, or detecting command/SQL injection. |
Taint Analysis
Detection Workflow
- Identify sources: Find recv, read, getenv, fgets, scanf, argv (input functions)
- Identify sinks: Find system, popen, strcpy, sprintf, execve, malloc (dangerous functions)
- Find taint paths: Use
xrefs_toto trace from sources to sinks - Analyze sanitization: Check for input validation, length checks, character filtering, encoding/escaping
- Assess risk: Determine reachability, check if attacker controls critical parts, evaluate exploitability
Key Patterns
- Direct command injection: recv() -> buffer -> sprintf(cmd, "echo %s", buffer) -> system(cmd)
- Path traversal: fgets() -> filename -> fopen(filename, "r")
- Buffer overflow via tainted size: recv() -> size_buffer -> atoi(size_buffer) -> malloc(size)
Output Format
Report taint paths with: source (function, address, context), sink (function, address, context), path (list of functions), sanitizers_found, is_vulnerable, confidence, vulnerability_type.
Severity Guidelines
- CRITICAL: Direct injection with no sanitization (command injection, SQL injection)
- HIGH: Path traversal, buffer overflow via tainted size
- MEDIUM: Potential injection with partial sanitization
- LOW: Tainted data with limited impact
See Also
patterns.md- Detailed detection patterns and exploitation scenariosexamples.md- Example analysis cases and code samplesreferences.md- CWE references and mitigation strategies