
Snow Monkey Forms <= 12.0.3 - パストラバーサルによる未認証の任意ファイル削除(CVE-2026-1056)
このリポジトリには、Snow Monkey Forms WordPress プラグイン(バージョン <= 12.0.3)の重大な脆弱性に対する Proof of Concept(PoC)が含まれています。この脆弱性により、未認証の攻撃者がパストラバーサルを介してサーバー上の任意のファイルを削除できます。
参照: Sarawut Poolkhet (MisterHelloz)
Snow_Monkey\Plugin\Forms\App\Rest\Route\View.php/wp-json/snow-monkey-form/v1/view)この脆弱性は、Snow_Monkey\Plugin\Forms\App\Rest\Route\View.php にある REST API ハンドラーに存在します。send() メソッドは、ユーザー入力パラメータに基づいて処理の流れを決定します。
// File: App/Rest/Route/View.php
public function send() {
Csrf::save_token();
$method = Meta::get_method(); // Sourced from $_POST['snow-monkey-forms-meta']['method']
// VULNERABILITY: If 'method' is 'input', the critical CSRF check is BYPASSED.
if ( 'input' === $method ) {
return $this->_send(); // Direct execution flow to _send()
}
// CSRF check is only performed for other methods (e.g., 'confirm', 'complete')
if ( ! Csrf::validate( Meta::get_token() ) ) { ... }
攻撃者はメソッドパラメータとして input を指定することで、アプリケーションに _send() 関数を即座に実行させ、不正な操作を防ぐための Csrf::validate() セキュリティ制御をスキップさせます。
_send() メソッド内で、アプリケーションはユーザー固有の一時ディレクトリのクリーンアップルーチンを実行しようとします。このルーチンは formid パラメータに依存しています。
// File: App/Rest/Route/View.php -> _send()
// 'form_id' is sourced directly from POST data via Meta class without sanitization
$user_dirpath = Directory::generate_user_dirpath( $this->setting->get( 'form_id' ), false );
Directory::do_empty( $user_dirpath, true ); // Recursively delete contents
Directory::remove( $user_dirpath ); // Delete the directory itself
重要な欠陥は、Directory::generate_user_dirpath がパスを構築する方法にあります:
// File: App/Model/Directory.php
public static function generate_user_dirpath( $form_id, $do_create_directory = true ) {
$saved_token = Csrf::saved_token();
// ... (Regex check for token exists, but not for form_id) ...
$user_dir = path_join( static::get(), $saved_token );
// VULNERABILITY: $form_id is appended directly.
// WordPress path_join() does NOT resolve or sanitize '../' sequences.
$user_dir = path_join( $user_dir, (string) $form_id );
return $user_dir;
}
$form_id 変数は文字列にキャストされますが、整数であることが検証されることはありません。これにより、攻撃者はディレクトリトラバーサル文字(例: ../../../../)を注入できます。
requests ライブラリ (pip install requests)python exploit.py -u <TARGET_URL> -f <TRAVERSAL_PAYLOAD>
