जमा करें #895338: OctoPrint Foundation OctoPrint 1.0.0 CWE: CWE-22 (Path Traversal)जानकारी

शीर्षकOctoPrint Foundation OctoPrint 1.0.0 CWE: CWE-22 (Path Traversal)
विवरण漏洞描述 The file download API endpoint /api/files/<target>/<path:filename> uses Flask’s <path:filename> route parameter which allows path traversal sequences. While the _validate() function checks file existence, it may not properly normalize the path before checking, allowing ../ sequences to escape the designated upload directory. 证据/技术细节 文件: src/octoprint/server/api/files.py 路由: @api.route("/files/<string:target>/<path:filename>", methods=["GET"]) 关键问题: <path:filename> 类型允许包含 / 的路径,_validate() 可能未做 os.path.realpath() 规范化检查 POC import requests resp = requests.get( "http://TARGET:5000/api/files/local/../../../home/pi/.octoprint/settings.yaml", headers={"X-Api-Key": "API_KEY"} ) print(resp.text) 修复建议 import os def _validate(target, filename): base = settings().getBaseFolder(target) full_path = os.path.realpath(os.path.join(base, filename)) allowed = os.path.realpath(base) return full_path.startswith(allowed + os.sep) and os.path.isfile(full_path)
उपयोगकर्ता
 EagleShadow (UID 99969)
सबमिशन19/07/2026 07:18 AM (2 महीनों पहले)
संयम21/09/2026 07:45 PM (2 months later)
स्थितिस्वीकृत
VulDB प्रविष्टि408189 [OctoPrint 1.0.0 File Download API files.py _validate filename निर्देशिका ट्रैवर्सल]
अंक17

Do you need the next level of professionalism?

Upgrade your account now!