WaratekVRT Sign in

CVE-2026-40991 Spring REST Docs

Affected softwareSpring REST Docs
Severity5.9 Medium CVSS 3.1
Fixed in4.0.1, 3.0.6
WeaknessXML external entity (XXE) (CWE-611)
Published10 Jun 2026
Updated23 Jul 2026

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.

Exploitation status

No public exploit

No exploit has been reported in the sources we check.

  • CISA KEV not listed
  • VulnCheck KEV not listed
  • CISA Vulnrichment exploitation: none
  • Indexed PoC none indexed
  • EPSS 0.22% chance in 30 days

Waratek protection

Protected by Waratek

Waratek has a rule that blocks attacks on this vulnerability.

  • Protection full XXE
  • Action available security rule
  • Review automated Inferred
  • Record active
Decided by A vulnerability class already blocked by an ARMR security rule
Finding Protected by Waratek's ARMR xxe security rule, which blocks this class of attack at the JVM level without a rule written for this CVE specifically. The CVE's weakness is CWE-611: XML External Entity Reference.

How to mitigate CVE-2026-40991

Upgrade Spring REST Docs to a release that fixes it: 4.0.1 or 3.0.6. Until you can, Waratek RASP blocks exploitation with its XXE rule. It runs inside the Java application, with no code changes.

Waratek RASP Runtime protection for Java applications

Affected software and releases

Maven packages

Affected and fixed versions, from OSV.dev
PackageIntroducedFixedLast affected
org.springframework.restdocs:spring-restdocs-webtestclient 4.0.0 4.0.1 unbounded
org.springframework.restdocs:spring-restdocs-webtestclient 3.0.0 3.0.6 unbounded
org.springframework.restdocs:spring-restdocs-webtestclient 0 none 2.0.8.RELEASE
org.springframework.restdocs:spring-restdocs-restassured 4.0.0 4.0.1 unbounded
org.springframework.restdocs:spring-restdocs-restassured 3.0.0 3.0.6 unbounded
org.springframework.restdocs:spring-restdocs-restassured 0 none 2.0.8.RELEASE

Products and versions

3 products, 9 version entries
SourceVendorProductSchemeAffected versions
nvd broadcom spring rest docs generic ≥ 2.0.0 and < 2.0.9 · ≥ 3.0.0 and < 3.0.5.1 · 4.0.0
osv org.springframework.restdocs spring-restdocs-restassured generic ≤ 2.0.8 · ≥ 3.0.0 and < 3.0.6 · ≥ 4.0.0 and < 4.0.1
osv org.springframework.restdocs spring-restdocs-webtestclient generic ≤ 2.0.8 · ≥ 3.0.0 and < 3.0.6 · ≥ 4.0.0 and < 4.0.1

References

URLTags
https://github.com/spring-projects/spring-restdocs PACKAGE
https://github.com/spring-projects/spring-restdocs/releases/tag/v3.0.6 WEB
https://github.com/spring-projects/spring-restdocs/releases/tag/v4.0.1 WEB
https://spring.io/security/cve-2026-40991 WEB

Timeline

Published2026-06-10By the CVE Program.
NVD record modified2026-07-23NVD's own last-modified date for this record.