Exploiting an SQL injection with WAF bypass
An SQL injection in the idEntity parameter was blocked by a WAF, but the same injection was possible via the idEntitySelected cookie, which the WAF did not inspect. An attacker could use this to extract database contents.
Published on vaadata.com
Burp’s scanner has detected a potential SQL injection on one of our target endpoints. According to it, the idEntity parameter of this endpoint is vulnerable.
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 database contents, including database names and potentially other data, because the WAF did not block injection through the cookie.
What the attacker needed
Access to the endpoint; ability to set cookies
How it was found
- Confirm the SQL injection manually by sending boolean conditions in the idEntity parameter and observing different responses.
- Run sqlmap with a proxy to see that the WAF returns an empty response for attack payloads.
- Change the user-agent to avoid detection and confirm the injection with sqlmap.
- Discover the idEntitySelected cookie using Burp ParamMiner.
- Test the cookie manually with a time-based payload and see the delay.
- Run sqlmap against the cookie parameter to exploit the injection and extract data.
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, a firewall blocked malicious requests in the URL parameter, but the same input was accepted through a cookie, which the firewall did not check. This allowed the attacker to read data from the database.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.