# CVE-2026-42138: LangGenius Dify stored XSS via SVG file upload

Source: https://junglewise.ai/threats/cve-2026-42138-langgenius-dify-stored-xss-via-svg-file-upload  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-04. Updated: 2026-05-11  
License: CC BY 4.0 with a link back

CVE-2026-42138 · Severity: medium · CVSS 6.1 · Published 2026-05-04

Dify, an open-source platform for developing Large Language Model (LLM) applications, is vulnerable to a security flaw that allows attackers to upload malicious files. By uploading a specially crafted SVG image containing hidden scripts, an attacker can execute code in the browser of other users who view the file. This could lead to unauthorized actions being performed on behalf of users, session theft, or the exposure of sensitive account information.

Technologies: [Langgenius Dify](https://junglewise.ai/threats/technologies/dify). Vendors: [Langgenius](https://junglewise.ai/threats/vendors/langgenius).

## Quick answers

**Is CVE-2026-42138 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-42138 being exploited in the wild.

**How severe is CVE-2026-42138?** Medium severity, with a CVSS score of 6.1, published 4 May 2026.

**Which products and versions are affected?** LangGenius Dify < 1.13.1.

**Is there a fix for CVE-2026-42138?** A patch was published on 2026-03-17: Version 1.13.1 released with fixes Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-42138 attacked?** It is attacked over the network, in a network appliance.

**Am I affected by CVE-2026-42138?** Check whether you run Langgenius Dify. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

A stored Cross-Site Scripting (XSS) vulnerability exists in Dify's file upload functionality. The application fails to properly sanitize or neutralize malicious JavaScript embedded within SVG files uploaded via the 'POST /api/files/upload' (unauthenticated) and 'POST /v1/files/upload' (authenticated) endpoints. When a victim accesses the 'source_url' returned after the upload, the embedded script executes within the context of the victim's browser session. This can be leveraged to steal session tokens from Local Storage or perform unauthorized API actions. The issue is resolved in version 1.13.1.

## Affected products

- LangGenius Dify < 1.13.1

## Timeline

- 2026-04-20: advisory: GitHub Security Advisory GHSA-cg94-8v83-7hjj published
- 2026-05-04: disclosed: CVE-2026-42138 published to NVD
- 2026-03-17: patched: Version 1.13.1 released with fixes

## References

- [https://github.com/langgenius/dify/releases/tag/1.13.1](https://github.com/langgenius/dify/releases/tag/1.13.1)
- [https://github.com/langgenius/dify/security/advisories/GHSA-cg94-8v83-7hjj](https://github.com/langgenius/dify/security/advisories/GHSA-cg94-8v83-7hjj)

## Related threats

- [langgenius dify hard-coded credentials in sandbox](https://junglewise.ai/threats/cve-2026-123135-a-vulnerability-was-found-in-langgenius-dify-up-to-1-18-0-2-0-0)
- [Dify authorization bypass in MCP server endpoint](https://junglewise.ai/threats/cve-2026-105761-dify-is-an-open-source-llm-app-development-platform-prior-to-1)
- [langgenius dify DOM-based XSS in redirect URL handler](https://junglewise.ai/threats/cve-2026-85022-langgenius-dify-dom-based-xss-in-redirect-url-handler)
- [langgenius Dify DOM-based XSS in splash.tsx redirect](https://junglewise.ai/threats/cve-2026-85021-langgenius-dify-dom-based-xss-in-splash-tsx-redirect)
- [LangGenius Dify server-side template injection in Jinja2 handler](https://junglewise.ai/threats/cve-2026-18632-langgenius-dify-server-side-template-injection-in-jinja2-handler)
