This box is from VulnHub and is in the TJ NuLL list of boxes for OSCP preparation. This box involved the following steps:
- Enumeration HTTP
- OpenSSL vulnerability Exploit
- Python decomilation for password extraction
The initial Nmap scan result is as below.
Nmap scan report for 10.0.0.14
Host is up, received arp-response (0.00034s latency).
Scanned at 2022-04-04 02:00:59 EDT for 14s
Not shown: 997 closed tcp ports (reset)
PORT STATE SERVICE REASON VERSION
22/tcp open ssh syn-ack ttl 64 OpenSSH 7.6p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 de:89:a2:de:45:e7:d6:3d:ef:e9:bd:b4:b6:68:ca:6d (RSA)
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCvkgmVahuBlxM6WUy6NSEAmWnYQbfKfrHwxT0rlZleQQ6Hyjd435lLBiA1kSyHzYxQ2l2WhiXefSycEtI8FntMjnOEFahCgobvsP5HblaUGAxmh+RPId+/U0OPwbF8WEtE2aM7ynaJ3eJt02iyHoFSTICNNiwAMX1sde/ADI2zXkssrjerwyTJLrI5JO1girvHJcJxJWvS3HFHyZbksKK6giPy7E8Q6Uz0sp5p+Qx4iqZ9kHkwwLZ+Yk56BupHZDvjDWx9Pi8qhnlwgaqUj/RbG/eEylxRtqQn2i1A6TQrWMcMTpN+P25Ws9TPV8cRiDQwEX+bx30HHgc5AQ+YDRkf
| 256 1d:98:4a:db:a2:e0:cc:68:38:93:d0:52:2a:1a:aa:96 (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDyK5qz3tcYxvzJVZO2izBdS3LucZE0hUU4mOTja1WHO7Ma3plgqQoL52O+svarU9eHvf0sW5GqD02Bf+4ZQbWo=
| 256 3d:8a:6b:92:0d:ba:37:82:9e:c3:27:18:b6:01:cd:98 (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEOKeds8hqs+e9SnwnrnhhoV8IRh/CUlCgMmdTroLiuG
80/tcp open http syn-ack ttl 64 Apache httpd 2.4.29 ((Ubuntu))
|_http-title: Apache2 Ubuntu Default Page: It works
| http-methods:
|_ Supported Methods: POST OPTIONS HEAD GET
|_http-server-header: Apache/2.4.29 (Ubuntu)
443/tcp open ssl/http syn-ack ttl 64 Apache httpd 2.4.29 ((Ubuntu))
|_http-title: Apache2 Ubuntu Default Page: It works
| http-methods:
|_ Supported Methods: POST OPTIONS HEAD GET
| ssl-cert: Subject: commonName=weakness.jth/organizationName=weakness.jth/stateOrProvinceName=Jordan/countryName=jo/[email protected]/localityName=Amman
| Issuer: commonName=weakness.jth/organizationName=weakness.jth/stateOrProvinceName=Jordan/countryName=jo/[email protected]/localityName=Amman
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2018-05-05T11:12:54
| Not valid after: 2019-05-05T11:12:54
| MD5: f921 c4be 2c6e 89d6 adaf a7c2 8f39 a87d
| SHA-1: 0b44 5a28 c4da 0bf8 b308 a782 4081 1218 101e 0feb
| -----BEGIN CERTIFICATE-----
| MIID0DCCArigAwIBAgIJAPo2he2sLvFHMA0GCSqGSIb3DQEBCwUAMH0xCzAJBgNV
| BAYTAmpvMQ8wDQYDVQQIDAZKb3JkYW4xDjAMBgNVBAcMBUFtbWFuMRUwEwYDVQQK
| DAx3ZWFrbmVzcy5qdGgxFTATBgNVBAMMDHdlYWtuZXNzLmp0aDEfMB0GCSqGSIb3
| DQEJARYQbjMwQHdlYWtuZXNzLmp0aDAeFw0xODA1MDUxMTEyNTRaFw0xOTA1MDUx
| MTEyNTRaMH0xCzAJBgNVBAYTAmpvMQ8wDQYDVQQIDAZKb3JkYW4xDjAMBgNVBAcM
| BUFtbWFuMRUwEwYDVQQKDAx3ZWFrbmVzcy5qdGgxFTATBgNVBAMMDHdlYWtuZXNz
| Lmp0aDEfMB0GCSqGSIb3DQEJARYQbjMwQHdlYWtuZXNzLmp0aDCCASIwDQYJKoZI
| hvcNAQEBBQADggEPADCCAQoCggEBANq345qdUACB07H/jIZ+VTL3029pbwbiB2Ew
| 2ZoS0DpiIlz5Fvcd15/Diw/b2uCfXrTa7ka2wYeSP+hpipI6oKTB8+7nRuh+cugv
| bApck+17nDe7MeE30s7hO33QPHoCPrWmM6Z53vhF/ur3cyd9osKrAg9oPCXMBBKV
| e5/s+gW9c7mfn2u+tHm6nAVKScxVoFdXld0c7OKOZDqFLKK7zLPa5iHKIW9wadYC
| c71OAAA5tx5fcn4xVBjOSBQUMOqJMHER1sUMOpqrsyHme84TulgNTck24ndyiHcE
| DfkBlOaA+qWDwcxFw22NFkAeg3/ry/J6gTBrQkCRsh3Ncbgd/IsCAwEAAaNTMFEw
| HQYDVR0OBBYEFJQs/y0qng9kHtd0p7JuPc/Vq+iWMB8GA1UdIwQYMBaAFJQs/y0q
| ng9kHtd0p7JuPc/Vq+iWMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD
| ggEBAMDHIAbnghNdTW/dG9xLyTLkPZYsaAeKgq8B8D5HfNy5Oo7A3dUIit0fvjJv
| AFTV16v8dwWPv6mjWwf1Npzl9JNHiT+437ZO+eBn3utIwYa8nl58ZyMC2gZCo0/4
| htEK3RgIFnjU2qiBeEBHk+Z6chF4AWVtxJa+mXx4RfUPwK5+WwOUOY9QbymR8cUI
| 1qlPDrP3MTuDj8OY9ts17L/XLcyKTkX2zuDIS8wBgt+WoOCb6Hy9s4/PGYwJT5iy
| KVlQicmEiKU70In1cpPF1FSV7iLpMQXhspJADJ0lPTzc7WEpIoySpxX8SVQ8cq4b
| d07ykwyD+BS8XzcuFQgI/8ek0as=
|_-----END CERTIFICATE-----
|_http-server-header: Apache/2.4.29 (Ubuntu)
|_ssl-date: TLS randomness does not represent time
| tls-alpn:
|_ http/1.1
MAC Address: 08:00:27:35:DA:AB (Oracle VirtualBox virtual NIC)
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9
Uptime guess: 17.442 days (since Thu Mar 17 15:24:50 2022)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=253 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE
HOP RTT ADDRESS
1 0.34 ms 10.0.0.14
In our initial nmap scan, I saw hostname weakness.jth . Let’s add that in the /etc/hosts and see if there is something. Yes, there is a website running with a message about following the rabbit. Does it mean rabbit-hole? Let’s find out. I will run a gobuster scan. We can see there is an email on the SSL certificate [email protected] . n30 may be the username.
I didn’t find anything interesting directory in 10.0.0.14 but /private in weakness.jth gave us a key and a note.
Now as the version of openssl is provided, I guess it be vulnerable to something and quick searchsploit results proves it.
So apparently that version of OpenSSL can only create a set number of ssh keys, I have downloaded the tar file which contains ssh keys as mentioned on the image. Let’s find our public key in that list and grab a private key from there. There is a match with the public key file.
So as the folder contains private and public keys, we just grab the private key now and try to ssh into the system. We do have n30 as a suspected username from our SSL certificate enumeration.
ssh -i 4161de56829de2fe64b9055711f531c1-2537 [email protected]
We are able to login to the system.
Now I can see two python compiled files. Downloading those files to my host system, I was able to decompile them. It consists of a password for the n30 user.
So the password for user n30 is dMASDNB!!#B!#!#33.
And to my surprise, n30 user can run all sudo commands without a password.
This box was fun to exploit and was excited to learn about the OpenSSL vulnerabilty.