NiceGUI's unvalidated chunk size parameter in media routes can cause memory exhaustion
Moderate severity
GitHub Reviewed
Published
Mar 19, 2026
in
zauberzeug/nicegui
•
Updated Mar 27, 2026
Description
Published to the GitHub Advisory Database
Mar 19, 2026
Reviewed
Mar 19, 2026
Published by the National Vulnerability Database
Mar 24, 2026
Last updated
Mar 27, 2026
Summary
NiceGUI's
app.add_media_file()andapp.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()orapp.add_media_files(), particularly those serving large files (video, audio).What an attacker can do:
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.
References