Medium

NiceGUI's unvalidated chunk size parameter in media routes can cause memory exhaustion

  • Disclosed: 19.03.2026
  • Updated: 11.10.2026 13:19

Summary

NiceGUI's app.add_media_file() and app.add_media_files() media routes accept a user-controlled query parameter that influences how files are read during streaming. The parameter is passed to the range-response implementation without validation, allowing an attacker to bypass chunked streaming and force the server to load entire files into memory at once.

With large media files and concurrent requests, this can lead to excessive memory consumption, degraded performance, or denial of service.

Impact

Affected applications: NiceGUI applications that serve media content via app.add_media_file() or app.add_media_files(), particularly those serving large files (video, audio).

What an attacker can do:

  • Force the server to load entire files into memory instead of streaming them in chunks
  • Amplify memory usage with concurrent requests to large media files
  • Cause performance degradation, memory pressure, and potential OOM conditions

Attack difficulty: Low - requires only a crafted query parameter.

Remediation

Upgrade to a patched version of NiceGUI.

As a workaround, restrict access to media endpoints or strip unexpected query parameters at a reverse proxy layer.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) nicegui < 3.9.0 3.9.0

References

CVSS score 5.3/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Weakness (CWE)
CWE-20, CWE-770
Platform
Python (PyPI)
Package
nicegui
Disclosed
19.03.2026
Updated
11.10.2026 13:19

Sources and licenses

OSV / GitHub Advisory Database - PYSEC-2026-2233 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-w5g8-5849-vj76 - CC BY 4.0

Vulnerability history: nicegui

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (17) in the archive
Total entries
17
First → latest
04.2024 05.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • High 6
  • Medium 11

Disclosures per year

  1. 2024: 1
  2. 2025: 5
  3. 2026: 11
Severity:
  1. NiceGUI's unvalidated chunk size parameter in media routes can cause memory exhaustion this entry
    Medium · 5.3 CVE-2026-33332 < 3.9.0 3.9.0
  2. High · 7.2 CVE-2026-21873 >= 2.22.0, < 3.5.0 3.5.0
  3. High · 7.5 CVE-2025-21618 < 2.9.1 2.9.1
  4. High · 8.2 CVE-2024-32005 >= 1.4.6, < 1.4.21 1.4.21

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.