Bug Bounty – SQLi in the Wild

Today’s post we are going to go through how during my Bug Bounty time I was able to find a classic SQLi in the wild. YES a SQLi in the wild. Some people think this is a classic web application vulnerability and should be dead and somehow I was thinking something similar. Nevertheless, here we are finding a SQLi in the wild.

We will go through my workflow of recon and how I was able to find the target, also, I will leave a link to my GitHub where you can find the tool I have used to automate my recon workflow.

1. Context

We will start with some context about this whole mess. So time to time I like to get into Bug Bounty to see if I am capable of finding vulnerabilities in the wild and get a burst of confidence to keep going with this great world called “Cyber Security”.

There I was in front of my laptop with everything set up, my tasks done, checklists ready, tools ready and the learning of the day was done as well. On that moment staring on at the laptop thinking “Too much knowledge for what?”. Then, I thought let’s do some Bug Bounty, I went directly to my HackerOne account and signed-in.

The next step was somehow endless, I was scrolling through too many possible objectives. However, I was able to select my target for the session. For this occasion I chose a big e-commerce because I wanted to focus on:

  • IDOR
  • Authentication Vulnerabilities
  • oAuth vulnerabilities
  • SSRF

Despite focusing on those vulnerabilities I would not discard any other low hanging fruits of course. Once I had the target ready and the type of vulnerabilities I wanted to test I was ready to go.

This leads to describe the next step my recon workflow.

2. Reconnaissance Workflow

On this particular target, the e-commerce was split by geographical organizational structure (territories like EMEA, APAC, and AMER). Basically, the scope was huge, meaning I needed to automate the recon process to be able to discard fortified targets and focus on the ones with possible issues.

For that reason I came up with the following script/tool:

https://github.com/hardsoftsecurity/BBRecon

BBRecon is a single-script recon framework that takes a bug bounty target from “just a domain” to “organized attack surface” without you babysitting seven different tools by hand. Point it at a domain (or a scope file of many), and it runs the whole recon phase as one pipeline: finding subdomains, checking which ones are alive, crawling them for endpoints and JS files, pulling secrets out of that JS, bucketing parameters by vulnerability class (SSRF, IDOR, XSS, path traversal, open redirect), screenshotting everything, and finally kicking off a Nuclei scan — all dropped into a clean, predictable folder structure per domain so you’re not hunting through a dozen tools’ output formats to figure out what you actually found.

The point isn’t a new technique — it’s removing the manual stitching between tools that eats the first hour of every engagement, so you get straight to triaging real findings.

                      domain / scope file
                             │
                             ▼
                   ┌──────────────────┐
                   │ 1. Subdomain enum │   (subfinder)
                   └─────────┬────────┘
                             ▼
                   ┌──────────────────┐
                   │ 2. HTTP probing   │   which hosts are alive?
                   └─────────┬────────┘
                             ▼
                   ┌──────────────────┐
                   │ 3. Endpoint crawl │   URLs + JS files
                   └─────────┬────────┘
                             ▼
                   ┌──────────────────┐
                   │ 4. Secret extract │   keys/tokens in JS
                   └─────────┬────────┘
                             ▼
                   ┌──────────────────┐
                   │ 5. Param classify │───▶ SSRF / IDOR / XSS /
                   └─────────┬────────┘     Traversal / OpenRedirect
                             ▼
                   ┌──────────────────┐
                   │ 6. Screenshots    │   visual recon gallery
                   └─────────┬────────┘
                             ▼
                   ┌──────────────────┐
                   │ 7. Nuclei scan    │   known-vuln sweep
                   └─────────┬────────┘
                             ▼
                   organized output per domain,
                   ready to triage

3. Hunting

TL;DR

I was not able to find the SQLi on the intended targe but I found it on their provider 😈

There I was digging into different platforms, singing up, playing a lot but in the end I could not find really something. Then I checked the history of the Bug Bounty program to verify when was the last time the program was updated and when was the last time they paid something. Some time had passed…

Somehow I kept digging on it and interestingly on one of the separated geographical e-commerce I decided to perform a reverse nslookup:

Checking the server’s IP where the e-commerce was hosted to verify which other domains/websites are pointing to the same IP/Server.

One domain kept my attention because it did not have any relation with the e-commerce at all… mmm interesting!

I will strictly maintain the company’s anonymity and protect its reputation. From now on I will refer to it as “company.test”

Following my curiosity I visited the website “company.test”. To my surprise the website was running on PHP:

Before making any movement I decided to investigate if the provider had any kind of Bug Bounty program or Vulnerability Disclosure program. So I reached out to them via email. Their answer was something like:

We do not have a VDP or BBP. However, if you find something we will be happy to accept it and it could lead to a compensation.

Once I got the information from the company, I started to play around the new website. Then I found a PHP login form and my brain switched immediately to SQLi and I tried a basic SQLi payload. To my surprise I got the SQL error verifying that the application was vulnerable to SQL Injection:

admin' AND 1=1#

However, I tried different basic payloads to enumerate the database in order to confirm the vulnerability and I was not able to do it, so I decided to use a dictionary from SecLists and BurpSuite Intruder to see which other payloads could trigger the SQL error:

I got a different error message using the following payload:

- '=0--+

This revealed the query was using parenthesis and the statement “as”. Putting all the pieces together I was able to identify how probably the query was running on the backend:

$sql = "SELECT (SELECT column FROM users 
        WHERE UserName=('" . $user . "') 
        AND Password=('" . $password . "')) as user";

At this point I was able to know how to break the query, however, I struggled a little bit to find the correct payload to extract information from the database. Playing around a little bit, checking different checklists and using AI, I came up with the following Error-Based SQL Injection payload:

') AND EXTRACTVALUE(1,CONCAT(0x7e,version())))#

It works by intentionally triggering a database error that forces the server to include the result of your injected query in this case the SQL Server Version inside the error message itself:

There is no need on going further and expose other payloads used to show the scope of the SQLi included on my report but WAIT! Where is the happy ending?

Once I did the report I was rewarded with 300$. Remember I did this for fun and not for the money. I know if this was reported on an official bug bounty program probably the reward would be higher but meh I do not care about that, in the end I was capable of finding a cool vulnerability as SQLi in the wild and I helped to fix the issue.

4. Conclusion

To me the most important part here is, sometimes the Bug Bounty Programs are really fortified, not updated and they are very difficult but we need to go further and check the surroundings. The companies have several assets exposed and sometimes they do not even know about their existence, this last statement applies as well to pentesting. There is where we hunt and probably find cool vulnerabilities to exploit as I showed on this post.

Also, having an automated workflow is very important to be able to discard the noise, so you can focus entirely on the real deal and not just losing time on the hardened systems.


Find more interesting post on:

Blog – Hardsoft Security

or subscribe to our newsletter to receive all the lastest posts:

Newsletter – Hardsoft Security

Deja un comentario

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.