此版本仅与 BloodHound Legacy 4.x 兼容
与 BloodHound Community Edition (CE) 兼容的版本可在此处找到 RustHound-CE。
并非所有 SharpHound 的功能都已实现。RustHound 中存在一些 SharpHound 或 BloodHound-Python 中没有的功能。请参考路线图了解更多信息。
RustHound 是一个跨平台的 BloodHound 收集工具,使用 Rust 编写,兼容 Linux、Windows 和 macOS。
无 AV 检测且交叉编译。
RustHound 生成用户、组、计算机、OU、GPO、容器和域 JSON 文件,可使用 BloodHound 进行分析。
💡 如果你能使用 SharpHound,请使用它。 如果 SharpHound 被 AV 检测到或不兼容你的操作系统,请将 RustHound 作为备用解决方案。
你可以使用 make 命令安装 RustHound 或为 Linux 或 Windows 编译它。
make install
rusthound -h
Makefile 中的更多命令:
Default:
usage: make install
usage: make uninstall
usage: make debug
usage: make release
Static:
usage: make windows
usage: make windows_x64
usage: make windows_x86
usage: make linux_aarch64
usage: make linux_x86_64
usage: make linux_musl
usage: make macos
usage: make arm_musl
usage: make armv7
Without cli argument:
usage: make windows_noargs
Dependencies:
usage: make install_windows_deps
usage: make install_linux_musl_deps
usage: make install_macos_deps
使用 Docker 运行 RustHound 以确保拥有所有依赖项。
docker build --rm -t rusthound .
# 然后
docker run --rm -v ./:/usr/src/rusthound rusthound windows
docker run --rm -v ./:/usr/src/rusthound rusthound linux_musl
docker run --rm -v ./:/usr/src/rusthound rusthound macos
你需要在系统上安装 Rust。
https://www.rust-lang.org/fr/tools/install
RustHound 支持 Kerberos 和 GSSAPI。因此,它需要 Clang 及其开发库,以及 Kerberos 开发库。在 Debian 和 Ubuntu 上,这意味着需要 clang-N、libclang-N-dev 和 libkrb5-dev。
例如:
# Debian/Ubuntu
sudo apt-get -y update && sudo apt-get -y install gcc clang libclang-dev libgssapi-krb5-2 libkrb5-dev libsasl2-modules-gssapi-mit musl-tools gcc-mingw-w64-x86-64
以下是如何使用 cargo 命令编译 "release" 和 "debug" 版本。
git clone https://github.com/OPENCYBER-FR/RustHound
cd RustHound
cargo build --release
# 或 debug 版本
cargo b
结果可以在 target/release 或 target/debug 文件夹中找到。
以下是从 Linux 编译每个操作系统的方法。 如果你需要另一种编译系统,请查阅此链接中的列表:https://doc.rust-lang.org/nightly/rustc/platform-support.html
# 为 Linux 安装 rustup 和 Cargo
curl https://sh.rustup.rs -sSf | sh
# 添加 Linux 依赖
rustup install stable-x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-linux-gnu
# 为 Linux 静态编译
git clone https://github.com/OPENCYBER-FR/RustHound
cd RustHound
CFLAGS="-lrt";LDFLAGS="-lrt";RUSTFLAGS='-C target-feature=+crt-static';cargo build --release --target x86_64-unknown-linux-gnu
结果可以在 target/x86_64-unknown-linux-gnu/release 文件夹中找到。
# 在 Linux 上安装 rustup 和 Cargo
curl https://sh.rustup.rs -sSf | sh
# 添加 Windows 依赖
rustup install stable-x86_64-pc-windows-gnu
rustup target add x86_64-pc-windows-gnu
# 为 Windows 静态编译
git clone https://github.com/OPENCYBER-FR/RustHound
cd RustHound
RUSTFLAGS="-C target-feature=+crt-static" cargo build --release --target x86_64-pc-windows-gnu
结果可以在 target/x86_64-pc-windows-gnu/release 文件夹中找到。
出色的文档:https://wapl.es/rust/2019/02/17/rust-cross-compile-linux-to-macos.html
# 在 Linux 上安装 rustup 和 Cargo
curl https://sh.rustup.rs -sSf | sh
# 添加 macOS 工具链
sudo git clone https://github.com/tpoechtrager/osxcross /usr/local/bin/osxcross
sudo wget -P /usr/local/bin/osxcross/ -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz && sudo mv /usr/local/bin/osxcross/MacOSX10.10.sdk.tar.xz /usr/local/bin/osxcross/tarballs/
sudo UNATTENDED=yes OSX_VERSION_MIN=10.7 /usr/local/bin/osxcross/build.sh
sudo chmod 775 /usr/local/bin/osxcross/ -R
export PATH="/usr/local/bin/osxcross/target/bin:$PATH"
# 需要告诉 Cargo 为 x86_64-apple-darwin 目标使用正确的链接器,因此将以下内容添加到项目的 .cargo/config 文件中:
grep 'target.x86_64-apple-darwin' ~/.cargo/config || echo "[target.x86_64-apple-darwin]" >> ~/.cargo/config
grep 'linker = "x86_64-apple-darwin14-clang"' ~/.cargo/config || echo 'linker = "x86_64-apple-darwin14-clang"' >> ~/.cargo/config
grep 'ar = "x86_64-apple-darwin14-clang"' ~/.cargo/config || echo 'ar = "x86_64-apple-darwin14-clang"' >> ~/.cargo/config
# 为 macOS 静态编译
git clone https://github.com/OPENCYBER-FR/RustHound
cd RustHound
RUSTFLAGS="-C target-feature=+crt-static" cargo build --release --target x86_64-apple-darwin --features nogssapi
结果可以在 target/x86_64-apple-darwin/release 文件夹中找到。
💡 要获得 RustHound 的优化编译,请在
Cargo.toml文件末尾添加以下编译参数。
[profile.release]
opt-level = "z"
lto = true
strip = true
codegen-units = 1
panic = "abort"
二进制文件的大小将大幅减小。 可以使用基本的 cargo 编译器命令。
make windows
更多信息请点击此处
git clone https://github.com/OPENCYBER-FR/RustHound
cd RustHound
cargo doc --open --no-deps
Usage: rusthound [OPTIONS] --domain <domain>
Options:
-v... Set the level of verbosity
-h, --help Print help information
-V, --version Print version information
REQUIRED VALUES:
-d, --domain <domain> Domain name like: DOMAIN.LOCAL
OPTIONAL VALUES:
-u, --ldapusername <ldapusername> LDAP username, like: [email protected]
-p, --ldappassword <ldappassword> LDAP password
-f, --ldapfqdn <ldapfqdn> Domain Controler FQDN like: DC01.DOMAIN.LOCAL or just DC01
-i, --ldapip <ldapip> Domain Controller IP address like: 192.168.1.10
-P, --ldapport <ldapport> LDAP port [default: 389]
-n, --name-server <name-server> Alternative IP address name server to use for DNS queries
-o, --output <output> Output directory where you would like to save JSON files [default: ./]
OPTIONAL FLAGS:
--ldaps Force LDAPS using for request like: ldaps://DOMAIN.LOCAL/
--dns-tcp Use TCP instead of UDP for DNS queries
--dc-only Collects data only from the domain controller. Will not try to retrieve CA security/configuration or check for Web Enrollment
--old-bloodhound For ADCS only. Output result as BloodHound data for the original BloodHound version from @BloodHoundAD without PKI support
-z, --zip Compress the JSON files into a zip archive
OPTIONAL MODULES:
--fqdn-resolver Use fqdn-resolver module to get computers IP address
--adcs Use ADCS module to enumerate Certificate Templates, Certificate Authorities and other configurations.
(For the custom-built BloodHound version from @ly4k with PKI support)
# Linux 使用 username:password
rusthound -d north.sevenkingdoms.local -u '[email protected]' -p '_L0ngCl@w_' -o /tmp/demo -z
# Linux 使用 username:password 和 ldapip
rusthound -d north.sevenkingdoms.local -i 192.168.56.11 -u '[email protected]' -p '_L0ngCl@w_' -o /tmp/demo -z
# Linux 使用 username:password 和 ldaps
rusthound -d north.sevenkingdoms.local --ldaps -u '[email protected]' -p '_L0ngCl@w_' -o /tmp/demo -z
# Linux 使用 username:password 和 ldaps 以及自定义端口
rusthound -d north.sevenkingdoms.local --ldaps -P 3636 -u '[email protected]' -p '_L0ngCl@w_' -o /tmp/demo -z
# 提示:将标准输出和标准错误重定向并追加到文件中 > /tmp/rh_output 2>&1
rusthound -d north.sevenkingdoms.local --ldaps -u '[email protected]' -p '_L0ngCl@w_' -o /tmp/demo --fqdn-resolver > /tmp/rh_output 2>&1
# Windows 使用 GSSAPI 会话
rusthound.exe -d sevenkingdoms.local --ldapfqdn kingslanding
# Windows 简单绑定连接 username:password(不要使用 cmd.exe 的单引号或双引号)
rusthound.exe -d sevenkingdoms.local -u [email protected] -p _L0ngCl@w_ -o output -z
# Kerberos 认证(Linux)
export KRB5CCNAME="/tmp/jeor.mormont.ccache"
rusthound -d sevenkingdoms.local -f kingslanding -k -z
# Kerberos 认证(Windows)
rusthound.exe -d sevenkingdoms.local -f kingslanding -k -z
# Linux 使用 username:password 和 FQDN 解析模块
rusthound -d essos.local -u '[email protected]' -p 'BurnThemAll!' -o /tmp/demo --fqdn-resolver -z
# Linux 使用 username:password 和 ldaps 以及 FQDN 解析模块和 TCP DNS 请求及自定义名称服务器
rusthound -d essos.local --ldaps -u '[email protected]' -p 'BurnThemAll!' -o /tmp/demo --fqdn-resolver --tcp-dns --name-server 192.168.56.12 -z
# Windows 使用 GSSAPI 会话和 FQDN 解析模块
rusthound.exe -d essos.local -f meereen -o output --fqdn-resolver -z
# Windows 简单绑定连接 username:password 和 FQDN 解析模块及 TCP DNS 请求和自定义名称服务器(不要使用 cmd.exe 的单引号或双引号)
rusthound.exe -d essos.local -u [email protected] -p BurnThemAll! -o output -z --fqdn-resolver --tcp-dns --name-server 192.168.56.12
示例使用 @ly4k BloodHound 版本。
# Linux 使用 username:password 和 ADCS 模块(用于 @ly4k BloodHound 版本)
rusthound -d essos.local -u '[email protected]' -p 'BurnThemAll!' -o /tmp/adcs --adcs -z
# Linux 使用 username:password 和 ADCS 模块以及 dconly 标志(将不检查 Web Enrollment)
rusthound -d essos.local -u '[email protected]' -p 'BurnThemAll!' -o /tmp/adcs --adcs --dc-only -z
# Linux 使用 username:password 和 ADCS 模块,使用 "--old-bloodhound" 参数(用于官方 @BloodHoundAd 版本)
rusthound -d essos.local -u '[email protected]' -p 'BurnThemAll!' -o /tmp/adcs --adcs --old-bloodhound -z
# Windows 使用 GSSAPI 会话和 ADCS 模块
rusthound.exe -d essos.local -f meereen -o output -z --adcs
# Windows 使用 GSSAPI 会话和 ADCS 模块及 TCP DNS 请求和自定义名称服务器
rusthound.exe -d essos.local --ldapfqdn meereen -o output -z --adcs --tcp-dns --name-server 192.168.56.12
# Windows 简单绑定连接 username:password(不要使用 cmd.exe 的单引号或双引号)
rusthound.exe -d essos.local -u [email protected] -p BurnThemAll! -o output -z --adcs --dc-only
你可以在资源文件夹中找到演示中使用的自定义查询。
使用以下命令安装:
cp resources/customqueries.json ~/.config/bloodhound/customqueries.json
为了在包含更多 LDAP 对象的 DC 上进行统计,请在来自 GOAD 的域控制器 ESSOS.local 上运行 BadBlood。DC 现在应有大约 3500 个对象。以下是运行以下工具的平均时间:
BINDNTLMKerberos解析功能
HasSIDHistory属性 : sfupasswordDCERPC(依赖项)
会话本地管理员远程桌面用户Dcom 用户PS 远程用户| 工具 | 环境 | 对象数 | 时间 | 命令 |
|---|
| SharpHound.exe | Windows ![]() | ~3500 | ~51.605s | Measure-Command { sharphound.exe -d essos.local --ldapusername 'khal.drogo' --ldappassword 'horse' --domaincontroller '192.168.56.12' -c All } |
| BloodHound.py | Linux ![]() | ~3500 | ~9.657s | time python3 bloodhound.py -u khal.drogo -p horse -d essos.local -ns 192.168.56.12 --zip -c all |
| RustHound.exe | Windows ![]() | ~3500 | ~5.315s | Measure-Command { rusthound.exe -d essos.local -u [email protected] -p horse -z } |
| RustHound | Linux ![]() | ~3500 | ~3.166s | time rusthound -d essos.local -u [email protected] -p horse -z |
用户指定的 SAN请求处理