GHSA-W8WV-VFPC-HW2W

Vulnerability from github – Published: 2026-04-08 15:04 – Updated: 2026-04-09 14:28
VLAI?
Summary
NiceGUI: Upload filename sanitization bypass via backslashes allows path traversal on Windows
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:

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.

Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 3.9.0"
      },
      "package": {
        "ecosystem": "PyPI",
        "name": "nicegui"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "3.10.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-39844"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-04-08T15:04:13Z",
    "nvd_published_at": "2026-04-08T21:16:59Z",
    "severity": "MODERATE"
  },
  "details": "### Summary\n\nThe 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.\n\nApplications that construct file paths using `file.name` (a pattern demonstrated in NiceGUI\u0027s bundled examples) are vulnerable to arbitrary file write on Windows.\n\n### Details\n\nThe sanitization in `nicegui/elements/upload_files.py` uses:\n\n```python\nfilename = PurePosixPath(upload.filename or \u0027\u0027).name\n```\n\n`PurePosixPath` treats backslashes as literal characters, not path separators:\n\n```python\n\u003e\u003e\u003e PurePosixPath(\u0027..\\\\..\\\\secret\\\\evil.txt\u0027).name\n\u0027..\\\\..\\\\secret\\\\evil.txt\u0027  # Not stripped!\n```\n\nWhen this filename is used in a path operation on Windows (e.g., `Path(\u0027uploads\u0027) / file.name`), Windows `Path` interprets backslashes as directory separators, resolving the path outside the intended directory.\n\n### Impact\n\nOn Windows deployments of NiceGUI applications that use `file.name` in path construction:\n\n- **Arbitrary file write** outside the intended upload directory\n- **Potential remote code execution** through overwriting application files or placing executables in known locations\n- **Data integrity loss** through overwriting existing files\n\nLinux and macOS are not affected, as they treat backslashes as literal filename characters.",
  "id": "GHSA-w8wv-vfpc-hw2w",
  "modified": "2026-04-09T14:28:46Z",
  "published": "2026-04-08T15:04:13Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/zauberzeug/nicegui/security/advisories/GHSA-w8wv-vfpc-hw2w"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-39844"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zauberzeug/nicegui/commit/d38a702e3af2da5b0708f689be8d71413fc77056"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/zauberzeug/nicegui"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zauberzeug/nicegui/releases/tag/v3.10.0"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "NiceGUI: Upload filename sanitization bypass via backslashes allows path traversal on Windows"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…