NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Ollama

CVE-2024-39720: Ollama Out-of-bounds Read

highCVSS 4.0 8.8 · 3.1 8.2GHSA-95j2-w8x7-hm88

Ollama before 0.1.46 can be crashed by an unauthenticated attacker with two HTTP requests. A 4-byte malformed GGUF file that only holds the magic header, used as the FROM blob of a model creation request, triggers an out-of-bounds read and a SIGSEGV in the server. Upgrade to Ollama 0.1.46.

Published Oct 31, 2024 · Updated Dec 12, 2024 · Analysis Nov 1, 2026

What an attacker can do

Ollama's model creation route reads the GGUF file that a Modelfile FROM line points to. A GGUF file that is only the 4-byte magic header makes the parser read past the end of the data, and the server dies with a segmentation fault (signal SIGSEGV: segmentation violation).

The attack uses two requests. First the attacker uploads the tiny blob through the blobs endpoint. Then they call POST /api/create with a Modelfile whose FROM statement names that blob. The advisory data lists no privileges and no user interaction, so any client that can reach the API can do this.

The result is denial of service. The CVSS vectors show high availability impact and low confidentiality impact. Anything that depends on that Ollama server, such as coding assistants, agents and chat front ends, stops until the process is restarted. The attacker can repeat the call after each restart. Oligo Security, which found the bug, estimated about 10,000 internet-facing Ollama servers when it published.

Who is affected

Ollama 0.1.45 and earlier, that is every release before 0.1.46. The risk is highest where the Ollama API is reachable from untrusted networks. Check the version:

ollama --version

For Go module consumers, use go list -m github.com/ollama/ollama.

github.com/ollama/ollama

Ecosystem
Go
Affected
< 0.1.46
Fixed in
0.1.46
Check
go list -m github.com/ollama/ollama

How to fix it

Upgrade to Ollama 0.1.46 or later. Oligo reports the maintainers fixed the denial-of-service issues on 9 June 2024. Replace the binary or image with a current release, then restart the service. As an extra measure, do not expose the Ollama API to untrusted networks; restrict it with a firewall or an authenticating reverse proxy.

How to tell if you were hit

Look for the Ollama process exiting with a segmentation fault or a SIGSEGV trace in its logs or in the systemd journal, shortly after a POST to /api/create. Oligo gives one indicator: a blob with SHA-256 b83633aa785344791618f2fddf131b010ea04912a60430760b070bad293f65bd in the Ollama blobs directory means the malicious blob was uploaded. Check access logs of any proxy for blob uploads and create requests from unknown addresses.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

An issue was discovered in Ollama before 0.1.46. An attacker can use two HTTP requests to upload a malformed GGUF file containing just 4 bytes starting with the GGUF custom magic header. By leveraging a custom Modelfile that includes a FROM statement pointing to the attacker-controlled blob file, the attacker can crash the application through the CreateModel route, leading to a segmentation fault (signal SIGSEGV: segmentation violation).

Questions

Does CVE-2024-39720 allow code execution?

No. The sources describe an out-of-bounds read that crashes the server with a segmentation fault. The impact is denial of service.

Do I need credentials to exploit it?

No. The advisory data lists no privileges and no user interaction. Anyone who can reach the API can send the two requests.

Which version fixes it?

0.1.46. Oligo says Ollama 0.1.45 and earlier is vulnerable.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Ollama vulnerabilities

All Ollama entries