---
id: CVE-2026-58474
title: >-
  whichllm before 0.5.16 contains a code injection vulnerability in the run and
  snippet commands that allows a remote attacker who controls a HuggingFace
  repository to achieve arbitrary code execution by crafting a malicious GGUF
  filename …
summary: >-
  whichllm before 0.5.16 contains a code injection vulnerability in the run and
  snippet commands that allows a remote attacker who controls a HuggingFace
  repository to achieve arbitrary code execution by crafting a malicious GGUF
  filename …
severity: high
cvss: 8.8
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'
cwe:
  - CWE-94
published: '2026-08-26'
updated: '2026-09-24'
sourceUpdated: '2026-09-24T20:43:32.537'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-58474'
references:
  - url: >-
      https://github.com/Andyyyy64/whichllm/commit/77e8dc9e8b45212c694d631d758623e17a00859e
    label: disclosure@vulncheck.com
  - url: 'https://github.com/Andyyyy64/whichllm/pull/147'
    label: disclosure@vulncheck.com
  - url: 'https://github.com/Andyyyy64/whichllm/releases/tag/v0.5.16'
    label: disclosure@vulncheck.com
  - url: >-
      https://www.vulncheck.com/advisories/whichllm-code-injection-via-run-and-snippet-commands
    label: disclosure@vulncheck.com
tags:
  - nvd
epss: 0.00858
epssPercentile: 0.56628
ingestedAt: '2026-09-24T20:51:40.233Z'
---

## Overview

whichllm before 0.5.16 contains a code injection vulnerability in the run and snippet commands that allows a remote attacker who controls a HuggingFace repository to achieve arbitrary code execution by crafting a malicious GGUF filename containing double quotes or other special characters. The script generation function in cli.py interpolates HuggingFace-derived values, including GGUF variant filenames from the Hub API siblings rfilename field, directly into Python source code without escaping, allowing the crafted filename to break out of the generated string literal and execute injected code on the user's machine before any model download occurs.

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.
