nerdexam
GIAC

GCIH · Question #48

Which of the following characters will you use to check whether an application is vulnerable to an SQL injection attack?

The correct answer is C. Single quote ('). The single quote is the canonical character used to test for SQL injection because it terminates string literals in SQL syntax and can expose database parsing errors.

Web Application Attacks & Post-Exploitation

Question

Which of the following characters will you use to check whether an application is vulnerable to an SQL injection attack?

Options

  • ADash (-)
  • BDouble quote (")
  • CSingle quote (')
  • DSemi colon (;)

How the community answered

(34 responses)
  • A
    3% (1)
  • B
    6% (2)
  • C
    88% (30)
  • D
    3% (1)

Why each option

The single quote is the canonical character used to test for SQL injection because it terminates string literals in SQL syntax and can expose database parsing errors.

ADash (-)

A dash alone does not break SQL string literals and is not a recognized standard first-step test character for SQL injection vulnerability.

BDouble quote (")

A double quote is used for identifier quoting in some SQL dialects but is not the universally recognized initial probe character for SQL injection testing.

CSingle quote (')Correct

Inserting a single quote into an input field attempts to prematurely close a SQL string literal, causing a syntax error if the input is not sanitized or parameterized. A database error response confirms that raw user input is being concatenated directly into a SQL query, which is the defining indicator of SQL injection vulnerability. It is the most widely recognized and standard first-step probe for SQL injection.

DSemi colon (;)

A semicolon can be used to stack SQL statements in certain databases but does not directly reveal injection vulnerability on its own and is not the standard initial test character.

Concept tested: SQL injection detection using single quote character

Source: https://owasp.org/www-community/attacks/SQL_Injection

Topics

#SQL injection#single quote#injection testing#input validation

Community Discussion

No community discussion yet for this question.

Full GCIH Practice