Skip to content

Injection: SQL, XSS and the one idea behind both

Security, from absolute zero

Reading 1 of 5

One idea, many names

Injection happens when input from a user gets treated as an instruction rather than as data. Every injection vulnerability is that sentence, applied to a different language.

Into a database query it is SQL injection. Into a web page it is cross-site scripting. Into a system command it is command injection. Same mistake, different destination.

What you meant

  • Treat this as a search term
  • Show this comment as text
  • Use this as a filename

What the computer did

  • Ran it as part of the query
  • Executed it as a script
  • Followed it out of the folder

Every injection bug is one sentence: data was treated as instructions.

Injection is a computer mistaking data for instructions.