HTB Postman - 10.10.10.160: Part 2 - Get User
HTB Postman - 10.10.10.160: Part 2 - Get User
160
Part 1 - Scanning
nmap -sV -sC -T5 -v -p- 10.10.10.160
PORT STATE SERVICE VERSION
22 / tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 46: 83: 4f: f1: 38: 61: c0: 1c: 74: cb: b5: d1: 4a: 68: 4d: 77 (RSA)
| 256 2d: 8d: 27: d2: df: 15: 1a: 31: 53: 05: fb: ff: f0: 62: 26: 89 (ECDSA)
| _ 256 ca: 7c: 82: aa: 5a: d3: 72: ca: 8b: 8a: 38: 3a: 80: 41: a0: 45 (ED25519)
80 / tcp open http Apache httpd 2.4.29 ((Ubuntu))
| _http-favicon: Unknown favicon MD5: E234E3E8040EFB1ACD7028330A956EBF
| http-methods:
| _ Supported Methods: GET POST OPTIONS HEAD
| _http-server-header: Apache / 2.4.29 (Ubuntu)
| _http-title: The Cyber Geek's Personal Website
6379 / tcp open redis Redis key-value store 4.0.9
10000 / tcp open ssl / http MiniServ 1.910 (Webmin httpd)
| _http-favicon: Unknown favicon MD5: 91549383E709F4F1DD6C8DAB07890301
| http-methods:
| _ Supported Methods: GET HEAD POST OPTIONS
| http-robots.txt : 1 disallowed entry
| _ /
| _http-title: Site doesn't have a title (text / html; Charset = iso-8859-1).
| _http-trane-info: Problem with XML parsing of / evox / about
| ssl-cert: Subject: commonName = * / organizationName = Webmin Webserver on
Postman
| Issuer: commonName = * / organizationName = Webmin Webserver on Postman
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2019-08-25T16: 26: 22
| Not valid after: 2024-08-23T16: 26: 22
| MD5: 96f4 064c e63e 1277 4954 a4d9 a099 56ac
| _SHA-1: 4322 6ff3 ab7a 6ade 2887 9b89 6657 401c 3afd 5217
| _ssl-date: TLS randomness does not represent time
Service Info: OS: Linux; CPE: cpe: / o: linux: linux_kernel
Therefore, I continued the search and after several attempts I found what really came
up:
https://github.com/Avinash-acid/Redis-Server-Exploit
I had to slightly change the exploit code for our Machine in this line (12):
From this:
script, ip_address, username = argv
To this:
ip_address = “10.10.10.160”
username = “redis””
Note:
The following packages are needed:
redis-cli
https://codewithhugo.com/install-just-redis-cli-on-ubuntu-debian-jessie/
In order to the exploit to work properly, we need to make a request through the redis-
tool until it issues a path with ".ssh":
redis-cli -h 10.10.10.160 config get dir
Redis – Operation
After starting the exploit with github, we get access to SSH on the lowpriv user redis.
(You do not need to enter any passwords at startup ... just press ENTER until you
win)
Them we go to /tmp directory and run the well-known LinEnum:
https://github.com/rebootuser/LinEnum
Later, if we closely monitor the process of searching for security holes, we notice that
in the /opt folder is id_rsa.bak, which usually stores the public key for SSH.
We open the key with cat and copy everything from there.
To create a hash and to extract a password from priv user from id_rsa, we need
ssh2john and john respectively.
Since there’s a webmin service run in port 10000 let’s check if we can log in with Matt
credentials.
It works!
Run Metasploit to find if theres any vulnerability open for webmin 1.910
- Go to msfconsole
- We are looking for an exploit: search webmin
- There we select literally the very first exploit, or rather our RCE Package Updater: