350-901 · Question #8
Which two techniques protect against injection attacks? (Choose two.)
The correct answer is A. input validation D. string escaping of user free text and data entry. To protect against injection attacks, it is crucial to implement robust input validation to ensure data conforms to expected formats and to perform string escaping on all user-supplied free text before it is processed by an interpreter.
Question
Options
- Ainput validation
- Btrim whitespace
- Climit text areas to 255 characters
- Dstring escaping of user free text and data entry
- Eonly use dropdown, checkbox, and radio button fields
How the community answered
(19 responses)- A89% (17)
- B5% (1)
- C5% (1)
Why each option
To protect against injection attacks, it is crucial to implement robust input validation to ensure data conforms to expected formats and to perform string escaping on all user-supplied free text before it is processed by an interpreter.
Input validation is a critical defense that ensures user-supplied data conforms to expected types, formats, and ranges, rejecting any malicious input that could exploit injection vulnerabilities.
Trimming whitespace from user input is a form of sanitization but does not directly protect against the malicious code or commands characteristic of injection attacks.
Limiting text areas to a specific character count, such as 255 characters, may constrain the size of an injection payload but does not inherently prevent the injection of malicious commands within that limit.
String escaping of user free text involves converting special characters within the input into their literal representations, preventing them from being interpreted as executable code or commands by backend systems or interpreters.
While restricting input to predefined options like dropdowns or checkboxes can prevent injection by removing free-text entry, it is a design constraint rather than a universally applicable technique when free-text input is required.
Concept tested: Injection attack prevention techniques
Source: https://learn.microsoft.com/en-us/azure/security/fundamentals/owasp-top-10#a03-2021-injection
Topics
Community Discussion
No community discussion yet for this question.