Dangerous Functions Reference
Purpose
Provide comprehensive knowledge of security-sensitive functions (sinks) across programming languages for whitebox penetration testing. These functions are common targets during code review because improper use leads to critical vulnerabilities.
When to Use
Activate this skill during:
- Code review phase of whitebox security review
- Searching for potential vulnerability entry points
- Building grep patterns for sink identification
- Understanding language-specific security risks
Core Concepts
Sources vs Sinks
Sources: Entry points where user input enters the application
- HTTP parameters, headers, cookies
- File uploads, database reads
- Environment variables, command-line arguments
Sinks: Functions where malicious input causes damage
- Command execution, SQL queries
- File operations, deserialization
- Code evaluation, template rendering
Risk Categories
| Category | Impact | Common Languages |
|---|---|---|
| Command Injection | Remote Code Execution | All |
| Code Injection | Remote Code Execution | PHP, Python, JS |
| SQL Injection | Data breach | All with databases |
| Deserialization | Remote Code Execution | Java, PHP, Python, .NET |
| File Operations | LFI/RFI/Arbitrary Write | All |
| SSRF | Internal network access | All |
| Template Injection | Remote Code Execution | Python, Java, JS |
| Reentrancy | Fund theft | Solidity |
| Flash Loan Attacks | Price/state manipulation | Solidity |
| Access Control | Privilege escalation | Solidity |
Methodology
Step 1: Identify Application Language
Determine the primary language(s) used:
- Check file extensions (.php, .java, .py, .js, .cs, .go, .rb)
- Review package managers (composer.json, pom.xml, requirements.txt, package.json)
- Check framework indicators
Step 2: Load Language-Specific Reference
Consult the appropriate reference file for comprehensive sink lists:
references/php-sinks.mdfor PHP applicationsreferences/java-sinks.mdfor Java applicationsreferences/python-sinks.mdfor Python applicationsreferences/javascript-sinks.mdfor Node.js/JavaScriptreferences/dotnet-sinks.mdfor .NET/C# applicationsreferences/go-ruby-sinks.mdfor Go and Rubyreferences/rust-sinks.mdfor Rust applicationsreferences/kotlin-sinks.mdfor Kotlin/Android applications (preview -- not in supported language list)references/swift-sinks.mdfor Swift/iOS applications (preview -- not in supported language list)references/solidity-sinks.mdfor Solidity smart contracts
Step 3: Search for Sinks
Use Grep tool to search for dangerous functions:
- Search one category at a time (command, code, SQL, file, etc.)
- Use case-insensitive search for better coverage
- Include all relevant file extensions
Step 4: Catalog Findings
For each identified sink, document:
- File path and line number
- Function name and context
- Input sources (if visible)
- Initial risk assessment
Step 5: Prioritize for Testing
Rank findings using this framework:
| Priority | Criteria |
|---|---|
| Critical | Direct user input reaches sink |
| High | Database/file data (user-controlled) reaches sink |
| Medium | Authenticated user input reaches sink |
| Low | Admin-only input reaches sink |
| Info | Hardcoded values only |
Prioritization Framework
When reviewing identified sinks, consider:
- Input Proximity: How close is user input to the sink?
- Authentication: Does exploitation require authentication?
- Privilege Level: What access level is needed?
- Impact: What can an attacker achieve?
- Exploitability: Are there filters or sanitization?
Additional Resources
Reference Files
For comprehensive function lists by language, consult:
references/php-sinks.md- PHP dangerous functions with grep patternsreferences/java-sinks.md- Java dangerous functions with grep patternsreferences/python-sinks.md- Python dangerous functions with grep patternsreferences/javascript-sinks.md- JavaScript/Node.js dangerous functionsreferences/dotnet-sinks.md- .NET/C# dangerous functionsreferences/go-ruby-sinks.md- Go and Ruby dangerous functionsreferences/rust-sinks.md- Rust dangerous functions (unsafe, FFI, etc.)references/kotlin-sinks.md- Kotlin/Android dangerous functions (preview -- not in supported language list)references/swift-sinks.md- Swift/iOS dangerous functions (preview -- not in supported language list)references/solidity-sinks.md- Solidity smart contract sinks (reentrancy, access control, flash loans)
Integration with Other Skills
- Use vuln-patterns skill for exploitation techniques per vulnerability type
- Use data-flow-tracing skill to trace input from sources to identified sinks
- Use exploit-techniques skill to develop PoC for confirmed vulnerabilities