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.
Published on marxchryz.medium.com
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.
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
- Create an account on the subdomain and log in.
- Use the search and sort feature, noting the 'order' parameter in the URL.
- Add a single quote to the 'order' value and observe a 500 error.
- Try UNION and error-based injection but find they do not work.
- Use MySQL version comment bruteforce to determine the database version.
- 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.