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
What is the classic first probe for a suspected SQL injection in a string parameter?
- A single quote character
- A very long string of the letter A
- A null byte only
- 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.
Which observations after sending a single quote suggest SQL injection?
- A database syntax error message in the response
- An HTTP 500 status that the clean value does not produce
- An identical page and status to the clean value
- Results suddenly missing from the page
- 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.
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.
