Bitzu

CPSA ยท Web application assessment: injection, sessions and code

Injection attack classes

SQL, LDAP, code and XML injection: root cause and consequences.

Key points

  • Injection: untrusted input in a command or query is parsed as syntax.
  • SQL injection: read or change data, bypass login, sometimes reach the DB host.
  • LDAP injection: altered filters bypass login or enumerate entries.
  • Code injection: input run as app code with its privileges.
  • XML injection: markup alters structure or abuses the parser.
  • Fix: parameterised interfaces, allow-lists, least privilege.

Source: https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html

Practice questions

Single choice

What is the root cause of a SQL injection vulnerability?

  1. User input is concatenated into the query text
  2. The database port is reachable from the internet
  3. Passwords are stored with a fast hash
  4. The operating system is missing patches
Show answer

Answer: A. User input is concatenated into the query text

Concatenating untrusted input into the query text lets the database parse it as SQL. A missing firewall, weak password hashing or an unpatched OS are different problems.

Select all that apply

Which consequences can a SQL injection flaw in a login or search form lead to?

  1. Reading rows belonging to other users
  2. Bypassing the login check
  3. Modifying or deleting stored records
  4. Running script in other visitors' browsers by itself
  5. Decrypting TLS traffic of other clients
Show answer

Answer: A. Reading rows belonging to other users, B. Bypassing the login check, C. Modifying or deleting stored records

The injected SQL runs with the application's database account, so data can be read, authentication bypassed and records altered. Running script in other users' browsers is XSS, and SQL injection does not break TLS.

True or false

True or false: escaping single quotes in user input is the most reliable defence against SQL injection.

Show answer

Answer: False

False. Escaping is database-specific and fragile; parameterised queries are the primary defence because they keep code and data separate.

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