$ nmap -p- --min-rate 3000 -Pn 192.168.157.202
Starting Nmap 7.93 ( https://nmap.org ) at 2023-07-14 11:18 +08
Nmap scan report for 192.168.157.202
Host is up (0.17s latency).
Not shown: 65533 closed tcp ports (conn-refused)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
We can proxy traffic through Burpsuite.
Web Enum -> XPath Injection
The website is for a car repair service:
There's an employee portal and a register page. When I try to register a user and access the portal, we are denied access. I tried to brute force the admin credentials, but they don't work.
At the bottom of the page, we can find an email:
I tried to register an administrator user with this email, and it worked in showing us the Employee Portal.
If we submit a query, we are returned information in this manner:
I tried to append a ' character to the query, and received an XML error:
We can try XPath injection since it seems to load xpath(). I tested all forms of XPath Injection and tried to dump passwords, and eventually this payload worked:
I searched for SUID binaries and the first result stood out:
bob@wheels:~$ find / -perm -u=s -type f 2>/dev/null
/opt/get-list
bob@wheels:~$ file /opt/get-list
/opt/get-list: setuid, setgid ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a037b8d92b88ad94e965feeeddd13c03f924f0a7, for GNU/Linux 3.2.0, not stripped
bob@wheels:~$ /opt/get-list
Which List do you want to open? [customers/employees]: employees
Opening File....
bob
alice
john
dan
alex
selene
It uses seems that our string is directly passed into a cat command. There's also a check for special characters before executing. This doesn't protect against subshells using $(), and it only checks for whether customers or employees are substrings within the string we submit.