Lookup
Test your enumeration skills on this boot-to-root machine.
There is a login page that is supposed to be bypassed.
I ran a TCP scan via NMAP, but the results obtained were of no use.
I also did subdomain and directory enumeration, but neither of them had anything useful.
Ran individual username and password fuzzing scans via ffuf on the login page and found the following creds: Username:
josePassword:password123Upon logging in, there was a redirection to
files.lookup.thmwhich was a file manager system.elFinder 2.1.47was running on the system.I looked for its exploit online on ExploitDB and even found one https://www.exploit-db.com/exploits/46481, but implementing it was causing some difficulty, hence I went with Metasploit, from where I used a command injection-based payload to get a meterpreter into the target as
www-data.From there, I tried to look for a scope for privilege escalation. I couldn't run sudo, no binaries were exploitable, and I couldn't read the password hashes. It was all restricted.
I looked for SUID bins with
find / -perms -u=s -type=f 2>/dev/nulland found a binary that stood outuser/sbin/pwm.I ran it and found that it was executing some sort of
idcommand as follows
Cherry on top, it had root privileges. So I could do something with this file.
I thought of doing escalation via
pathand added thetmpdirectory to the path as followsexport PATH=$PATH:/tmpThis way the
idcommand would run our custom script stored in thetmpfolder.I tried to get the passwords on the system via the following custom script.
#!/bin/bash
echo 'echo "uid=33(think) gid=33(think) groups=33(think)'I also saw in the home directory that think was a user.
14. I obtained a huge list of passwords upon running the custom script.
15. I used Hydra later to brute-force credentials via SSH for think user and used the passwords I had obtained as a wordlist passlist.txt. The following command was used.
hydra -l think -p passlist.txt 10.10.30.29 ssh
16. The password was obtained, and I connected via SSH as think .
17. I ran sudo -l and found the following binary.

18. GTFO bins fortunately had a solution for /usr/bin/look
LFILE=file_to_read
sudo look '' "$LFILE"Now, I could read any file I wanted from the system. So to attain root privileges, I used the following command to get the SSH key for root.
sudo look '' /root/.ssh/id_rsa20. I got the following output.

Now, using the key for root, I could log in via SSH.
ssh root@10.10.30.29 -i id_rsa
Bingo, the privileges were escalated to root, and the root flag was obtained.
Last updated
