PT0-002 Vulnerability Discovery and Analysis Practice Question
During code review, a penetration tester identifies the following line in a PHP web application: $sql = "SELECT * FROM users WHERE username='" . $_GET['user'] . "'"; Which type of vulnerability is most likely present?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
SQL injection
Direct concatenation of user input into an SQL query without sanitization results in SQL injection vulnerability.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
SQL injection
Why this is correct
The $_GET['user'] value is concatenated directly into the SQL string without parameterisation or escaping, so an attacker can inject SQL syntax through the user parameter. This is classic SQL injection, allowing query manipulation or data exfiltration.
- ✗
Insecure deserialization
Why it's wrong here
The code concatenates $_GET['user'] directly into a SQL string, producing SQL injection; deserialization concerns converting untrusted serialised objects into PHP objects, which appears nowhere here. Insecure deserialization would be correct if the application passed user-supplied serialised data to unserialize().
- ✗
Command injection
Why it's wrong here
The concatenated $_GET['user'] parameter is inserted into a SQL statement without sanitisation, which is SQL injection; command injection requires user input passed to a shell function such as system() or exec(). Command injection would be the finding if input reached an OS command, not a database query.
- ✗
Cross-site scripting (XSS)
Why it's wrong here
XSS involves injecting client-side scripts, not SQL.
Go deeper
Related to this question
About these practice questions
One of 777 original PT0-003 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PT0-003 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PT0-003 exam.