Bitzu

CPSA ยท Web testing techniques

Detecting SQL injection in parameters

Error-based and behavioural indicators of SQL injection in parameters.

Key points

  • Probe each parameter (query string, body, cookie, header) with a single quote and compare behaviour.
  • Error-based signs: a database error, a 500 response, broken page layout.
  • Boolean: different results for AND 1=1 versus AND 1=2.
  • Arithmetic: id=3-1 returns the same as id=2.
  • Timing: a change in response time.
  • Confirm with a pair of inputs, not a single odd response.

Practice questions

Single choice

What is the classic first probe for a suspected SQL injection in a string parameter?

  1. A single quote character
  2. A very long string of the letter A
  3. A null byte only
  4. An HTML comment opener
Show answer

Answer: A. A single quote character

A single quote unbalances the string literal in the query and often triggers a syntax error. The other options are not SQL string delimiters.

Select all that apply

Which observations after sending a single quote suggest SQL injection?

  1. A database syntax error message in the response
  2. An HTTP 500 status that the clean value does not produce
  3. An identical page and status to the clean value
  4. Results suddenly missing from the page
  5. A TLS handshake failure
Show answer

Answer: A. A database syntax error message in the response, B. An HTTP 500 status that the clean value does not produce, D. Results suddenly missing from the page

A database syntax error, a 500 status and a missing result set all point to broken query syntax. An unchanged identical page does not, and a TLS handshake error is unrelated.

True or false

If a parameter shows no database error after a single quote, it cannot be vulnerable to SQL injection.

Show answer

Answer: False

False. Many applications hide errors; the flaw may still show through true/false differences or timing (blind injection).

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More CPSA topics in this module