CVE-2026-42138

Dify Vulnerable to Stored XSS via SVG-file upload

Published May 4, 2026 CVSS 4.0 · 6.9 Medium EPSS < 1% KEV · Not listed
Description
Dify is an open-source LLM app development platform. Prior to version 1.13.1, using the method POST /api/files/upload, any unauthenticated user can upload an SVG file with XSS. The method POST /v1/files/upload, which requires authentication through the application API, is also vulnerable. This issue has been patched in version 1.13.1.

Analysis

AI-generated

Technical impact

The vulnerability allows an attacker to upload any SVG file that contains malicious embedded scripts without sanitization. When a user opens or views the uploaded SVG, the script executes in that user’s browser session, enabling the attacker to run arbitrary JavaScript in the context of the hosting web application. This can lead to theft of session cookies, defacement, credential theft, or redirection to phishing sites, as the injected code has the same privileges as the victim’s browser. The weakness is identified as CWE‑79, a flaw involving improper handling of untrusted script content.

Affected Systems

All installations of the langgenius Dify platform running versions earlier than 1.13.1 are affected. Both the publicly accessible file upload endpoint POST /api/files/upload and the authenticated API endpoint POST /v1/files/upload are vulnerable, so guests and authenticated users alike can upload malicious SVGs that are later stored and served back to users.

Risk and Exploitability

With a CVSS score of 6.9 the flaw is considered moderate in severity. No EPSS score is available and the issue is not listed in the CISA KEV catalog. The likely attack vector is an unauthenticated or authenticated web or API request over the network; an attacker can simply upload a crafted SVG file and then entice or force a victim to view the file, thereby triggering the stored XSS payload.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Dify to version 1.13.1 or later to apply the vendor patch.
  • Restrict file uploads so that only authenticated users can upload files, and consider disabling SVG uploads entirely.
  • Implement server‑side SVG sanitization that removes or neutralises <script> elements and other executable content, or apply a strict Content‑Security‑Policy that blocks inline scripts.

Generated by OpenCVE AI on May 4, 2026 at 18:51 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
CPEs cpe:2.3:a:langgenius:dify:*:*:*:*:*:node.js:*:*
Metrics cvssV3_1

{'score': 6.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N'}

Type Values Removed Values Added
First Time appeared Langgenius
Langgenius dify
Vendors & Products Langgenius
Langgenius dify
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description Dify is an open-source LLM app development platform. Prior to version 1.13.1, using the method POST /api/files/upload, any unauthenticated user can upload an SVG file with XSS. The method POST /v1/files/upload, which requires authentication through the application API, is also vulnerable. This issue has been patched in version 1.13.1.
Title Dify Vulnerable to Stored XSS via SVG-file upload
Weaknesses CWE-79
References
Metrics cvssV4_0

{'score': 6.9, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N'}

Weaknesses
  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
May 4, 2026, 6:48 PM
Reserved
Apr 24, 2026, 5:15 PM
Status
Analyzed
Published
May 4, 2026, 6:16 PM
Modified
Oct 26, 2026, 7:10 PM