Injection Vulnerabilities
Injection flaws occur when untrusted data is sent to an interpreter as part of a command or query. AIPTx comprehensively tests for all common injection types.SQL Injection
Types Detected
| Type | Description | Example |
|---|---|---|
| Classic | Direct query manipulation | ' OR '1'='1 |
| Union-based | Data extraction via UNION | ' UNION SELECT * FROM users-- |
| Blind (Boolean) | True/false response analysis | ' AND 1=1-- |
| Blind (Time-based) | Response time analysis | ' AND SLEEP(5)-- |
| Error-based | Database error messages | ' AND EXTRACTVALUE(...) |
| Stacked Queries | Multiple statement execution | '; DROP TABLE users;-- |
Testing Approach
AIPTx tests SQL injection by:- Parameter Discovery - Identifying all injectable parameters
- Database Fingerprinting - Detecting database type (MySQL, PostgreSQL, MSSQL, Oracle)
- Payload Generation - Context-aware payloads for each database
- Exploitation - Validating with data extraction attempts
Example Finding
NoSQL Injection
Databases Covered
- MongoDB
- CouchDB
- Redis
- Cassandra
- DynamoDB
Attack Vectors
Testing Methodology
- Identify NoSQL endpoints
- Test operator injection (
$ne,$gt,$lt,$regex) - Test JavaScript injection in
$whereclauses - Test array/object manipulation
Command Injection
OS Command Injection
AIPTx tests for command injection in:- File operations
- System utilities
- Shell commands
- Process execution
Payloads
Example Finding
LDAP Injection
Testing Coverage
- Authentication bypass
- Information disclosure
- Filter manipulation
Payloads
Template Injection (SSTI)
Supported Frameworks
| Framework | Language | Detection |
|---|---|---|
| Jinja2 | Python | {{7*7}} → 49 |
| Twig | PHP | {{7*7}} → 49 |
| Freemarker | Java | ${7*7} → 49 |
| Velocity | Java | #set($x=7*7)$x |
| Handlebars | JavaScript | {{constructor.constructor('return 7*7')()}} |
Exploitation Chain
- Detection - Identify template engine
- Context - Determine injection context
- Sandbox Escape - Test for RCE capability
- Exploitation - Execute arbitrary code
XPath Injection
Testing Scenarios
Header Injection
Types
- Host header injection
- X-Forwarded-For manipulation
- Email header injection (CRLF)
Example
Remediation Guidance
SQL Injection
SQL Injection
Prevention:
- Use parameterized queries / prepared statements
- Implement input validation
- Apply least privilege database accounts
Command Injection
Command Injection
Prevention:
- Avoid shell commands when possible
- Use allowlists for permitted characters
- Escape special characters
NoSQL Injection
NoSQL Injection
Prevention:
- Validate input types
- Sanitize user input
- Use query builders with parameterization