🌐 Web Gauntlet
A detailed write-up of the Web challenge 'Web Gauntlet' from PicoCTF 2020 MiniCompetition
📊 Challenge Overview
Category Details Additional Info 🏆 Event PicoGym Event Link 🔰 Category Web 🌐 💎 Points 500 Out of 500 total ⭐ Difficulty 🟡 Medium Personal Rating: 2/10 👤 Author madStacks Profile 🎮 Solves (At the time of flag submission) 12.672 solve rate 📅 Date 21-02-2025 PicoGym 🦾 Solved By mH4ck3r0n3 Team:
📝 Challenge Information
Can you beat the filters? Log in as admin http://jupiter.challenges.picoctf.org:9683/ http://jupiter.challenges.picoctf.org:9683/filter.php
🎯 Challenge Files & Infrastructure
Provided Files
1
Files: None
🔍 Initial Analysis
First Steps
Initially, the website appears as follows:
This is the first challenge in the series of 3
Web Gauntlet
challenges (Web Gauntlet 2, Web Gauntlet 3). As we can see, this is anSQL Injection
, and based on the description, we can guess that it will be filtered. In fact, by visiting the route/filter.php
:We get
Round1: or
. Therefore, we won’t be able to useOR
in the first round. Now that we know the type of vulnerability, let’s proceed to exploitation.
🔬 Vulnerability Analysis
Potential Vulnerabilities
- SQL Injection
🎯 Solution Path
Exploitation Steps
Initial setup
This challenge will be solely focused on figuring out how to bypass the filters provided for the query. Let’s move on to the exploitation phase.
Exploitation
In the first query, the payload is very intuitive and there’s not much to explain. When trying to input
username:a
andpassword:a
, we are shown the query being executed:
1
SELECT * FROM users WHERE username='a' AND password='a'
(inserting screenshots only for the first round, as repeating them would be quite redundant). With this query, we can achieve an injection by inserting
username=admin'--
andpassword=a
, so the final query becomes:
1
SELECT * FROM users WHERE username='admin' -- ' AND password='a'
Here, everything after
--
will be commented out, and since we know that theadmin
username exists, the query will definitely find theadmin
user and return aTrue
statement, allowing us to proceed to the next level. The new level introduces additional filters:
1
Round2: or and like = --
This filter prevents us from using
OR
,AND
,LIKE
,=
and our beloved comment--
. However, in SQL, another type of comment is allowed: the multiline comment/*
. We can reuse the previous payload and replace the--
comment with the multiline comment, by sendingusername=admin'/*
andpassword=a
, we get the query:
1
SELECT * FROM users WHERE username='admin'/*' AND password='a'
which will be valid for the same reason explained for the previous payload. Upon accessing the new level, another layer of filters is added:
1
Round3: or and = like > < --
Now we can’t use
>
and<
. However, as we can see, our previous payload does not use either of these two characters. We can reuse it to pass level 3. Upon accessing level 4, another filter is added:
1
Round4: or and = like > < -- admin
Now we can’t use the word
admin
anymore. We can bypass this new filter with the concatenation operator||
, and by concatenating parts of the wordadmin
, it will be “split” and pass the filter. We can also always use the multiline comment to make the query valid:username=ad'||'min'/*
andpassword=a
, this will result in the query:
1
SELECT * FROM users WHERE username='ad'||'min'/*' AND password='a'
valid, and we will pass to level 5 where the last filter is introduced:
1
Round5: or and = like > < -- union admin
Now we can’t use
UNION
anymore. Since I hadn’t used it previously, and the filters haven’t changed except for the addition ofUNION
, I can reuse the same payload from level 4 to pass this final level. Once passed, I visit the/filter.php
route and get the flag.
Flag capture
🛠️ Exploitation Process
Approach
The automatic exploit uses a list of key-value
dictionaries
to make requests with the payloads for each level. Once all levels are passed, it performs a GET request to/filter.php
and extracts the flag using a regex.
🚩 Flag Capture
Flag
Proof of Execution
🔧 Tools Used
Tool Purpose Python Exploit
💡 Key Learnings
Skills Improved
- Binary Exploitation
- Reverse Engineering
- Web Exploitation
- Cryptography
- Forensics
- OSINT
- Miscellaneous
📚 References & Resources
Similar Challenges
Learning Resources
📊 Final Statistics
Metric | Value | Notes |
---|---|---|
Time to Solve | 00:04 | From start to flag |
Global Ranking (At the time of flag submission) | Challenge ranking | |
Points Earned | 500 | Team contribution |
Created: 21-02-2025 • Last Modified: 21-02-2025 *Author: mH4ck3r0n3 • Team: *