Skip to content
BENIBIX Learn

Injection Attack

Development🔐 SecurityAttacks

Also known as Injection Flaw, Code Injection

Hiding commands in what a user types. The program then runs them.

Think of it like

Think of it like slipping a line into a recipe. The cook follows it as if it were part of the dish.

Example

A search box passes Emma's text straight into a database query. An attacker types a piece of SQL instead of a word, and the database runs it.

Why it matters

Injection can leak, change or wipe whole databases. It is number five on the 2025 OWASP Top 10.

Definition

An injection attack sneaks commands into data that a program trusts. The program builds a command by gluing user text into it. If that text holds commands of its own, the program runs them too. SQL injection does this to a database. Command injection does it to the system shell. The fix is to keep data and commands apart, so text is only ever text.
Wherever the input is glued in, the lit-up part runs as a command.

Common mistake

Trying to block bad words in the input. Attackers find new spellings, so keep data apart from commands instead.

Key takeaways

  1. 1
    Data becomes code. Input gets run as a command.
  2. 2
    Many targets. Databases, shells, pages and more.
  3. 3
    Keep them apart. Send data apart from commands.