Skip to content
SQL injection Write-up Beginner

When a Report Generator Lets You Write the Query (in Production)

A report generation endpoint in a legacy CRM accepted a full raw SQL query supplied by the client through a URL parameter, and the endpoint required no authentication. An attacker could run arbitrary SQL against the backend database, which ran as the SQL Server system administrator account.

medium.com

Published on medium.com

Most people in cybersecurity know exactly what happens when raw SQL queries are exposed to user-controlled input. We’ve all seen it in labs, CTF challenges, and intentionally vulnerable applications: the classic “user input gets concatenated into a query” scenario.

Jobson, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Impact

An unauthenticated attacker could execute arbitrary SQL and read environmental details, and the database session ran as the system administrator account, so the exposure could extend well beyond the report data.

What the attacker needed

No authentication required; network access to the endpoint

How it was found

  1. Open the report generation feature in the legacy CRM and select filters.
  2. Inspect the network traffic and notice a raw SQL query is sent in a URL parameter.
  3. Send minimal, non-intrusive payloads to retrieve database version and server name.
  4. Download the generated report and find the payload output in the last row.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

The website let the browser send the whole database question (the SQL query) instead of just filter choices. The server ran whatever question it received, so anyone could ask the database for extra information. The database connection also had very high privileges, and no login was needed to reach the page.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.