PT0-001 · Question #199
A penetration tester is performing a code review against a web application Given the following URL and source code: Which of the following vulnerabilities is present in the code above?
The correct answer is C. Command injection. When a web application passes user-supplied input directly into a system shell command without sanitization, it is vulnerable to command injection.
Question
A penetration tester is performing a code review against a web application Given the following URL and source code:
Which of the following vulnerabilities is present in the code above?
Exhibit
Options
- ASQL injection
- BCross-site scripting
- CCommand injection
- DLDAP injection
How the community answered
(52 responses)- A6% (3)
- B12% (6)
- C79% (41)
- D4% (2)
Why each option
When a web application passes user-supplied input directly into a system shell command without sanitization, it is vulnerable to command injection.
SQL injection targets database query interpreters using SQL metacharacters; the URL and code pattern described invoke OS-level execution, not a database layer.
Cross-site scripting involves injecting malicious scripts into output rendered by a browser; the vulnerability here affects server-side command execution, not client-side rendering.
Command injection occurs when user-controlled input is concatenated into an OS-level command call (e.g., via exec(), system(), or shell_exec()) without proper escaping or allowlisting. An attacker can append shell metacharacters such as semicolons, pipes, or backticks to break out of the intended command and execute arbitrary operating system commands. This is distinct from SQL or LDAP injection because the target interpreter is the OS shell, not a query language.
LDAP injection manipulates LDAP directory queries; nothing in the described pattern interacts with an LDAP service or query syntax.
Concept tested: OS command injection via unsanitized user input
Source: https://owasp.org/www-community/attacks/Command_Injection
Topics
Community Discussion
No community discussion yet for this question.
