Skip to main content

CVE-2025-0184: Langgenius Dify SSRF Vulnerability

CVE-2025-0184 is a Server-Side Request Forgery flaw in Langgenius Dify that allows attackers to make unauthorized server-side requests through malicious DOCX files. This article covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2025-0184 Overview

CVE-2025-0184 is a Server-Side Request Forgery (SSRF) vulnerability [CWE-918] in langgenius/dify, an open-source LLM application development platform. The flaw exists in version 0.10.2 within the Create Knowledge document upload workflow. When a user uploads a DOCX file containing an external relationship, the DOCX extractor fetches the reltype URL using the standard requests module instead of routing the call through the configured ssrf_proxy. Authenticated attackers can abuse this behavior to coerce the server into issuing arbitrary HTTP requests to internal network resources. The maintainers resolved the issue in version 0.11.0.

Critical Impact

Authenticated attackers can force the Dify backend to send HTTP requests to internal services, exposing confidential metadata endpoints, intranet applications, and cloud instance metadata.

Affected Products

  • langgenius dify version 0.10.2 and prior releases
  • Dify deployments running on Node.js runtime per cpe:2.3:a:langgenius:dify:*:*:*:*:*:node.js:*:*
  • Any self-hosted Dify instance exposing the Create Knowledge DOCX upload feature

Discovery Timeline

  • 2025-03-20 - CVE-2025-0184 published to the National Vulnerability Database
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-0184

Vulnerability Analysis

Dify provides a Knowledge Base feature that ingests user-supplied documents, including Microsoft Word DOCX files. The DOCX format is a ZIP archive containing XML parts that reference each other through relationship files (.rels). Each relationship entry carries a Type attribute (reltype) and a Target URL. External relationships can point to arbitrary HTTP(S) endpoints for embedded media.

The word_extractor.py module parses these relationships to retrieve external images and resources. In vulnerable versions, the extractor invokes the Python requests library directly against the attacker-controlled URL. Dify ships a dedicated ssrf_proxy helper that normally mediates outbound HTTP calls, enforcing allow-lists and blocking requests to loopback or link-local destinations. By bypassing this helper, the DOCX code path removes the only control preventing requests to internal network ranges.

Root Cause

The root cause is missing use of the sanctioned outbound HTTP wrapper. The extractor imported requests directly rather than core.helper.ssrf_proxy. No validation was applied to the reltype or Target values parsed from the uploaded DOCX, so any URL supplied by the attacker was passed unchanged to the HTTP client.

Attack Vector

An attacker with an authenticated account and permission to create a Knowledge Base uploads a crafted DOCX file. The archive contains a relationships XML part declaring an external relationship whose target is an internal URL, such as a cloud metadata service, an internal admin console, or a service running on 127.0.0.1. When Dify processes the document, the backend issues an HTTP GET to the attacker-chosen URL. Response data and timing side-channels can disclose internal service topology and sensitive content.

python
# Patch excerpt from api/core/rag/extractor/word_extractor.py
 from docx import Document as DocxDocument
 
 from configs import dify_config
+from core.helper import ssrf_proxy
 from core.rag.extractor.extractor_base import BaseExtractor
 from core.rag.models.document import Document
 from extensions.ext_database import db

Source: langgenius/dify commit c135ec4b

The patch introduces ssrf_proxy into the DOCX extractor and replaces direct requests calls with proxy-mediated calls that enforce Dify's SSRF controls.

Detection Methods for CVE-2025-0184

Indicators of Compromise

  • Outbound HTTP requests from the Dify backend process to RFC1918 ranges, 127.0.0.0/8, 169.254.169.254, or other cloud metadata endpoints shortly after a DOCX upload event
  • DOCX files whose word/_rels/document.xml.rels contain TargetMode="External" entries pointing to internal hostnames or IP literals
  • Unexpected entries in the Create Knowledge audit log followed by anomalous egress traffic from the Dify API container

Detection Strategies

  • Inspect uploaded DOCX files server-side and flag any external relationship whose target resolves to a private, loopback, or link-local address
  • Correlate Create Knowledge API calls with the backend container's outbound connection logs to surface requests that bypass the ssrf_proxy service
  • Hunt for the string requests.get( in deployed word_extractor.py files to confirm whether patched or vulnerable code is running

Monitoring Recommendations

  • Enable egress logging on the Dify application network and alert on connections to cloud instance metadata IPs or internal management interfaces
  • Route all outbound HTTP traffic from the Dify API through an explicit forward proxy and alert on direct connections that bypass it
  • Record file hashes and uploader identities for every document ingested by the Knowledge Base to support post-incident attribution

How to Mitigate CVE-2025-0184

Immediate Actions Required

  • Upgrade langgenius/dify to version 0.11.0 or later, which routes DOCX external relationship fetches through ssrf_proxy
  • Restrict Knowledge Base creation privileges to trusted users until the upgrade is complete
  • Block the Dify backend from reaching cloud metadata services and internal management networks at the network layer

Patch Information

The fix is delivered in commit c135ec4b08d946a1a1d3a198a1d72c1ccf47250f, included in release 0.11.0. The commit imports core.helper.ssrf_proxy in api/core/rag/extractor/word_extractor.py and replaces direct requests usage so external DOCX relationships are fetched through Dify's sanctioned outbound HTTP control. Review the upstream commit and the Huntr bounty submission for additional context.

Workarounds

  • Disable DOCX uploads in the Create Knowledge workflow until the patched release is deployed
  • Enforce an egress firewall policy that denies the Dify backend access to 169.254.169.254, 127.0.0.0/8, and internal RFC1918 ranges except for required services
  • Terminate IMDSv1 and require IMDSv2 with hop-limit 1 on AWS deployments to blunt metadata credential theft via SSRF
bash
# Upgrade a self-hosted Dify deployment to the patched release
cd dify/docker
git fetch --tags
git checkout 0.11.0
docker compose pull
docker compose up -d

# Verify the extractor is routed through ssrf_proxy
docker compose exec api grep -n "ssrf_proxy" \
  /app/api/core/rag/extractor/word_extractor.py

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.