Library
Reconnaissance
Initial nmap scan to find open ports , using the flag "treat all hosts as alive" (-Pn)
Detailed Nmap Scan :
Command Breakdown:
(-sV): Service version
(-sC): Default nmap scripts
(-p): Specifying ports 22,80
(-oN nmap): Saving it into a file called nmap
Enumeration
Lets visit the webpage
Looking through the website we have a username meliodas
.
Lets look at robots.txt
as the nmap told us that there is a disallowed entry.
And there is nothing, lets run gobuster
to find hidden directories as there is nothing else on the main page to enumerate.
Nothing interesting pops up, so lets run hydra to brute force ssh with the username meliodas.
Exploitation
We have the password, lets login through ssh
We can read the user.txt
file
Privilege Escalation
We have a file called bak.py
, lets read it and look at the permissions of the file
Its owned by root! We can also run this file as root
Lets change the contents of the file to get a shell as root, we cannot change the contents of the file, so lets remove the file and create a new file with the same name and our own content.
First delete the file with this command
Now we can echo the script into the file
Now lets run the file
We are now root, we can read the root.txt file
Last updated