Skip to content
SQL injection Write-up Intermediate

Two SQLi vulnerabilities on Reddit in February 2024

Two Reddit scoring endpoints, one GET and one POST, built SQL queries from user-supplied parameters without parameterisation. An attacker could inject time-based blind SQL to confirm the flaw and infer database contents through response delays.

medium.com

Published on medium.com

Hi, I’m Nima Afsharian (neemaaf), a security researcher and bug bounty hunter from Iran with a strong focus on web application security. At the time of this finding, I was 18 years old and actively hunting high-severity vulnerabilities on major platforms.

Neemaaf, 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 user-controlled input from the team and uid parameters was concatenated into SQL queries instead of being passed as bound parameters.

Impact

An attacker could use timing to extract information from the scoring database, though the text does not show any data actually being read.

What the attacker needed

Reachable scoring endpoints; WAF bypass with nested parentheses

The fix

The endpoints should be fixed by using parameterised queries so user input is never treated as SQL syntax.

How it was found

  1. Enumerate subdomains and manually list endpoints on a newly tested Reddit feature.
  2. Identify a GET scoring endpoint taking a team parameter and a POST scoring endpoint taking uid and team.
  3. Send quote characters and observe no errors, suggesting the backend catches exceptions.
  4. Send a time-based payload with nested parentheses and measure a consistent delay to confirm injection on both endpoints.

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 database query is a question the website asks its database, and the site builds that question partly from what you type. If it pastes your text straight into the question, you can add extra instructions of your own. Here the researcher could not see any data come back, so they asked the database to pause for a few seconds when a guess was right, and the delay told them the answer.

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.