GSEC · Question #313
What is a recommended defense against SQL injection, OS injection, and buffer overflows?
The correct answer is B. Validate user input. Input validation is the primary defense that prevents malformed or malicious data from being processed by an application, blocking injection and overflow attacks at the source.
Question
What is a recommended defense against SQL injection, OS injection, and buffer overflows?
Options
- APut in an application layer
- BValidate user input
- CUse a secure protocol like HTTPS
- DUse stored procedures
How the community answered
(27 responses)- A4% (1)
- B81% (22)
- C4% (1)
- D11% (3)
Why each option
Input validation is the primary defense that prevents malformed or malicious data from being processed by an application, blocking injection and overflow attacks at the source.
Adding an application layer does not inherently sanitize data - an application layer can itself be vulnerable if it passes unvalidated input downstream.
SQL injection, OS injection, and buffer overflows all share a common root cause - the application trusts and processes unsanitized user-supplied data without checking it first. Validating input ensures data conforms to expected type, length, and format before it reaches any interpreter or memory buffer. This single control addresses all three attack classes simultaneously.
HTTPS encrypts data in transit between client and server but does nothing to prevent malicious input from being executed once it arrives at the server.
Stored procedures can reduce SQL injection risk by parameterizing queries, but they do not protect against OS injection or buffer overflows, so they are not a general defense for all three.
Concept tested: Input validation as a defense against injection attacks
Source: https://owasp.org/www-project-cheat-sheets/cheatsheets/Input_Validation_Cheat_Sheet.html
Topics
Community Discussion
No community discussion yet for this question.