SY0-701 Threats, Vulnerabilities, and Mitigations Practice Question
A web portal builds its database query by directly appending a user's search input. When the user types a single quote, the application returns a database error. Which attack is most likely?
⚠ Common exam trap
Test-takers frequently confuse the immediate symptom (a database error) with cross-site scripting, but the single quote directly points to SQL syntax breakage, not script execution in the browser.
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
The application directly concatenates user input into a database query without sanitization. When a single quote (') is appended, it breaks the SQL string delimiter, causing a syntax error that the database exposes. This is the classic indicator of a SQL injection vulnerability, where an attacker can manipulate the query structure.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Cross-site scripting
Why it's wrong here
Cross-site scripting (XSS) injects malicious client-side scripts into a web page, which then execute in a victim's browser to steal cookies, tokens, or perform actions on behalf of the user. This attack targets the browser's rendering engine, not the backend database query builder. The clue about directly appending input to a database query producing a database error points to a server-side interpreter, so XSS's client-side script execution cannot be the cause of that specific symptom.
- ✓
SQL injection
Why this is correct
SQL injection occurs when untrusted user input is concatenated directly into a SQL statement without proper sanitization or parameterization. An attacker can craft input containing SQL metacharacters, such as a single quote and boolean operators, to break out of the intended query structure and manipulate the statement's logic—for example, bypassing WHERE conditions or adding UNION-based exfiltration. The resulting database error from the appended input is a classic indicator of an exploitable SQL injection, making this the correct answer.
- ✗
DNS poisoning
Why it's wrong here
DNS poisoning corrupts a recursive resolver's cache so that a legitimate domain name resolves to an attacker-controlled IP address, redirecting network traffic at the name-resolution layer. This attack occurs before any HTTP request reaches the web server and does not alter how the server's application code handles user input. Since the symptom described is a database query error triggered by search input appended in the portal's code, it is unrelated to the domain resolution process.
- ✗
Privilege escalation
Why it's wrong here
Privilege escalation is an attack that exploits flaws in an application or operating system to gain higher-level permissions than those originally assigned, such as an unprivileged user becoming an administrator. It typically involves abusing misconfigured access controls, kernel vulnerabilities, or insecure service permissions, not manipulating string-based SQL query syntax. The key clue here is the construction of a database query from input, which points to a data-layer injection flaw rather than an account or permission elevation issue.
Visual reference
Go deeper
Related to this question
Learn chapter
Malware Types and Characteristics
Key term
SQL
SQL is a standard programming language used to manage, query, and manipulate relational databases by issuing commands like SELECT, INSERT, UPDATE, and DELETE.
Key term
SQL
SQL is a standardized programming language used to manage and manipulate relational databases, enabling querying, updating, and data retrieval.
About these practice questions
This SY0-701 question is part of Courseiva's 1,013-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This SY0-701 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 SY0-701 exam.