- A
Implement a web application firewall (WAF) rule to block suspicious SQL keywords in search parameters.
Why wrong: A WAF is a compensating control that can detect and block some SQL injection payloads, but it does not fix the underlying vulnerable code. Attackers can often bypass WAF rules using encoding, obfuscation, or logic differences. This is not a permanent fix and should not be the primary recommendation.
- B
Sanitize user input by escaping single quotes and other special characters before concatenation.
Why wrong: Input sanitization via escaping can reduce risk but is not foolproof. Different databases have different escape characters and contexts (e.g., numeric fields, like clauses) where escaping may fail. It is possible to bypass escaping with techniques such as second-order SQL injection or using database functions. Parameterized queries are more robust.
- C
Replace dynamic SQL queries with parameterized prepared statements.
Parameterized prepared statements ensure that user input is always treated as data, not executable code. The database compiles the SQL statement with parameter placeholders, and the actual values are bound separately. This completely prevents SQL injection because the input cannot alter the query structure. This is the industry-standard permanent fix.
- D
Encode all user input using HTML entity encoding before database operations.
Why wrong: HTML entity encoding is designed to neutralize special characters in output that is rendered in a web browser, preventing cross-site scripting (XSS). It has no effect on SQL queries because the encoding does not change how the string is interpreted by the database. This would not prevent SQL injection.
Quick Answer
The correct choice is to replace dynamic SQL queries with parameterized prepared statements because this approach fundamentally separates SQL logic from user input, ensuring that any input is treated strictly as data rather than executable code. This permanently prevents SQL injection by design, unlike input filtering or web application firewalls, which can be bypassed by cleverly crafted payloads. On the Security+ SY0-701 exam, this concept tests your understanding of secure coding practices under Domain 3 (Implementation), often appearing in scenario-based questions where developers concatenate user input directly into queries—a classic red flag. A common trap is choosing input validation or stored procedures, but parameterized queries are the only option that eliminates the vulnerability at the code level, regardless of the input content. Remember the mnemonic: “Parameters plug the injection hole—input is data, never code.”
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 security analyst is reviewing the results of a dynamic application security test (DAST) on a new e-commerce application. The report indicates that the application's product search functionality is vulnerable to blind SQL injection. The analyst is tasked with recommending a remediation to the development team. The developers currently concatenate user input directly into SQL queries. Which of the following recommendations would most effectively and permanently mitigate this vulnerability?
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
Replace dynamic SQL queries with parameterized prepared statements.
Option C is correct because parameterized prepared statements separate SQL logic from user input, ensuring that input is always treated as data, not executable code. This permanently prevents SQL injection by design, regardless of the input content, unlike input filtering or WAF rules which can be bypassed.
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.
- ✗
Implement a web application firewall (WAF) rule to block suspicious SQL keywords in search parameters.
Why it's wrong here
A WAF is a compensating control that can detect and block some SQL injection payloads, but it does not fix the underlying vulnerable code. Attackers can often bypass WAF rules using encoding, obfuscation, or logic differences. This is not a permanent fix and should not be the primary recommendation.
- ✗
Sanitize user input by escaping single quotes and other special characters before concatenation.
Why it's wrong here
Input sanitization via escaping can reduce risk but is not foolproof. Different databases have different escape characters and contexts (e.g., numeric fields, like clauses) where escaping may fail. It is possible to bypass escaping with techniques such as second-order SQL injection or using database functions. Parameterized queries are more robust.
- ✓
Replace dynamic SQL queries with parameterized prepared statements.
Why this is correct
Parameterized prepared statements ensure that user input is always treated as data, not executable code. The database compiles the SQL statement with parameter placeholders, and the actual values are bound separately. This completely prevents SQL injection because the input cannot alter the query structure. This is the industry-standard permanent fix.
Related concept
Read the scenario before looking for a memorised answer.
- ✗
Encode all user input using HTML entity encoding before database operations.
Why it's wrong here
HTML entity encoding is designed to neutralize special characters in output that is rendered in a web browser, preventing cross-site scripting (XSS). It has no effect on SQL queries because the encoding does not change how the string is interpreted by the database. This would not prevent SQL injection.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates often choose input sanitization (Option B) because they confuse escaping with proper parameterization, not realizing that escaping is a fragile, context-dependent workaround that fails against advanced injection techniques like time-based blind SQLi or multi-byte character attacks.
Trap categories for this question
Command / output trap
HTML entity encoding is designed to neutralize special characters in output that is rendered in a web browser, preventing cross-site scripting (XSS). It has no effect on SQL queries because the encoding does not change how the string is interpreted by the database. This would not prevent SQL injection.
Detailed technical explanation
How to think about this question
Parameterized queries (also called prepared statements) use placeholders (e.g., ? in ODBC/JDBC or :param in OCI) that are bound to values after the SQL statement is compiled, so the database engine treats the bound values as data literals, not SQL syntax. This approach works even with stored procedures and ORMs, and it is the only defense that eliminates the injection vector at the query construction level, as recommended by OWASP and NIST SP 800-53.
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 developer is choosing between AES-256 (symmetric) and RSA-2048 (asymmetric) for encrypting a large file that will be sent to a partner. Symmetric encryption is fast but requires key exchange; asymmetric is slower but solves the key distribution problem. A hybrid approach — encrypt the file with AES, encrypt the AES key with RSA — is standard. Questions like this test whether you understand when each approach applies.
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: Replace dynamic SQL queries with parameterized prepared statements. — Option C is correct because parameterized prepared statements separate SQL logic from user input, ensuring that input is always treated as data, not executable code. This permanently prevents SQL injection by design, regardless of the input content, unlike input filtering or WAF rules which can be bypassed.
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.
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 development team wants to allow users to search orders by customer name and date range. Logs show the team currently concatenates the filter values into SQL strings. Which change best reduces SQL injection risk without removing the search feature?
medium- A.Escape apostrophes in the input before building the SQL statement.
- ✓ B.Use parameterized queries or prepared statements for the search filters.
- C.Disable database error messages so attackers cannot see query details.
- D.Place the application behind a VPN so only internal users can run searches.
Why B: Option B is correct because parameterized queries (also known as prepared statements) separate SQL logic from user data by sending the query structure and parameters independently to the database. This ensures that user-supplied filter values are always treated as data, never as executable SQL code, which completely prevents SQL injection even if the input contains malicious characters like apostrophes or SQL keywords.
Variation 2. A security analyst discovers that an organization's web application is vulnerable to SQL injection. The application uses a legacy database driver that does not support parameterized queries. Which of the following is the BEST mitigation to prevent this vulnerability?
medium- A.Implement a web application firewall (WAF) to filter malicious input.
- ✓ B.Update the database driver to a version that supports parameterized queries.
- C.Encode all user input using HTML encoding.
- D.Disable error messages that reveal database schema.
Why B: Option B is correct because the root cause of the SQL injection vulnerability is the legacy database driver that does not support parameterized queries. Updating the driver to a modern version that supports parameterized queries (also known as prepared statements) allows the application to separate SQL logic from user-supplied data, effectively preventing SQL injection at the database layer. This addresses the fundamental flaw rather than relying on external filtering or encoding.
Variation 3. A security analyst is reviewing web server logs from an e-commerce application. The logs show repeated requests containing URLs with appended strings such as: `' OR '1'='1' --` and `'; DROP TABLE Users; --`. The application returned HTTP 200 responses with unexpected data in several instances. Which type of attack is most likely being attempted?
medium- ✓ A.SQL injection
- B.LDAP injection
- C.Command injection
- D.Cross-site scripting (XSS)
Why A: The repeated requests contain classic SQL injection payloads, such as `' OR '1'='1' --` (used to bypass authentication or extract data) and `'; DROP TABLE Users; --` (used to delete database tables). The HTTP 200 responses with unexpected data confirm that the application is vulnerable to SQL injection, as the injected SQL code is being executed against the backend database. This attack targets the SQL database layer, not LDAP directories or operating system commands.
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.