Drive-By Attack in Ollama Desktop v0.10.0
The Ollama desktop GUI's local web service accepted JSON POST requests without validating the Content-Type header, making them 'simple' requests that bypass CORS preflight. Any website could therefore reconfigure the app's Remote setting to point to an attacker-controlled server, intercepting all chats and serving poisoned models.
initblog.com
Published on initblog.com
Ollama is a popular local AI application that lets you run LLMs on your own machine. Many users choose it to keep their AI conversations private, without sending data to third parties.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The local web service did not validate the Content-Type header on JSON POST requests, so they were treated as simple requests and skipped the CORS preflight check.
Impact
Every chat message could be logged remotely and every AI response could be modified in real time, and the attacker's models could be poisoned with custom system prompts.
What the attacker needed
Victim visits a malicious website; Ollama desktop GUI running; attacker server with GPU
The fix
The vulnerability was fixed in version 0.10.1 by adding stronger security controls.
How it was found
- Scan local ports 40000-65535 to find the GUI's random port
- Send a simple POST request to the settings endpoint to set a malicious Remote server
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Ollama is a desktop app that runs AI models locally. It also runs a small web server on your computer, and your browser can talk to it. The server didn't check a header that browsers use to protect against cross-site requests, so any website you visited could silently change your app's settings to send your chats to someone else.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.