312-50V11 · Question #22
Code injection is a form of attack in which a malicious user:
The correct answer is A. Inserts text into a data field that gets interpreted as code. Code injection occurs when attacker-supplied text entered into a data field is interpreted and executed as code by the application or underlying system. This is distinct from memory exploits, client-side scripting attacks, or direct file system access.
Question
Code injection is a form of attack in which a malicious user:
Options
- AInserts text into a data field that gets interpreted as code
- BGets the server to execute arbitrary code using a buffer overflow
- CInserts additional code into the JavaScript running in the browser
- DGains access to the codebase on the server and inserts new code
How the community answered
(55 responses)- A87% (48)
- B7% (4)
- C4% (2)
- D2% (1)
Why each option
Code injection occurs when attacker-supplied text entered into a data field is interpreted and executed as code by the application or underlying system. This is distinct from memory exploits, client-side scripting attacks, or direct file system access.
In a code injection attack, a malicious user inputs a string into a data field (such as a form input, URL parameter, or API call) that the application fails to sanitize, causing the backend to parse and execute the input as code. Classic examples include SQL injection, LDAP injection, and OS command injection, where the injected text alters the intended logic of a query or command.
Executing arbitrary code via a buffer overflow is a memory corruption exploit, not code injection through a data field.
Inserting code into JavaScript running in the browser describes Cross-Site Scripting (XSS), which is a client-side injection attack distinct from server-side code injection.
Gaining access to the server codebase and inserting new code describes unauthorized code modification or a supply chain attack, not code injection.
Concept tested: Code injection attack definition and mechanism
Source: https://owasp.org/www-community/attacks/Code_Injection
Topics
Community Discussion
No community discussion yet for this question.