CREST Practitioner Security Analyst (CPSA) Practice

Disable ads (and more) with a membership for a one time $2.99 payment

Master the CREST Practitioner Security Analyst Exam. Prepare with quizzes and comprehensive study guides that include tips and explanations. Excel in your certification journey!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What SQL injection example demonstrates the use of escape characters?

  1. ' OR '1' = '1' --

  2. ' OR '1' = '1' {'

  3. ' OR '1' = '1' /*

  4. ' OR '1' = '1' ;

The correct answer is: ' OR '1' = '1' --

The choice that best demonstrates the use of escape characters in SQL injection is the first example. In SQL, escape characters are utilized to alter the normal functioning of the SQL syntax, allowing an attacker to manipulate queries by injecting their own SQL statements. In this instance, the single quote preceding the logical operator OR serves as an escape character. This transforms the intended execution of the SQL statement by forcing the SQL engine to interpret the data values being entered, while also continuing to run the original query. The subsequent comparison '1' = '1' is always true, leading to either unauthorized access or the bypassing of authentication checks, a common goal in SQL injection attacks. The various symbols used in the other options, like the braces, comments, or semicolons, serve different purposes in SQL syntax but are not primarily utilized as escape characters in this context. These other examples do illustrate SQL injection techniques but lack the straightforward use of escape characters that the first choice effectively represents. Understanding this distinction is crucial for identifying and mitigating SQL injection vulnerabilities in systems.