CVE-2026-58474: Improper Control of Generation of Code ('Code Injection') in Andyyyy64 whichllm
Description
whichllm versions before 0.5.16 contain a code injection vulnerability in the run and snippet commands. This flaw allows a remote attacker controlling a HuggingFace repository to execute arbitrary code by crafting a malicious GGUF filename with special characters. The vulnerability arises because the script generation function in cli.py directly interpolates unescaped HuggingFace-derived values into Python source code, enabling code injection before any model download occurs.
CVSS v4.0
Score 8.6high
Affected software
Andyyyy64
whichllm
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2026-58474 is a code injection vulnerability in whichllm prior to version 0.5.16. The vulnerability exists in the run and snippet commands where the script generation function (cli.py) interpolates values derived from the HuggingFace Hub API, specifically GGUF variant filenames from the siblings rfilename field, directly into Python source code without proper escaping. An attacker controlling a HuggingFace repository can craft a malicious GGUF filename containing double quotes or other special characters to break out of the string literal context and inject arbitrary code. This code executes on the user's machine before any model download is initiated, allowing remote code execution.
Potential Impact
A remote attacker who controls a HuggingFace repository can exploit this vulnerability to achieve arbitrary code execution on the victim's machine without requiring privileges or user interaction beyond invoking the vulnerable commands. This can lead to full compromise of the affected system. The CVSS 4.0 score is 8.6 (high severity), reflecting the network attack vector, low complexity, no privileges required, but requiring user interaction and resulting in high confidentiality, integrity, and availability impact.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, users should avoid running the vulnerable run and snippet commands with untrusted HuggingFace repositories or GGUF filenames. Validate and sanitize inputs derived from external sources before use in code generation contexts.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- VulnCheck
- Date Reserved
- 2026-06-30T20:20:33.790Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 6a8f2b77acd9273b49385ca1
Added to database: 08/26/2026, 18:07:51 UTC
Last enriched: 09/09/2026, 17:07:32 UTC
Last updated: 10/10/2026, 18:48:20 UTC
Views: 94
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.