Quick answers
- Is CVE-2026-40991 exploited in the wild?
- No. Junglewise Threat Intelligence has no report of CVE-2026-40991 being exploited in the wild.
- How severe is CVE-2026-40991?
- Medium severity, with a CVSS score of 5.9, published 10 June 2026.
- Which products and versions are affected?
- org.springframework.restdocs:spring-restdocs-restassured (Maven) ECOSYSTEM:introduced=4.0.0,fixed=4.0.1; org.springframework.restdocs:spring-restdocs-webtestclient (Maven) ECOSYSTEM:introduced=4.0.0,fixed=4.0.1; Spring REST Docs 4.0.0, 3.0.0 - 3.0.5, 2.0.0.RELEASE - 2.0.8.RELEASE; VMware Spring REST Docs 4.0.0, 3.0.0 through 3.0.5, 2.0.0.RELEASE through 2.0.8.RELEASE.
- Is there a fix for CVE-2026-40991?
- Yes. org.springframework.restdocs:spring-restdocs-restassured (Maven): upgrade to 4.0.1 or later; org.springframework.restdocs:spring-restdocs-webtestclient (Maven): upgrade to 4.0.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is CVE-2026-40991 attacked?
- It is attacked over the network, in a software library.
- Am I affected by CVE-2026-40991?
- Check whether you run org.springframework.restdocs:spring-restdocs-restassured (Maven), org.springframework.restdocs:spring-restdocs-webtestclient (Maven), Spring REST Docs or one of the others listed at an affected version. 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.
How to fix
- org.springframework.restdocs:spring-restdocs-restassured (Maven): upgrade to 4.0.1 or later
# set org.springframework.restdocs:spring-restdocs-restassured to 4.0.1 in your pom.xml or build.gradle - org.springframework.restdocs:spring-restdocs-webtestclient (Maven): upgrade to 4.0.1 or later
# set org.springframework.restdocs:spring-restdocs-webtestclient to 4.0.1 in your pom.xml or build.gradle
Technical details
Spring REST Docs (specifically the spring-restdocs-webtestclient and spring-restdocs-restassured modules) is vulnerable to XML External Entity (XXE) injection (CWE-611). The vulnerability occurs when the library processes XML responses from a remote API to generate documentation. An attacker who controls the target API can provide a malicious XML payload containing external entity references. When the documentation-generating tests are executed, the XML parser may resolve these entities, allowing the attacker to perform unauthorized data retrieval (such as local file disclosure) or server-side request forgery (SSRF). The attack requires the user to execute tests against a malicious or compromised endpoint. The issue is addressed in versions 3.0.6 and 4.0.1.
Affected products
- Spring Spring REST Docs 4.0.0, 3.0.0 - 3.0.5, 2.0.0.RELEASE - 2.0.8.RELEASE
Identifiers
- CVE-2026-40991
- GHSA-6rpq-6vv2-5222
Timeline
- 2026-06-09: patched: Versions 3.0.6 and 4.0.1 released
- 2026-06-10: disclosed: Initial advisory publication
- 2026-08-12: advisory: GitHub Advisory updated