Skip to main content
XsiSec.com
HomeReposBlogProjectsPortfolio
© 2026 XsiSec.com
Security rules |security.txt
Updated 2026-08-15 · v1.0.0+2026-08-14.82f92cb · 82f92cb
← Back to overview
Security article

SQL injection with filter bypass via XML encoding

Used UNION-based SQL injection to bypass a WAF, extract usernames and passwords from the users table, and retrieve the administrator’s credentials. Successfully logged in after obfuscating payloads to evade filters.

2025-11-212 tags
Tags

This lab contains a SQL injection vulnerability in the stock check feature.
Because the query results are reflected directly in the application’s response, we can use a UNION-based SQL injection attack to retrieve arbitrary data from other tables.

The target database contains a table named users, with the standard fields:

  • username
  • password

The goal is simple:

  1. Exploit the SQLi in the stock check function
  2. Extract the administrator credentials
  3. Log in to the admin account to solve the lab

🔍 Step 1 — Understanding the WAF Behavior

The moment I submitted a standard UNION payload, the app instantly blocked it:

WAF Trigger

This tells us:

  • The WAF is actively scanning the input
  • Classic keywords like UNION SELECT, --, /*, or even certain symbols will immediately trigger the block

🌀 Step 2 — Bypassing the WAF With Obfuscation

To dodge the WAF, I used HeckVector, which encodes SQL keywords using HTML entities or mixed case variations. This transforms the payload into something that still evaluates correctly but doesn’t look dangerous to the firewall.

Encoded Attempt

The payload passed the WAF, but the backend responded with:

text
null

Meaning:

  • The query executed
  • But the returned columns/data did not match what the application prints

🏗️ Step 3 — Matching Column Count & Data Types

Payloads like:

sql
' UNION SELECT NULL, NULL--

still returned:

text
null

So the column count was correct — but NULL does not display, so we need actual text.


🎯 Step 4 — Extracting Usernames & Passwords

Most labs use a users table containing username and password.
So we retrieve them:

sql
' UNION SELECT username, password FROM users--

Or a cleaner format:

sql
' UNION SELECT username || ':' || password, NULL FROM users--

Result:

Credentials


✅ Step 5 — Log In as Administrator

With the password recovered, simply log in:

Solved

Lab solved.


🧩 Summary

StepActionResult
1Triggered WAFLearned what gets blocked
2Used encoded payloadsBypassed the WAF
3Identified correct column countBackend accepted UNION
4Extracted username + passwordGot admin credentials
5Logged inLab cleared

Navigate

In this post

  1. 01🔍 Step 1 — Understanding the WAF Behavior
  2. 02🌀 Step 2 — Bypassing the WAF With Obfuscation
  3. 03🏗️ Step 3 — Matching Column Count & Data Types
  4. 04🎯 Step 4 — Extracting Usernames & Passwords
  5. 05✅ Step 5 — Log In as Administrator
  6. 06🧩 Summary
Search
Explore

Popular tags

Browse all 30 tags

Comments

0 comments

No comments yet — be the first to comment.