A security analyst inspecting web application access logs discovers the following HTTP POST request payload targeting an enterprise search endpoint:
`POST /api/v1/products/search HTTP/1.1`
`Host: portal.example.com`
`Content-Type: application/x-www-form-urlencoded`
`Payload: item_query=gadget' UNION SELECT credit_card_num, CVV FROM customer_payment_data WHERE '1'='1`
Which of the following vulnerabilities is being exploited in this scenario, and what is the primary application-level mitigation control required to prevent it?
- SQL injection; mitigated primarily by implementing parameterized database queries and prepared statements.Answer
- BCross-site scripting (XSS); mitigated primarily by implementing context-aware output encoding and parameterized queries.
- CSQL injection; mitigated primarily by configuring network layer-3 stateful firewall rules to block unauthorized database ports.
- DInsecure Direct Object Reference (IDOR); mitigated primarily by enforcing multi-factor authentication on database endpoints.
Answer
SQL injection; mitigated primarily by implementing parameterized database queries and prepared statements.
The HTTP payload contains classic SQL injection syntax, specifically using single quotes to break out of data context and `UNION SELECT` to retrieve data from sensitive database tables (`customer_payment_data`). The definitive mitigation for SQL injection is adopting parameterized queries (prepared statements), which separate user data from SQL command logic at the application layer.
Step-by-Step Solution
Key Concept
Application SQL Injection Identification and Parameterized Query Mitigation
Estimated Time:2m 0s