GitHub Advisoryadvisory · PyPI
GHSA-9ffm-fxg3-xrhh NiceGUI's Path Traversal via Unsanitized FileUpload.name Enables Arbitrary File Write
HIGH
Official page ↗
- Aliases
- CVE-2026-25732
- Ecosystem
- PyPI
- Packages
- nicegui
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
- Weaknesses
- CWE-22, CWE-601
- Reviewed
- 2026-02-05
Affected packages
• PyPI nicegui: < 3.7.0 → fixed in 3.7.0
Description
Summary
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.
Details
Vulnerable Component: `nicegui/elements/upload_files.py` (upload_files.py#L79-L82 and upload_files.py#L110-L115)
Affected Methods: `SmallFileUpload.save()`and `LargeFileUpload.save()`
```py
async def save(self, path: str | Path) -> None:
target = Path(path)
target.parent.mkdir(parents=True, exist_ok=True)
await run.io_bound(target.write_bytes, self._data)
```
Root Cause: The `save()` method performs no validation on the provided path parameter. It accepts:
• Relative paths with `../` sequences
• Absolute paths
• Any file system location writable by the process
When developers use `e.file.name` (controlled by the attacker) in constructing save paths, directory traversal occurs:
```py
save_path = UPLOAD_DIR / e.file.name # e.file.name = "../app.py"
await e.file.save(save_path) # Writes outside UPLOAD_DIR
```
PoC
• Terminal 1 (App)
```bash
cd /tmp && mkdir -p evilgui && cd evilgui
python3 -m venv evilgui && source evilgui/bin/activate
pip install nicegui
cat > vulnerable_app.py exploit.py None:
target = Path(path).resolve()
if base_dir is not None:
base_dir = base_dir.resolve()
if not target.is_relative_to(base_dir):
raise ValueError(
f"Path '{target}' escapes base directory '{base_dir}'"
)
target.parent.mkdir(parents=True, exist_ok=True)
await run.io_bound(target.write_bytes, self._data)
````
Related
Alias · CVE (1)
- CVE-2026-25732 NiceGUI is a Python-based UI framework. vulnerability
References
- https://github.com/zauberzeug/nicegui/security/advisories/GHSA-9ffm-fxg3-xrhh web
- https://nvd.nist.gov/vuln/detail/CVE-2026-25732 advisory
- https://github.com/pypa/advisory-database/tree/main/vulns/nicegui/PYSEC-2026-95.yaml web
- https://github.com/zauberzeug/nicegui package
- https://github.com/zauberzeug/nicegui/blob/main/nicegui/elements/upload_files.py#L110-L115 web
- https://github.com/zauberzeug/nicegui/blob/main/nicegui/elements/upload_files.py#L79-L82 web