Skip to main content

LLaMA-Factory CVE-2025-61784

HIGH
Path Traversal (CWE-22)
2025-10-07 security-advisories@github.com
8.1
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Authenticate to chat completions API
  2. Exploit
    Submit crafted image_url/video_url targeting internal resource
  3. Execution
    Server issues unvalidated HTTP GET or file read
  4. Impact
    Exfiltrate metadata credentials or internal service data

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Requires a reachable LLaMA-Factory API server (an opt-in deployment mode) exposing the public /v1/chat/completions endpoint, and the attacker must be able to submit multimodal chat content containing an image_url, video_url, or audio_url field. The advisory frames this as available to 'any authenticated user' (PR:L), so possession of a valid API bearer token is the gating factor - though in deployments launched without an API key configured, this endpoint may be effectively unauthenticated. No user interaction or non-default feature toggle is needed in vulnerable versions (<=0.9.3): the vulnerable _process_request path falls through to requests.get on any URL that is neither a base64 data URI nor an existing local file. Limiting factors: the server must be network-exposed, the attacker needs the API credential where one is set, and the 0.9.4 fix now gates local file access behind ALLOW_LOCAL_FILES plus a SAFE_MEDIA_PATH allowlist and blocks private/reserved IP addresses.

Impact

The provided CVSS 3.1 vector (AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N, base 8.1) describes a low-complexity, network-reachable flaw requiring only low-privilege authentication and no user interaction, which is internally consistent with the advisory's statement that 'any authenticated user' can trigger it. Publicly available exploit code exists: the GitHub Security Advisory (GHSA-527m-2xhr-j27g) includes a working PoC curl against /v1/chat/completions using the AWS metadata endpoint, which raises practical exploitability. This CVE is NOT in CISA KEV and no EPSS score was provided, so there is no evidence of widespread active exploitation - treat it as a credible, easily-exploited issue rather than a confirmed in-the-wild campaign. One signal to verify: the input vector rates I:H, but the underlying primitive is SSRF via requests.get(url, stream=True).raw (HTTP GET only) plus read-only LFI, which are predominantly confidentiality impacts; the high integrity rating likely reflects GET-triggered state changes on internal services and should be verified against the specific deployment's internal attack surface. Real priority is elevated for anyone exposing the LLaMA-Factory API server, because SSRF to cloud metadata (169.254.169.254) can yield credential theft, but the authentication precondition and the fact that the API server is an opt-in deployment mode temper any blanket urgency.

Exploit ScenarioDerived

