181 words
1 minute
Lesson Learned Writeup - TryHackMe

This room teaches a valuable lesson: attempting SQL injection payloads without understanding their impact can lead to unintended consequences.

Start this room by hitting the “Deploy” button on the right. Once deployed, you’ll get the vulnerable machine’s IP.

Task 1: Find the Flag#

The challenge mentions there are no rabbit holes or hidden files—just a login page and a flag. Target: http://MACHINE_IP/

Navigate to the login page:

page

I sent the login request to Burp Suite’s Intruder and tested various SQL injection payloads. Examples:

Intruder

After running the attack, visiting the login page again returned a message indicating the flag had been deleted. This was caused by a destructive injection, likely using something like OR 1=1, which returns multiple rows and could trigger unwanted behavior in the backend logic (e.g., deleting data). I terminated and redeployed the machine.

lesson_learned

The lesson: OR 1=1 returns all rows, but the login logic expects only one. Instead, a safer injection that returns a single row is required.

Working SQL Injection Payload:

' UNION SELECT null-- -

Use any password.

sql_injection

On successful login, the flag page appears and reiterates the risk of using unsafe injections in update/delete contexts.

flag

Flag: THM{a*****************************e}

Lesson Learned Writeup - TryHackMe
https://blog.hanzalaghayasabbasi.com/posts/lesson-learned/
Author
Hanzala Ghayas Abbasi
Published at
2023-08-30
License
CC BY-NC-SA 4.0