---
schema_version: '1.0'
id: security-20260812-b332db
title: 'CVE-2026-39844: NiceGUI: Upload filename sanitization bypass via backslashes
  allows path traversal on Windows'
url: https://osv.dev/vulnerability/GHSA-w8wv-vfpc-hw2w
url_hash: b332dbf05ec0350baba70491a7f6783ef506ef4733a22d7bfb74dcacdb1dd5ca
canonical_url: https://osv.dev/vulnerability/GHSA-w8wv-vfpc-hw2w
source: osv:ghsa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-39844
- GHSA-w8wv-vfpc-hw2w
- severity:CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
- nicegui
- PyPI
lang: en
published_at: '2026-04-08T15:04:13Z'
fetched_at: '2026-08-12T16:00:04.489202Z'
updated_at: '2026-08-22T14:41:30Z'
status: published
content_hash: 7d73afb84eb16cfc85a063e6f95f3aa8ff0dd2cc05f9f0b0195abe8131905891
content_changed_at: '2026-08-22T13:15:21.575306Z'
license_note: full
summary: 'NiceGUI: Upload filename sanitization bypass via backslashes allows path
  traversal on Windows'
summary_source: rss
summary_en: 'NiceGUI: Upload filename sanitization bypass via backslashes allows path
  traversal on Windows'
summary_omitted_reason: null
redistribution: true
keywords_en:
- allows
- backslashes
- bypass
- CVE
- CVE-2026-39844
- filename
- GHSA-w8wv-vfpc-hw2w
- library vulnerability
- nicegui
- path
- PyPI
- sanitization
- severity:CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
- software security
- traversal
- Upload
- via
- Windows
entities_en:
- name: CVE
  type: data
- name: PyPI
  type: artifact
topics_en:
- library vulnerability
- software security
numeric_facts: []
entities:
- name: CVE
  type: data
- name: PyPI
  type: artifact
related_auto:
- name: Portal
  type: organization
  weight: 1.0
- name: Hugging Face
  type: organization
  weight: 1.0
computed_at: '2026-08-22T14:41:28Z'
---

# CVE-2026-39844: NiceGUI: Upload filename sanitization bypass via backslashes allows path traversal on Windows

## TL;DR
NiceGUI: Upload filename sanitization bypass via backslashes allows path traversal on Windows

## Key Points
- cve / CVE-2026-39844 / GHSA-w8wv-vfpc-hw2w / severity:CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N / nicegui / PyPI

## Details
**Severity:** CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
**Advisory:** GHSA-w8wv-vfpc-hw2w (CVE-2026-39844)

**Details:**
### Summary

The upload filename sanitization introduced in GHSA-9ffm-fxg3-xrhh uses `PurePosixPath(filename).name` to strip path components. Since `PurePosixPath` only recognizes forward slashes (`/`) as path separators, an attacker can bypass this sanitization on Windows by using backslashes (`\`) in the upload filename.

Applications that construct file paths using `file.name` (a pattern demonstrated in NiceGUI's bundled examples) are vulnerable to arbitrary file write on Windows.

### Details

The sanitization in `nicegui/elements/upload_files.py` uses:

```python
filename = PurePosixPath(upload.filename or '').name
```

`PurePosixPath` treats backslashes as literal characters, not path separators:

```python
>>> PurePosixPath('..\\..\\secret\\evil.txt').name
'..\\..\\secret\\evil.txt'  # Not stripped!
```

When this filename is used in a path operation on Windows (e.g., `Path('uploads') / file.name`), Windows `Path` interprets backslashes as directory separators, resolving the path outside the intended directory.

### Impact

On Windows deployments of NiceGUI applications that use `file.name` in path construction:

- **Arbitrary file write** outside the intended upload directory
- **Potential remote code execution** through overwriting application files or placing executables in known locations
- **Data integrity loss** through overwriting existing files

Linux and macOS are not affected, as they treat backslashes as literal filename characters.

**References:**
- https://github.com/zauberzeug/nicegui/security/advisories/GHSA-w8wv-vfpc-hw2w
- https://nvd.nist.gov/vuln/detail/CVE-2026-39844
- https://github.com/zauberzeug/nicegui/commit/d38a702e3af2da5b0708f689be8d71413fc77056
- https://github.com/zauberzeug/nicegui
- https://github.com/zauberzeug/nicegui/releases/tag/v3.10.0

_Data: OSV.dev (upstream: ghsa) — https://osv.dev/vulnerability/GHSA-w8wv-vfpc-hw2w_

## Source
元記事: [CVE-2026-39844: NiceGUI: Upload filename sanitization bypass via backslashes allows path traversal on Windows](https://osv.dev/vulnerability/GHSA-w8wv-vfpc-hw2w) — published 2026-04-08T15:04:13Z