An authenticated user (or anyone holding the API key, which may be absent in default deployments) sends a POST to /v1/chat/completions with a multimodal message whose image_url/video_url/audio_url points at an internal service such as the cloud metadata endpoint (http://169.254.169.254/...) or a local file path; the server dutifully fetches it via requests.get(url, stream=True).raw with no validation. A public PoC in the GHSA advisory demonstrates the AWS metadata SSRF path, and the same mechanism reads arbitrary local files.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.4% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Oct 08, 2026

Server-side request forgery and local file inclusion in LLaMA-Factory through 0.9.3 let a user of the public /v1/chat/completions endpoint force the server to issue arbitrary outbound HTTP requests and read files from the server's filesystem. The flaw sits in the multimodal media handling path of _process_request, which accepts image_url, video_url and audio_url fields and passes any value that is not a base64 data URI or an existing local file straight into requests.get() with no scheme, host or address validation; the advisory frames the attacker as 'any authenticated user' (PR:L), so a valid API bearer token is the gating factor, but deployments started without an API key leave the endpoint effectively reachable by anyone who can route to it. Publicly available exploit code exists (the advisory ships a curl payload aimed at the AWS instance metadata service), no CISA KEV entry is associated with this CVE, and the risk is rated 8.1 under CVSS 3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N, while the independently assessed vector scores integrity impact as none and treats confidentiality loss as the primary consequence.

RemediationAI

Vendor-released patch: upgrade to LLaMA-Factory 0.9.4 (for example, pip install --upgrade llamafactory==0.9.4) as documented in advisory GHSA-527m-2xhr-j27g, which applies the check_ssrf_url and check_lfi_path guards from commit 95b7188090a1018935c9dc072bfc97f24f1c96e9; upgrading fixes both the SSRF and the local file read because the two share one unvalidated code path. If an immediate upgrade is not possible, compensating controls are: always start the API server with an API key configured so the PR:L prerequisite is genuinely enforced, since the endpoint is effectively open when no key is set (trade-off: key management overhead and breakage for clients that expect unauthenticated access); keep the chat API off untrusted networks by binding it to localhost or a private interface and fronting it with a reverse proxy that restricts who can reach /v1/chat/completions (trade-off: reduces convenience for legitimate remote users); and apply network egress filtering so the serving host cannot reach RFC1918 ranges, loopback, link-local addresses such as the AWS/cloud metadata address 169.254.169.254, or internal admin planes (trade-off: legitimate third-party media URLs hosted on internal or split-horizon networks will fail to load). Running the API in a sandbox or container with a read-only root filesystem and only the intended media directory mounted provides additional containment for the LFI half of the issue. After upgrading, set ALLOW_LOCAL_FILES=0 to disable local media file access entirely and point SAFE_MEDIA_PATH at a dedicated directory if local media is not required; note that the ALLOW_LOCAL_FILES and SAFE_MEDIA_PATH controls ship with the 0.9.4 fix and are not available in 0.9.3 or earlier.

Affected Packages

pypi llamafactory fix: 0.9.4

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

LLaMA-Factory is a Python LLM fine-tuning and serving library that exposes an OpenAI-compatible chat API through FastAPI; the vulnerable code lives in src/llamafactory/api/chat.py, where _process_request inspects each multimodal input item and classifies a supplied media reference as a base64 data URI, a local file path (via os.path.isfile), or otherwise a 'web URI'. The final branch performs requests.get(url, stream=True).raw with no validation, and the result flows into create_chat_completion_response and create_stream_chat_completion_response, which are wired to the public /v1/chat/completions route in src/llamafactory/api/app.py. That is a classic CWE-918 server-side request forgery, and because the same unvalidated string can be a filesystem path the advisory also classifies it as CWE-22 path traversal / local file inclusion; the NVD-supplied CWE is CWE-22, reflecting the file-read angle. CPE data (cpe:2.3:a:hiyouga:llama-factory:*:*:*:*:*:*:*:*) covers all releases up to and including 0.9.3. The 0.9.4 fix adds two guards in src/llamafactory/api/common.py: check_ssrf_url() parses the URL, restricts it to http/https, resolves the hostname with socket.getaddrinfo and rejects any address where ipaddress.ip_address(ip).is_global is false, and check_lfi_path() realpath-resolves the target and requires it to sit under a SAFE_MEDIA_PATH allowlist, with local file access additionally governed by the ALLOW_LOCAL_FILES environment flag (default enabled). Both helpers are invoked for image_url, video_url and audio_url inputs, and violations raise HTTPException with 400/403 responses. Note that the address check is performed at validation time against a single resolved address, so deployments should still pair it with network-layer egress controls.

Know when Llama Factory gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

NVD PRIMARY 8.1 HIGH
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
vuln.today AI 6.5 MEDIUM

Network endpoint, trivial to trigger, requires an authenticated API user (PR:L); SSRF/LFI yields high confidentiality but GET-only fetches give no real integrity or availability impact.

3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
4.0 AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

DescriptionNVD

LLaMA-Factory is a tuning library for large language models. Prior to version 0.9.4, a Server-Side Request Forgery (SSRF) vulnerability in the chat API allows any authenticated user to force the server to make arbitrary HTTP requests to internal and external networks. This can lead to the exposure of sensitive internal services, reconnaissance of the internal network, or interaction with third-party services. The same mechanism also allows for a Local File Inclusion (LFI) vulnerability, enabling users to read arbitrary files from the server's filesystem. The vulnerability exists in the _process_request function within src/llamafactory/api/chat.py. This function is responsible for processing incoming multimodal content, including images, videos, and audio provided via URLs. The function checks if the provided URL is a base64 data URI or a local file path (os.path.isfile). If neither is true, it falls back to treating the URL as a web URI and makes a direct HTTP GET request using requests.get(url, stream=True).raw without any validation or sanitization of the URL. Version 0.9.4 fixes the underlying issue.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 1 pypi packages depend on llamafactory (1 direct, 0 indirect)

Ecosystem-wide dependent count for version 0.9.4.

Executive ViewAI

Why It Matters

LLaMA-Factory, an open-source large language model fine-tuning and serving framework deployed by teams to expose chat and multimodal inference APIs, contains a server-side request forgery and local file inclusion flaw in versions through 0.9.3 that allows an API caller to make the server retrieve arbitrary internal URLs and read files from its host. Because the affected media-handling path accepts unvalidated image, video, and audio URLs, an attacker holding a valid API token - or anyone at all where the endpoint was deployed without an API key - can pivot from a public chat endpoint into internal networks and cloud instance metadata, potentially exposing credentials, configuration, and sensitive files. Leadership should care because these deployments frequently run inside cloud environments with attached IAM roles and access to internal data stores, so a single reachable service can translate into broad credential compromise and data exposure.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.4%
Top 71% exploitable
Prevalence
Medium
popular open-source LLM tuning library, but exposed API-server mode is niche
Exploit
POC
Public exploit code exists
Data Quality
3 sources
Confidence: Low

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
Poc
System Exposure· derived
Open
Automatable· derived
No
Human Impact
High

Priority Score

60
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +40
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Server-Side Request Forgery exploits applications that fetch remote resources based on user-supplied URLs.

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

Affected Products (CPE)NVD

cpe:2.3:a:hiyouga:llama-factory:*:*:*:*:*:*:*:*

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy