- A
Deploy only a web application firewall and keep the code unchanged.
Why wrong: A WAF can help reduce exposure, but it does not fix the underlying unsafe query construction in the application code.
- B
Use parameterized queries or prepared statements in the application code.
Parameterized queries separate code from user-supplied data, which prevents injected input from being interpreted as SQL instructions. That directly addresses the flaw described in the scenario and is the most reliable long-term fix. It also scales better than trying to block every malicious pattern with filtering or a perimeter tool. In secure development, fixing the query construction is preferred because it removes the root cause instead of only reducing symptoms at the edge.
- C
Store the database password as a salted hash in the application configuration.
Why wrong: Hashing a database password does not prevent the application from building unsafe SQL queries with attacker-controlled input.
- D
Disable HTTPS so the request body is easier to inspect by network tools.
Why wrong: Turning off encryption weakens confidentiality and does not stop SQL injection, because the problem exists in server-side query handling.
Quick Answer
The best remediation for SQL injection is to use parameterized queries or prepared statements in the application code. This approach works because it strictly separates SQL logic from user input, preventing the dangerous concatenation that allows an attacker’s single quote and `OR 1=1` to be interpreted as executable code. Instead, placeholders like `?` or `:param` are used, and the database engine treats the input as literal data, not as part of the SQL command. On the Security+ SY0-701 exam, this question tests your understanding of secure coding practices under Domain 3 (Implementation), specifically how to mitigate injection flaws. A common trap is choosing input validation or escaping as the answer—while helpful, these are not as robust as parameterization because they can be bypassed. Remember the memory tip: “Separate the code from the data—parameterize, don’t concatenate.”
SY0-701 Threats, Vulnerabilities, and Mitigations Practice Question
This SY0-701 practice question tests your understanding of threats, vulnerabilities, and mitigations. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
A developer reports that a search field returns all customer records when they enter a single quote followed by OR 1=1. Security confirms the web app concatenates user input directly into SQL statements. Which remediation is best?
Clue words in this question
Noticing these words before you look at the options changes how you read each choice.
Clue:
"best"Why it matters: Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.
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
Use parameterized queries or prepared statements in the application code.
Option B is correct because parameterized queries or prepared statements separate SQL logic from user input, preventing the concatenation that allows SQL injection. By using placeholders (e.g., `?` or `:param`) and binding user input as data, the database engine treats the single quote and `OR 1=1` as literal string values, not executable SQL code. This directly remediates the root cause—dynamic SQL construction—without relying on external filters or insecure workarounds.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Deploy only a web application firewall and keep the code unchanged.
Why it's wrong here
A WAF can help reduce exposure, but it does not fix the underlying unsafe query construction in the application code.
- ✓
Use parameterized queries or prepared statements in the application code.
Why this is correct
Parameterized queries separate code from user-supplied data, which prevents injected input from being interpreted as SQL instructions. That directly addresses the flaw described in the scenario and is the most reliable long-term fix. It also scales better than trying to block every malicious pattern with filtering or a perimeter tool. In secure development, fixing the query construction is preferred because it removes the root cause instead of only reducing symptoms at the edge.
Clue confirmation
The clue word "best" in the question point toward this answer.
Related concept
Read the scenario before looking for a memorised answer.
- ✗
Store the database password as a salted hash in the application configuration.
Why it's wrong here
Hashing a database password does not prevent the application from building unsafe SQL queries with attacker-controlled input.
- ✗
Disable HTTPS so the request body is easier to inspect by network tools.
Why it's wrong here
Turning off encryption weakens confidentiality and does not stop SQL injection, because the problem exists in server-side query handling.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates may think a WAF (Option A) is sufficient because it blocks common payloads like `' OR 1=1`, but the exam emphasizes that security must be implemented at the code level, not just at the network perimeter.
Detailed technical explanation
How to think about this question
Under the hood, parameterized queries work by sending the SQL statement template and the parameter values separately to the database server (e.g., via the wire protocol in PostgreSQL or SQL Server). The database compiles the query plan before substituting parameters, so user input is never interpreted as SQL syntax—even if it contains malicious characters. A real-world scenario: in a Java JDBC `PreparedStatement`, the driver escapes special characters automatically, but if a developer mistakenly uses string concatenation (e.g., `"SELECT * FROM users WHERE id = '" + input + "'"`), the injection succeeds; the fix is to use `preparedStatement.setString(1, input)`.
KKey Concepts to Remember
- Read the scenario before looking for a memorised answer.
- Find the constraint that changes the correct option.
- Eliminate answers that are true in general but not in this case.
TExam Day Tips
- Watch for words such as best, first, most likely and least administrative effort.
- Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A security team runs a vulnerability scan on a web application and discovers an unpatched SQL injection flaw. The team prioritises remediation by CVSS score — critical flaws are patched within 24 hours, high within 7 days. Questions like this test whether you understand vulnerability management processes, scanning tools, and remediation prioritisation.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
- →
Threats, Vulnerabilities, and Mitigations — study guide chapter
Learn the concepts, then practise the questions
- →
Threats, Vulnerabilities, and Mitigations practice questions
Targeted practice on this topic area only
- →
All SY0-701 questions
1,152 questions across all exam domains
- →
Security+ SY0-701 study guide
Full concept coverage aligned to exam objectives
- →
SY0-701 practice test guide
How to use practice tests most effectively before exam day
Related practice questions
Related SY0-701 practice-question pages
Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.
General Security Concepts practice questions
Practise SY0-701 questions linked to General Security Concepts.
Threats, Vulnerabilities, and Mitigations practice questions
Practise SY0-701 questions linked to Threats, Vulnerabilities, and Mitigations.
Security Architecture practice questions
Practise SY0-701 questions linked to Security Architecture.
Security Operations practice questions
Practise SY0-701 questions linked to Security Operations.
Security Program Management and Oversight practice questions
Practise SY0-701 questions linked to Security Program Management and Oversight.
Security+ social engineering questions
Practise SY0-701 questions linked to Security+ social engineering questions.
Security+ cryptography practice questions
Practise SY0-701 questions linked to Security+ cryptography.
Security+ IAM questions
Practise SY0-701 questions linked to Security+ IAM questions.
Security+ risk management questions
Practise SY0-701 questions linked to Security+ risk management questions.
Security+ incident response questions
Practise SY0-701 questions linked to Security+ incident response questions.
Security+ malware questions
Practise SY0-701 questions linked to Security+ malware questions.
Security+ vulnerability management questions
Practise SY0-701 questions linked to Security+ vulnerability management questions.
Practice this exam
Start a free SY0-701 practice session
Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.
FAQ
Questions learners often ask
What does this SY0-701 question test?
Threats, Vulnerabilities, and Mitigations — This question tests Threats, Vulnerabilities, and Mitigations — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Use parameterized queries or prepared statements in the application code. — Option B is correct because parameterized queries or prepared statements separate SQL logic from user input, preventing the concatenation that allows SQL injection. By using placeholders (e.g., `?` or `:param`) and binding user input as data, the database engine treats the single quote and `OR 1=1` as literal string values, not executable SQL code. This directly remediates the root cause—dynamic SQL construction—without relying on external filters or insecure workarounds.
What should I do if I get this SY0-701 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Are there clue words in this question I should notice?
Yes — watch for: "best". Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
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 →
Same concept, more angles
3 more ways this is tested on SY0-701
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A developer wants to reduce the risk of SQL injection in a new customer search form. Which two changes are the best mitigations? Select two.
easy- ✓ A.Use parameterized queries or prepared statements for all database access.
- ✓ B.Validate and constrain user input before it reaches the database layer.
- C.Store the database password in the page source so the app can connect faster.
- D.Disable TLS so the application can inspect requests more easily.
- E.Allow the application to build SQL statements by concatenating raw user input.
Why A: Option A is correct because parameterized queries and prepared statements separate SQL logic from user-supplied data, ensuring that input is treated as a literal value rather than executable code. This prevents attackers from injecting malicious SQL commands into the query string, as the database driver automatically escapes or binds parameters safely. This is the most effective defense against SQL injection attacks.
Variation 2. A support portal searches customer records by last name. When a tester enters a single quote into the search field, the application returns a database syntax error. Which attack is most likely possible?
easy- ✓ A.SQL injection, because the input may be altering the database query
- B.Cross-site scripting, because the page is executing malicious JavaScript in the browser
- C.Server-side request forgery, because the server is making internal network calls
- D.Cross-site request forgery, because the user is being tricked into submitting a form
Why A: The single quote character is a common SQL injection test payload. When it triggers a database syntax error, it confirms that the input is being directly concatenated into a SQL query without proper sanitization or parameterization. This allows an attacker to break out of the intended query structure and execute arbitrary SQL commands, making SQL injection the most likely attack.
Variation 3. A support portal searches customers by last name using a parameter called q. After one user enters a single quote, the app returns a SQL syntax error. A tester then submits `test' OR '1'='1` and sees every customer record. Which control most directly prevents this issue?
medium- ✓ A.Parameterize the database queries with prepared statements
- B.Encode all output returned to the browser
- C.Add CSRF tokens to the login form
- D.Move the application to a separate VLAN
Why A: The vulnerability is SQL injection, which occurs when user input is directly concatenated into a SQL query. Parameterized queries (prepared statements) separate SQL logic from data by using placeholders, ensuring user input is treated as data only and never executed as code. This directly prevents the attacker from injecting malicious SQL fragments like `' OR '1'='1`.
Keep practising
More SY0-701 practice questions
- An HR analyst must send a salary file to an external auditor. The auditor only needs names, departments, and salary tota…
- An investigator receives a suspect laptop drive that may be used in court. Which approach best supports a forensically s…
- An investigator must collect data from a suspected insider-threat laptop so the evidence could be used in an HR and lega…
- An NDR tool shows a production web server sending small, periodic DNS queries to random-looking subdomains under a domai…
- An investigator needs to make a forensic image of a suspect laptop without changing the original drive contents. Which t…
- An operations team manages Linux servers over SSH. The security team wants to stop direct management access from employe…
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.