Blind SQL Injection in FireShare, Found in an API sort Parameter
The sort parameter of the public videos API was inserted directly into an ORDER BY clause, allowing time-based blind SQL injection. An attacker could infer database contents character by character, including usernames such as an admin account.
medium.com
Published on medium.com
While exploring the /api/videos/public endpoint, I noticed the sort parameter was behaving oddly. Instead of rejecting unexpected values, the backend seemed to pass whatever I gave it directly into the query.
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 attacker could extract usernames, emails and possibly password hashes, and confirm high-privilege accounts such as admin.
What the attacker needed
Access to the public videos API
The fix
The sort parameter should be restricted to a whitelist of allowed column names and passed through parameterised or ORM-safe ordering.
How it was found
- Send a request to the public videos endpoint with an empty sort parameter.
- Inject a conditional expression that causes a delay when a guessed character matches.
- Measure the response time to confirm the guess.
- Repeat character by character to reconstruct the first username.
- Confirm the full username with a direct string comparison.
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.
A website often lets you sort a list, for example by name or date. Here the server took whatever text you put in the sort setting and pasted it straight into a database command. By making the database pause when a guess was right, the tester could slowly work out secret values like usernames.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.