Skip to content

CS Professional · Artificial Intelligence, Data Analytics and Cyber Security - Laws and Practice · Cyber Security

An attacker enters the string ' OR '1'='1 into the login field of a company's web portal and gains access without a valid password, because the application inserts user input directly into its database query. What is this attack called and what is its root cause?

This is SQL injection. The application places unvalidated user input directly into a database query, so the attacker's string alters the query logic and bypasses authentication. The fix is input validation and parameterised queries, not cookie encryption or DNS controls.

  1. ACross-site scripting, caused by weak encryption of cookies
  2. BSQL injection, caused by failure to validate or parameterise user inputCorrect
  3. CPharming, caused by corrupted DNS records
  4. DSession hijacking, caused by predictable session identifiers

Explanation

Injecting SQL fragments into input that is concatenated into a query is SQL injection. The root cause is improper input validation and not using parameterised queries. Cross-site scripting instead injects scripts that run in other users' browsers.

Did you get it right without looking?

One question tells you little. A timed set on Cyber Security shows your real accuracy, how long you take and where you lose marks.

More Cyber Security questions