Know every vulnerabilitybefore it knows you.
DevGuard continuously monitors your dependencies and alerts you when CVEs like this one affect your stack — with real-time threat intelligence built for developers.
GHSA-w8wv-vfpc-hw2w
No affected components available
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:
filename = PurePosixPath(upload.filename or '').name
PurePosixPath treats backslashes as literal characters, not path separators:
>>> 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.
The vulnerability can be exploited over the network without needing physical access. It is difficult for an attacker to exploit this vulnerability and may require special conditions. An attacker does not need any special privileges or access rights. No user interaction is needed for the attacker to exploit this vulnerability. The impact is confined to the system where the vulnerability exists. There is a high impact on the integrity of the data.
Exploitation attempts have been detected. Elevated vigilance and prompt remediation are advised.
The exploit probability is very low. The vulnerability is unlikely to be exploited in the next 30 days.
We did not find any exploit available. Neither in GitHub repositories nor in the Exploit-Database.
Browse More
Continuously monitor your dependencies and get alerted when vulnerabilities like this one affect your stack.
Checkout DevGuard