CVE-2026-40991

XML External Entity (XXE) injection when documenting untrusted XML content

Published Jun 9, 2026 CVSS 3.1 · 5.9 Medium EPSS < 1% KEV · Not listed
Description
When using spring-restdocs-webtestclient or spring-restdocs-restassured to document a remote API accessed over HTTP, an attacker who compromises the API or tricks the user into documenting a malicious API can perform an XXE injection attack when the documentation-generating tests are next executed.

Affected versions:
Spring REST Docs 4.0.0; 3.0.0 through 3.0.5; 2.0.0.RELEASE through 2.0.8.RELEASE.

Analysis

AI-generated

Technical impact

The vulnerability allows an attacker who controls or can trick the documentation generation process into processing malicious XML to inject external entities. When the documentation tests for a remote API are run, these entities can resolve to local files or external resources, potentially leaking sensitive content. The flaw is a classic XML External Entity (XXE) injection, classified as CWE‑611, and can lead to confidentiality compromises. Based on the description, it is inferred that the attack can expose sensitive internal files or network resources through crafted XML.

Affected Systems

Spring REST Docs for the module spring-restdocs-webtestclient and spring-restdocs-restassured is affected. The issue exists in Spring REST Docs versions 2.0.0.RELEASE through 2.0.8.RELEASE, 3.0.0 through 3.0.5, and 4.0.0. Systems using these versions that document remote APIs over HTTP are susceptible.

Risk and Exploitability

The CVSS score of 5.9 indicates moderate severity; the EPSS score is not available, and the vulnerability is not listed in the CISA KEV catalog, suggesting no currently known widespread exploitation. The attack requires the attacker to either compromise the remote API or coerce a user into having the documentation tests run against a malicious API. It is primarily an environment‑based threat that can be invoked when the documentation generator processes untrusted XML. The likely attack vector is inferred as the execution of documentation tests against an attacker‑controlled or maliciously crafted API.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Spring REST Docs to the latest available release that removes the XXE flaw.
  • Remove spring-restdocs-webtestclient and spring-restdocs-restassured from production environments that may expose XML to untrusted sources.
  • Validate or sanitize XML before feeding it into the documentation generator, ensuring external entities are disabled.

Generated by OpenCVE AI on June 10, 2026 at 01:53 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-6rpq-6vv2-5222 Spring REST Docs REST Assured & WebFlux are vulnerable to Improper Restriction of XML External Entity Reference
References
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Spring
Spring spring Rest Docs
Vendors & Products Spring
Spring spring Rest Docs
Type Values Removed Values Added
Description When using spring-restdocs-webtestclient or spring-restdocs-restassured to document a remote API accessed over HTTP, an attacker who compromises the API or tricks the user into documenting a malicious API can perform an XXE injection attack when the documentation-generating tests are next executed. Affected versions: Spring REST Docs 4.0.0; 3.0.0 through 3.0.5; 2.0.0.RELEASE through 2.0.8.RELEASE.
Title XML External Entity (XXE) injection when documenting untrusted XML content
Weaknesses CWE-611
References
Metrics cvssV3_1

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

Weaknesses
  • CWE-611

    Improper Restriction of XML External Entity Reference

Sources

Status
PUBLISHED
Assigner
vmware
Published
Updated
Jun 27, 2026, 9:10 PM
Reserved
Apr 16, 2026, 2:19 AM
Status
Analyzed
Published
Jun 10, 2026, 12:16 AM
Modified
Jul 23, 2026, 9:10 AM