Bitzu

312-50 ยท SQL injection

SQL injection concepts

How unsanitised input alters a query, impact, where injection points appear, and error messages as a signal.

Key points

  • SQL injection: untrusted input concatenated into a query, so the database parses attacker text as SQL code, not data.
  • Injection points: form fields, URL parameters, cookies, headers.
  • Impact: reading data (confidentiality), changing records (integrity), deleting tables (availability), bypassing login.
  • Verbose database errors help confirm the flaw and fingerprint the DBMS.

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. Weak passwords on database accounts
  2. User input is mixed into the SQL text instead of being bound as data
  3. The database port is reachable from the internet
  4. The web server runs an outdated TLS version
Show answer

Answer: B. User input is mixed into the SQL text instead of being bound as data

Concatenating untrusted input into the query lets data become code. Weak passwords or open ports are separate problems.

Select all that apply

Which inputs can be SQL injection points?

  1. A search form field
  2. A cookie value used to look up a session row
  3. A User-Agent header written to a log table
  4. A static PNG file served by the web server
  5. The page's CSS colour scheme
Show answer

Answer: A. A search form field, B. A cookie value used to look up a session row, C. A User-Agent header written to a log table

Anything the application places into a query is a candidate: form fields, cookies and logged headers. A static image file is never built into a query.

True or false

Serving a site over HTTPS prevents SQL injection.

Show answer

Answer: False

False. HTTPS only protects data in transit; the malicious input still arrives decrypted at the application and reaches the query.

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 312-50 topics in this module