Skip to content
SQL injection Write-up Intermediate

Bypassing Like a Pro: How I Fooled the WAF and Made It Pay

The search API endpoint was vulnerable to SQL injection, and the web application firewall (WAF) could be bypassed using encoded characters and inline comments. An attacker could extract database version, user, and sensitive user data including usernames, password hashes, and emails.

medium.com

Published on medium.com

Free Link🎈

Iski, 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 the application did not properly sanitise user input and used dynamic SQL queries, allowing SQL injection despite the WAF.

Impact

An attacker could extract sensitive user data including usernames, password hashes, and emails, leading to full PII exposure.

What the attacker needed

Access to the API endpoint; no authentication mentioned

The fix

The application should use parameterized queries and sanitise inputs at the backend, rather than relying solely on a WAF.

How it was found

  1. Send a simple SQL injection payload to the search endpoint and observe a 403 WAF block.
  2. Try encoded characters and mixed-case keywords to bypass the WAF.
  3. Use inline comments and encoded characters to craft a working UNION-based SQL injection.
  4. Extract database version and user via the search endpoint.
  5. Extract usernames, password hashes, and emails via the user endpoint.

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 WAF is a security tool that tries to block attacks like SQL injection, where malicious code is inserted into database queries. Here, the attacker found ways to write the attack so the WAF did not recognise it, and then read private information 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.

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.