Home / Learn Secure SQL / Classic (In-Band) SQL Injection, Explained

Classic (In-Band) SQL Injection, Explained

The most direct form: the result comes back in the same response.

The gistThe most direct form: the result comes back in the same response.

The idea, explained simply

In-band injection, at a glanceunvalidated inputreaches query…query structurechanges in an…result differs fromwhat the legitimate…the difference isvisible directly in…
In-band injection, at a glance

The basic idea

In-band SQL injection is the category where the altered query's result is visible directly in the application's normal response — for example, extra rows appearing in a list, or a login succeeding when it should not. It is called "in-band" because the attacker observes the effect through the same channel the application normally uses to answer requests.

Why this comes up

Understanding this category first builds the mental model for every other variant covered in this lesson group: a boundary meant to separate code from data was not enforced, and the consequence surfaces somewhere the attacker can directly observe.

The mechanics

When reviewing a reported injection finding, first ask whether the impact was observed in-band (in the response itself) or required one of the indirect techniques covered in the following lessons, since that shapes how severe and how easy to detect the issue is.

Where it is used

  • Web application code review
  • Backend development
  • Database administration
The only shape that matters: value separated from structure
// This shape is what closes every variant covered in this lesson group,
// regardless of how the altered structure would have been triggered:
db.execute("SELECT * FROM accounts WHERE username = ?", [username]);
// The placeholder and the value travel to the database separately.
// Whatever the value contains, it is never parsed as part of the command.
TermMeaning
In-bandThe effect is observable through the application's normal response channel
Out-of-bandThe effect is observed through a separate channel (covered later in this group)
BlindNo direct result is visible at all; only an indirect signal (covered later in this group)

Quick check

1. "In-band" SQL injection means the effect is observed...