
This tool is designed to exploit CVE-2024-39722, a model existence disclosure vulnerability in Ollama versions up to and including 0.1.45. It allows users to check if an Ollama server is vulnerable and attempt to discover existing models on the server. Additionally, it can crawl the official Ollama model library to generate a list of potential models for testing. 中文
/api/push endpoint, an attacker can determine if a specific model (including custom models not in the public library) exists on the server.https://ollama.com/library).requestslxmltermcolorCVE_2024_39722.py.pip install requests lxml termcolor
python CVE_2024_39722.py [options]
-h, --help: Show the help message and exit.-u URL, --url URL: Target Ollama server URL (e.g., http://localhost:11434).-c, --crawl: Crawl Ollama models library and save them to links.json.-o OUTPUT, --output OUTPUT: Output file for results (default: results.json).-t THREADS, --threads THREADS: Number of threads to use for exploitation (default: 10).-v, --version-check: Only check if the target Ollama server is vulnerable based on its version.Show help:
python CVE_2024_39722.py -h
Crawl Ollama model library:
This will fetch model names from https://ollama.com/library and save them to links.json.
python CVE_2024_39722.py --crawl
Check if a target server is vulnerable:
python CVE_2024_39722.py -u http://localhost:11434 --version-check
Exploit a target server:
This will first check the server's version. If vulnerable, it will use the links.json (crawl if not present or use existing) to test for model existence.
python CVE_2024_39722.py -u http://localhost:11434
Exploit with a specific number of threads:
python CVE_2024_39722.py -u http://localhost:11434 -t 20
Exploit and save results to a custom file:
python CVE_2024_39722.py -u http://localhost:11434 -o discovered_models.json
This tool is intended for educational and authorized security testing purposes only. Do not use it on any system without explicit permission from the owner. The author is not responsible for any misuse or damage caused by this tool.