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.
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.
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.
{
"github_reviewed": true,
"github_reviewed_at": "2026-03-19T18:48:27Z",
"severity": "MODERATE",
"nvd_published_at": "2026-03-24T20:16:28Z",
"cwe_ids": [
"CWE-20",
"CWE-770"
]
}