# CVE-2025-61784: LLaMA Factory's Chat API has Critical SSRF and LFI Vulnerabilities

> Authenticated users can exploit SSRF and LFI in the Chat API to access internal networks and read arbitrary server files.

- **Severity:** High 7.6 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 7 Oct 2025
- **Updated:** 7 Oct 2025
- **Also known as:** GHSA-527m-2xhr-j27g, PYSEC-2026-1573

## What is CVE-2025-61784?

CVE-2025-61784 is a high-severity server-side request forgery vulnerability in hiyouga LLaMA-Factory, published on 7 Oct 2025. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

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.

Weakness: CWE-918 (Server-Side Request Forgery), CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2025-61784?

3 open source packages ship an affected version, including llamafactory. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `llamafactory` | PyPI | All versions | 0.9.4 |
| `llamafactory` | PyPI | All versions | 0.9.4 |
| `llamafactory` | PyPI | All versions | 0.9.4 |

Products: Hiyouga Llama-Factory.

## How do I fix CVE-2025-61784?

Upgrade llamafactory to 0.9.4 or later.

## Is CVE-2025-61784 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-61784 exists.

## Other vulnerabilities in hiyouga LLaMA-Factory

- [CVE-2026-58116](https://insights.sbomify.com/CVE-2026-58116/): LLaMA-Factory 0.9.5 Remote Code Execution via WebUI Model Path (critical 9.3)
- [CVE-2025-53002](https://insights.sbomify.com/CVE-2025-53002/): LLaMA-Factory Remote Code Execution (RCE) Vulnerability (high 8.3)
- [CVE-2024-52803](https://insights.sbomify.com/CVE-2024-52803/): LLama Factory Remote OS Command Injection Vulnerability (high 7.5)
- [CVE-2025-46567](https://insights.sbomify.com/CVE-2025-46567/): LLaMA-Factory Allows Arbitrary Code Execution via Unsafe Deserialization in Ilamafy_baichuan2.py (medium 6.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-61784 and fix it if it is affected.

What it is: CVE-2025-61784 is a high-severity server-side request forgery vulnerability in hiyouga LLaMA-Factory, published on 7 Oct 2025. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-61784 exists.

Affected packages and fixed versions:
- llamafactory (PyPI): affected all versions; fixed in 0.9.4
- llamafactory (PyPI): affected all versions; fixed in 0.9.4
- llamafactory (PyPI): affected all versions; fixed in 0.9.4

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-61784/ (Markdown: https://insights.sbomify.com/CVE-2025-61784/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-61784
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-61784
- OSV: https://osv.dev/vulnerability/CVE-2025-61784

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-61784/
Summaries are generated and may contain mistakes; the official description above is the record.
