Description
You've been hired by a shadowy group of pentesters who love a good puzzle. Sloppy code and legacy hashing practices left a tiny, perfect doorway for an attacker. Slip through that doorway, act as a legit user and retrieve the secret flag.
Setup
Launch the challenge instance and open the web application.
Install sqlmap if not already available: pip install sqlmap
Solution
- Step 1Find the injectable parameterExplore the web app for search or filter functionality. The search endpoint's query parameter is vulnerable to SQL injection.
- Step 2Run sqlmap to dump the databaseUse sqlmap to automatically identify the injection point and extract the users table, which contains hashed passwords.sqlmap -u 'http://HOST:PORT/search?q=test' --batch --tablessqlmap -u 'http://HOST:PORT/search?q=test' --batch -T users --dump
- Step 3Crack the MD5 hashThe dumped password for the admin user is an MD5 hash. Crack it using CrackStation or hashcat.# Online: paste hash at crackstation.nethashcat -m 0 hash.txt rockyou.txt
- Step 4Log in as admin and read the flagUse the cracked password to log into the admin account. The flag is displayed on the admin dashboard.
Flag
picoCTF{sql_m4p_m4st3r_...}
The flag is on the admin dashboard, accessible after cracking the admin's MD5 password found via sqlmap.