Study. uk . com
  1. Home
  2. All questions
  3. Question 140

CompTIA Security+ study material · question 140 of 611

Which technique is the primary defence against SQL injection, and why does it work?

  1. Parameterised queries, because the database learns the query structure before it sees the data
  2. A web application firewall, because injection patterns are blocked
  3. Escaping input, because dangerous characters are neutralised
  4. Least privilege, because the account cannot read other tables
Show the answer

Answer: A. Parameterised queries, because the database learns the query structure before it sees the data

With the structure fixed in advance, supplied values can never change the query's meaning. The others reduce impact or add depth.

Source: OWASP SQL Injection Prevention Cheat Sheet (OWASP) — OWASP SQL Injection Prevention Cheat Sheet › Defense Option 1

Challenge yourself on this topic → Study as cards