CVE-2024-39720: Github.com/ollama/ollama Ollama Out-of-bounds Read Vulnerability

HIGH
Advisory Identifier: GHSA-95j2-w8x7-hm88
CVSS 8.2
CWE-125
Published
Advisory Summary

CVE-2024-39720 is a HIGH (CVSS 8.2) ollama out-of-bounds read vulnerability (CWE-125: Out-of-bounds Read) affecting Github.com/ollama/ollama libraries in the Go ecosystem. The issue involves ollama out-of-bounds read. Remediation is available by upgrading affected packages to version 0.1.46.

CVE-2024-39720 at a Glance

CVE Identifier CVE-2024-39720
GHSA Identifier GHSA-95j2-w8x7-hm88
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-125: Out-of-bounds Read
Affected Product Github.com/ollama/ollama
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2024-39720

To remediate this vulnerability, upgrade all affected Github.com/ollama/ollama dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/ollama/ollama fixed: 0.1.46
Upgrade github.com/ollama/ollama to 0.1.46
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/ollama/ollama

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-39720, inspect your project dependencies for Github.com/ollama/ollama:

inspect dependencies for github.com/ollama/ollama

Analyze the terminal output to locate any version of Github.com/ollama/ollama in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.1.46), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-125: Out-of-bounds Read, where the product reads data past the end, or before the beginning, of the intended buffer. In Github.com/ollama/ollama, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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).

CVE-2024-39720 Affected Github.com/ollama/ollama Versions

1 component(s)
Fixed Versions:
0.1.46
Product / Package Ecosystem Affected Versions Fixed Version
github.com/ollama/ollama
Go
< 0.1.46
0.1.46

References

Frequently Asked Questions

What is CVE-2024-39720?
CVE-2024-39720 is a security vulnerability in Github.com/ollama/ollama involving Ollama Out-of-bounds Read under CWE-125: Out-of-bounds Read.
Which Github.com/ollama/ollama versions are affected?
Affected versions include releases prior to 0.1.46 across affected packages: github.com/ollama/ollama.
What version fixes CVE-2024-39720?
Upgrading to 0.1.46 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/ollama/ollama affected?
Yes, github.com/ollama/ollama is affected in releases prior to 0.1.46. Upgrade your dependency to 0.1.46 or later.
What is the CVSS score of CVE-2024-39720?
CVE-2024-39720 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H.
What CWE is associated with CVE-2024-39720?
CVE-2024-39720 is classified under CWE-125: Out-of-bounds Read (The product reads data past the end, or before the beginning, of the intended buffer.).
How can I check Go dependencies for CVE-2024-39720?
Run the dependency tree command: 'inspect dependencies for github.com/ollama/ollama'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-95j2-w8x7-hm88",
  "modified" : "2024-12-12T18:01:01Z",
  "published" : "2024-10-31T21:31:45Z",
  "aliases" : [ "CVE-2024-39720" ],
  "summary" : "Ollama Out-of-bounds Read",
  "details" : "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).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/ollama/ollama"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.1.46"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39720"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ollama/ollama"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ollama/ollama/compare/v0.1.45...v0.1.46#diff-782c2737eecfa83b7cb46a77c8bdaf40023e7067baccd4f806ac5517b4563131L417"
  }, {
    "type" : "WEB",
    "url" : "https://oligo.security/blog/more-models-more-probllms"
  }, {
    "type" : "WEB",
    "url" : "https://oligosecurity.webflow.io/blog/more-models-more-probllms"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2024-3245"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-125" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-04T23:22:24Z",
    "nvd_published_at" : "2024-10-31T20:15:04Z"
  }
}