CVE-2024-39721: Ollama: DoS via /dev/random causes goroutine exhaustion
HIGH PoC AVAILABLE CISA: TRACK*Any Ollama instance with the model creation API network-accessible is vulnerable to unauthenticated denial of service with a single HTTP request. An attacker sets path=/dev/random to hang goroutines indefinitely; repeated requests exhaust the Go runtime and crash the inference service. Patch to Ollama 0.1.34+ immediately and bind the API to localhost behind an authenticated reverse proxy.
Risk Assessment
High risk for teams running Ollama as a shared inference service or in any configuration where port 11434 is reachable by untrusted clients. Ollama ships with no authentication by default, meaning exposure is widespread in practice. The attack requires zero credentials, zero AI/ML knowledge, and is automatable with a trivial shell script. The availability impact is total: the inference layer goes down, taking all dependent AI workflows with it.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| ollama | pip | — | No patch |
Do you use ollama? You're affected.
Severity & Risk
Attack Surface
Recommended Action
6 steps-
Patch: Upgrade Ollama to 0.1.34 or later immediately — this is the only complete fix.
-
Network isolation: Bind Ollama to localhost (OLLAMA_HOST=127.0.0.1) and never expose port 11434 to untrusted networks.
-
Authenticated proxy: If multi-user access is required, place Ollama behind nginx/Caddy with authentication.
-
Firewall: Apply ingress rules restricting Ollama API access to authorized internal IPs only.
-
Detection: Alert on HTTP POST requests to /api/create containing non-standard path values (especially /dev/*). Monitor goroutine count and memory metrics for the Ollama process — anomalous growth indicates active exploitation.
-
Rate limiting: Apply request rate limits on the /api/create endpoint as a short-term workaround before patching.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2024-39721?
Any Ollama instance with the model creation API network-accessible is vulnerable to unauthenticated denial of service with a single HTTP request. An attacker sets path=/dev/random to hang goroutines indefinitely; repeated requests exhaust the Go runtime and crash the inference service. Patch to Ollama 0.1.34+ immediately and bind the API to localhost behind an authenticated reverse proxy.
Is CVE-2024-39721 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2024-39721, increasing the risk of exploitation.
How to fix CVE-2024-39721?
1. Patch: Upgrade Ollama to 0.1.34 or later immediately — this is the only complete fix. 2. Network isolation: Bind Ollama to localhost (OLLAMA_HOST=127.0.0.1) and never expose port 11434 to untrusted networks. 3. Authenticated proxy: If multi-user access is required, place Ollama behind nginx/Caddy with authentication. 4. Firewall: Apply ingress rules restricting Ollama API access to authorized internal IPs only. 5. Detection: Alert on HTTP POST requests to /api/create containing non-standard path values (especially /dev/*). Monitor goroutine count and memory metrics for the Ollama process — anomalous growth indicates active exploitation. 6. Rate limiting: Apply request rate limits on the /api/create endpoint as a short-term workaround before patching.
What systems are affected by CVE-2024-39721?
This vulnerability affects the following AI/ML architecture patterns: model serving, LLM inference endpoints, agent frameworks, local AI development environments, RAG pipelines.
What is the CVSS score for CVE-2024-39721?
CVE-2024-39721 has a CVSS v3.1 base score of 7.5 (HIGH). The EPSS exploitation probability is 0.26%.
Technical Details
NVD Description
An issue was discovered in Ollama before 0.1.34. The CreateModelHandler function uses os.Open to read a file until completion. The req.Path parameter is user-controlled and can be set to /dev/random, which is blocking, causing the goroutine to run infinitely (even after the HTTP request is aborted by the client).
Exploitation Scenario
An adversary scans an AI team's internal network and discovers an exposed Ollama instance on port 11434 — common in dev environments where Ollama was installed with defaults. They send repeated unauthenticated POST requests to /api/create with the body {"name": "x", "path": "/dev/random"}. Each request spawns a goroutine that blocks indefinitely reading from the kernel entropy pool. After dozens of requests, Go's runtime is overwhelmed with blocked goroutines, memory is exhausted, and the Ollama process crashes or becomes unresponsive. All LLM-dependent services — agent orchestrators, internal chatbots, RAG pipelines — lose their inference backend simultaneously. The entire attack fits in a 5-line curl loop.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H References
- github.com/ollama/ollama/blob/9164b0161bcb24e543cba835a8863b80af2c0c21/server/routes.go Product
- github.com/ollama/ollama/blob/adeb40eaf29039b8964425f69a9315f9f1694ba8/server/routes.go Product
- oligo.security/blog/more-models-more-probllms Exploit 3rd Party
- github.com/fkie-cad/nvd-json-data-feeds Exploit
- github.com/wowtalon/LLM-Security Exploit
Timeline
Related Vulnerabilities
CVE-2025-63389 9.8 ollama: Missing Auth allows unauthenticated access
Same package: ollama CVE-2026-7482 9.1 Ollama: heap OOB read leaks API keys and chat data
Same package: ollama CVE-2026-44007 9.1 vm2: sandbox escape via nesting:true enables RCE
Same package: ollama CVE-2024-37032 8.8 Ollama: path traversal enables RCE via model blob API
Same package: ollama CVE-2024-39720 8.2 Ollama: OOB read in GGUF parser enables remote DoS
Same package: ollama
AI Threat Alert