/

CVE-2026-33332

Severity:

HIGH RISK

(7.5)

Uncontrolled Resource Consumption / Denial of Service

CVE-2026-33332

Analyzed

Vulnerability type

Category:

Uncontrolled Resource Consumption / Denial of Service

CWE:

CWE-20, CWE-770

Impact:

Denial of Service via Memory Exhaustion

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

NiceGUI's media streaming routes app.add_media_file() and app.add_media_files() accept a user-controlled query parameter that directly influences how files are read and served.

Because this parameter is not validated, an attacker can bypass chunked streaming and force the server to load entire files into memory, potentially causing excessive memory usage, performance degradation, or denial of service when large files and concurrent requests are involved.

Affected context

This vulnerability affects applications built with NiceGUI that:

  • Use app.add_media_file() or app.add_media_files() to serve media content
  • Allow user-supplied query parameters to control media streaming behavior
  • Host large media files or operate in environments where resource limits are tight

The risk is higher when the application serves many concurrent clients or when large files (e.g., videos, high-resolution images, large audio files) are accessible through these routes.

Exploit preconditions

  • Attack surface: Public or internal HTTP endpoints exposing NiceGUI media routes.
  • Required access: Ability to send HTTP requests to the affected media endpoints (typically anonymous or low-privilege).
  • Trigger point: Supplying crafted query parameters that manipulate the range-response handling so that the server reads full files into memory instead of streaming in chunks.
  • Why exploitation is possible: The media-related query parameter is accepted without adequate validation or bounds checking, allowing clients to influence how much data is loaded into memory per request, leading to uncontrolled resource usage when repeated or parallelized.

Why this happens

The core issue stems from improper input validation (CWE-20) combined with uncontrolled resource consumption (CWE-770).

NiceGUI's media routes pass a user-controlled query parameter directly into the range-response implementation, which controls file reading behavior.

Without validating or constraining this input, the application can be coerced into bypassing efficient chunked streaming and instead loading entire media files into memory.

This design implicitly trusts client-controlled values to dictate server-side resource usage, enabling an attacker to scale their impact with file size and concurrency.

Potential impact

  • Server memory exhaustion, which can lead to process crashes or restarts
  • Significant performance degradation for legitimate users due to resource contention
  • Temporary denial of service for the affected NiceGUI application or hosting environment
  • Increased infrastructure costs or instability under load in shared hosting or containerized environments

General mitigation guidance

Effective mitigation focuses on constraining how client input can influence resource-intensive operations and enforcing defensive resource management patterns:

  • Validate and sanitize query parameters affecting media streaming, allowing only known-safe values and ranges.
  • Enforce chunked, bounded file streaming on the server side, independent of client-controlled parameters.
  • Impose maximum file size and response size limits, refusing or degrading service for requests that exceed safe thresholds.
  • Apply server-side timeouts, rate limits, and per-client connection limits for media endpoints to reduce abuse potential.
  • Use operating system or runtime-level resource constraints (e.g., memory limits, container quotas) so that individual services cannot exhaust host resources.

How teams detect issues like this

Detection can rely on both code-centric and operational signals:

  • Static analysis: Flag code paths where user-controlled query parameters are passed directly into file I/O or range/streaming logic without validation or bounds checking.
  • Code review: Look for media or file-serving routes that trust client input to choose buffer sizes, byte ranges, or streaming modes; verify that strict validation and sensible defaults are in place.
  • Runtime monitoring: Track memory usage, request rates, and error spikes on media endpoints; alert on patterns of repeated large-range or anomalous streaming requests from the same sources.
  • Log analysis: Inspect access logs for requests that systematically target large media files with unusual or repetitive query parameters that correlate with resource spikes.

Sources

SourceLink
github.comgithub.com/zauberzeug/nicegui/commit/9026962b8c4f3f225c98b2fbc35aa6b60cb3495b
github.comgithub.com/zauberzeug/nicegui/releases/tag/v3.9.0
github.comgithub.com/zauberzeug/nicegui/security/advisories/GHSA-w5g8-5849-vj76

Frequently asked

questions

Yes. Any remote user who can reach the affected NiceGUI media endpoints and send crafted HTTP requests with query parameters can attempt to exploit the vulnerability.

Typically only network access to the application is required. If the media endpoints are publicly exposed and do not require authentication, even unauthenticated users may trigger excessive memory consumption.

Enforce strict validation and whitelisting of query parameters used by media routes and decouple streaming behavior from direct client control. Ensure that server-side code always uses safe, bounded, chunked streaming patterns regardless of client input.

Adopt a defensive design practice where client inputs never directly control memory- or CPU-intensive operations without validation and limits. Combine secure coding guidelines, code review checklists, static analysis, and runtime resource controls to catch and mitigate uncontrolled resource consumption risks early.

Find out what's already
exploitable in your codebase.