Skip to content
SQL injection Write-up Intermediate

How a Forgotten “Export to Excel” Feature Exfiltrated a Bank�

A reporting export endpoint built its SQL sort clause by concatenating a user-supplied sort field, allowing boolean-based blind SQL injection. Because the analytics database user could read system catalog tables on a shared server, the attacker could reach stored session tokens, API tokens and hashed admin passwords.

T4nv1 Follow

Published on medium.com

If there is a golden rule in bug bounty hunting, it’s this: The most secure platforms in the world almost always leave their back door unlocked for the analytics team.

T4nv1, 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

Root cause

Likely the sort parameter was concatenated directly into the SQL ORDER BY clause instead of being checked against a fixed list of allowed column names.

Impact

The attacker could read decrypted session tokens, API tokens and hashed master passwords for the internal administrative portal, though the injection ran against a read-only replica rather than the main ledger.

What the attacker needed

An account on the banking portal; access to the analytics export feature

The fix

The reporting microservice was rewritten to strictly whitelist allowable sort parameters instead of passing raw strings to the database driver.

How it was found

  1. Intercept the POST request sent when generating the custom audit report.
  2. Change the sort_by value to a conditional expression that is always true and observe a normal report.
  3. Change the condition to one that is false and observe the exported rows sorted by a different column.
  4. Use the confirmed blind injection to query the database system catalog tables.

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.

When a website builds a database query by gluing your input straight into the command text, you can sometimes sneak in extra database logic. Here the sort option was glued in, so changing it changed how the database behaved, and the attacker could read data they should never see, including login tokens for administrators.

What is SQL injection?

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

More by T4nv1

View all

113 more disclosed reports, best first.

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.