Question 32 of 1,013
SY0-701 Threats, Vulnerabilities, and Mitigations Practice Question
A web login form uses unsanitized input in the backend query. When an attacker enters `' OR '1'='1'--` into the username field, the application grants access without a valid password. Which attack pattern is being used?
⚠ Common exam trap
Many exam-takers confuse SQL injection with cross-site scripting because both involve untrusted input, but SQL injection targets the database layer through query manipulation, whereas XSS targets the client-side DOM or browser execution context.
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, because the input changes the meaning of the database query.
The attacker's input (`' OR '1'='1'--`) is a classic SQL injection payload that alters the structure of the backend SQL query. By injecting a tautology (`OR '1'='1'`) and commenting out the rest of the query with `--`, the attacker bypasses authentication, causing the database to return a valid row without requiring a correct password.
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, because the attacker is trying to run code in the browser.
Why it's wrong here
Cross-site scripting (XSS) would require the unsanitized input to be rendered back to a browser in an HTML or JavaScript context, where it could execute script. In this login form, the input is instead concatenated into a database query and evaluated by the SQL engine, so the payload's effect is to modify the query's logic on the server side, not run code in the victim's browser. The attack succeeds because the backend is constructing SQL statements unsafely, bypassing authentication at the database layer rather than hijacking a client-side session.
- ✓
SQL injection, because the input changes the meaning of the database query.
Why this is correct
SQL injection occurs when untrusted input is embedded into a query and alters the intended logic. The crafted string closes the original condition and adds a statement that evaluates as true, which can bypass authentication checks. This is a classic sign that the application is constructing queries unsafely instead of using parameterized statements or properly bound variables.
- ✗
Broken session management, because the user is still logged in after leaving the page.
Why it's wrong here
Broken session management pertains to vulnerabilities in the lifecycle of an established session, such as predictable tokens, fixation, or improper expiration. Here, the flaw occurs during the authentication attempt itself: the crafted input causes the SQL query to return true without verifying credentials, so a session may never have been properly created before the compromise. Even if the user remains logged in afterward, that is a downstream consequence of an authentication bypass, not a weakness in how the application handles session IDs or timeouts.
- ✗
Insecure deserialization, because the application accepts user input.
Why it's wrong here
Insecure deserialization vulnerabilities arise when untrusted data is deserialized into an object model, allowing an attacker to manipulate application logic or execute code via crafted object attributes. In this login form, the input is a plain-text string placed into a SQL statement, not a serialized payload such as PHP serialized data or a Java ObjectInputStream stream. The attack changes the query's boolean logic with SQL syntax, which is a defining characteristic of SQL injection rather than deserialization or any generic acceptance of user input.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 11, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.