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

CVE-2024-45436: Ollama can extract members of a ZIP archive outside of the parent directory

highCVSS 4.0 8.7 · 3.1 7.5GHSA-846m-99qv-67mg

Ollama before 0.1.47 can extract members of a ZIP archive outside the intended directory. The extractFromZipFile function in the server does not check where each entry lands, so a crafted archive can write files elsewhere on the host. Upgrade to Ollama 0.1.47.

Published Aug 29, 2024 · Analysis Nov 1, 2026

What an attacker can do

When Ollama imports a model from a ZIP archive, extractFromZipFile in server/model.go joined each archive entry name onto the target directory without checking the result. An entry name containing ../ therefore writes outside that directory (CWE-22, the classic zip slip). The write runs with the privileges of the Ollama process.

The CVSS vector rates it network-reachable with no privileges and no user interaction, because the Ollama API has no authentication by default. The impact it assigns is integrity only. An attacker who can get a crafted archive processed by the server can create or overwrite files the Ollama user can write, such as shell profiles, SSH authorized_keys, or service files, and that can be turned into code execution depending on the host. Containerized deployments limit the reach to the container.

An Ollama server exposed on a network beyond localhost, which is common for shared or agent-backed model hosts, is the exposed case. The advisory text itself is short and states no exploit chain beyond the extraction flaw.

Who is affected

The Go module github.com/ollama/ollama, versions below 0.1.47. Check the running version:

ollama --version

For a module dependency:

go list -m github.com/ollama/ollama

github.com/ollama/ollama

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

How to fix it

Upgrade to Ollama 0.1.47 or later. The fix, commit 123a722a6f541e300bc8e34297ac378ebe23f527 in pull request 5314, builds each destination with filepath.Join(p, f.Name). When the result does not start with the target directory, it skips the entry and logs "skipped extracting file outside of context". The sources name no workaround. Keep the Ollama API bound to localhost or behind authentication.

How to tell if you were hit

Check Ollama logs for the message "skipped extracting file outside of context", which shows patched versions blocking an attempt. On older versions, look for files created or changed outside Ollama's model directories around the time of a model create or import request, such as new entries in authorized_keys, shell startup files or cron directories. Review API access logs for model create requests from unknown clients.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

extractFromZipFile in model.go in Ollama before 0.1.47 can extract members of a ZIP archive outside of the parent directory.

Questions

Is Ollama 0.1.46 affected by CVE-2024-45436?

Yes. Every version below 0.1.47 is listed as vulnerable, and 0.1.47 contains the fix.

Does it need authentication?

The CVSS vector sets no privileges. Ollama's API has no built-in authentication, so reachability of the server decides who can try it.

Is it exploited in the wild?

No source reports exploitation, and it is not in CISA's KEV catalog.

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