CVE-2024-45436: Ollama can extract members of a ZIP archive outside of the parent directory
7.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.96266%
CWE
Published
8/29/2024
Updated
8/29/2024
KEV Status
No
Technology
Go
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
github.com/ollama/ollama | go | < 0.1.47 | 0.1.47 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from the original implementation of extractFromZipFile
which directly used zip.File.Name
without path sanitization. The commit diff shows the addition of a path validation check using strings.HasPrefix(n, p)
to prevent parent directory escapes. The CVE description specifically names this function, and the patch adds both the security check and corresponding test cases to validate()
the fix. The vulnerable version joined user-controlled ZIP entry names with the target directory without normalization, enabling directory traversal attacks.