CVE-2025-66645 is a high-severity (CVSS 7.5) Path Traversal vulnerability in nicegui. A fix is available for nicegui — see the affected versions and patch details below.
NiceGUI Path Traversal Vulnerability in app.add_media_files() Allows Arbitrary File Reading
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
Exploitation and automatability from CISA’s SSVC triage for CVE-2025-66645.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
CVE-2025-66645 plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.
Where this sits among everything scored
Of 378,156 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
niceguiReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
Summary
A directory traversal vulnerability in NiceGUI's App.add_media_files() allows a remote attacker to read arbitrary files on the server filesystem.
Details
Hello, I am Seungbin Yang, a university student studying cybersecurity. While reviewing the source code of the repository, I discovered a potential vulnerability and successfully verified it with a PoC.
The App.add_media_files(url_path, local_directory) method allows users to serve media files. However, the implementation lacks proper path validation.
def add_media_files(self, url_path: str, local_directory: Union[str, Path]) -> None:
@self.get(url_path.rstrip('/') + '/{filename:path}')
def read_item(request: Request, filename: str, nicegui_chunk_size: int = 8192) -> Response:
filepath = Path(local_directory) / filename
if not filepath.is_file():
raise HTTPException(status_code=404, detail='Not Found')
return get_range_response(filepath, request, chunk_size=nicegui_chunk_size)
Root Cause:
- The
{filename:path}parameter accepts full paths, including traversal sequences like../. - The code simply joins local_directory and filename without checking if the result is still inside the local_directory.
- There is no path sanitization or boundary check.
Consequence:
An attacker can use .. to access files outside the intended directory. If the application has permission, sensitive files (e.g., /etc/hosts, source code, config files) can be exposed.
POC
- Create
poc.py:
# poc.py
from pathlib import Path
from nicegui import app, ui
MEDIA_DIR = Path(__file__).parent / 'media'
MEDIA_DIR.mkdir(exist_ok=True)
# Expose local "media" directory at /media
app.add_media_files('/media', MEDIA_DIR)
@ui.page('/')
def index():
ui.label('NiceGUI media PoC')
ui.run(port=8080, reload=False)
-
Run the application:
python3 poc.py -
Exploit with curl: Use URL-encoded dots (
%2e) to bypass client-side checks.curl -v "http://localhost:8080/media/%2e%2e/%2e%2e/%2e%2e/etc/hosts"
Result:
The HTTP status is 200 OK, and the response body contains the contents of the server’s /etc/hosts file.
I have attached a screenshot of the successful exploitation below. As shown in the image, the content of /etc/hosts displayed via cat matches the output received from the curl request perfectly.
<img width="1728" height="1078" alt="POC screenshot" src="https://github.com/user-attachments/assets/6c1be75b-6be2-4372-90df-55042c1e4775" />Impact
Any NiceGUI application that calls app.add_media_files() on a URL path reachable by an attacker is affected. An unauthenticated remote attacker can read sensitive files outside the intended media directory, potentially exposing:
•Application source code and configuration files •Credentials, API keys, and secrets •Operating system configuration files (e.g., /etc/passwd, /etc/hosts)
This is my first github vulnerability report, so I would appreciate your understanding regarding any potential shortcomings. If you require any further information or clarification, please feel free to contact me at [email protected].
Thank you.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | nicegui | all versions | 3.4.0pip install --upgrade 'nicegui==3.4.0' |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for nicegui, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update nicegui to 3.4.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2025-66645 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2025-66645 can be triaged on real exposure rather than presence alone.
Tailored to CVE-2025-66645. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is CVE-2025-66645 in your dependencies?
O3 Security finds CVE-2025-66645 across PyPI dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.