Skip to content
SQL injection Write-up Intermediate

My Story

A search and sort feature on a referrals page was vulnerable to SQL injection through the 'order' parameter. An attacker could use time-based blind SQL injection to extract data from the database.

Marx Chryz Follow

Published on marxchryz.medium.com

Bounty$3,500total stated by author View original

Hello everyone, I am Marx Chryz and I am new to bug bounty hunting even though I do web penetration testing for more than a year.

Marx Chryz Del Mundo, on marxchryz.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 'order' parameter was concatenated directly into an SQL ORDER BY clause without parameterisation or validation.

Impact

An attacker could extract arbitrary data from the database, though the report only demonstrates a time delay and does not show actual data exfiltration.

What the attacker needed

A free account on the subdomain; victim not needed (attacker directly exploits)

The fix

The vulnerability was fixed according to the timeline.

How it was found

  1. Create an account on the subdomain and log in.
  2. Use the search and sort feature, noting the 'order' parameter in the URL.
  3. Add a single quote to the 'order' value and observe a 500 error.
  4. Try UNION and error-based injection but find they do not work.
  5. Use MySQL version comment bruteforce to determine the database version.
  6. Use a time-based payload with a subquery sleep to confirm injection.

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.

SQL injection is when user input is inserted into a database query without proper handling, letting an attacker change the query's meaning. Here, the sort parameter was placed directly into the database command, so adding a quote caused an error. The attacker then used delays to confirm they could run their own database commands.

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 Marx Chryz

View all

2 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.