Skip to content

docx4j: Stack Overflow via Cyclic `w:basedOn` Style Chain leads to Denial of Service

High severity GitHub Reviewed Published Jul 7, 2026 in plutext/docx4j • Updated Aug 17, 2026

Package

maven org.docx4j:docx4j-core (Maven)

Affected versions

<= 11.5.13

Patched versions

11.5.14

Description

Summary

docx4j's PropertyResolver and several adjacent helpers recursively walk the OpenXML style inheritance chain (w:basedOn) without cycle detection.

A WordprocessingML document containing a cyclic style chain (for example, Style A based on B and Style B based on A) causes unbounded recursion and a java.lang.StackOverflowError within the property-resolution code path.

These helpers are used by operations that require effective style resolution, including common conversion and TOC-related paths. As a result, most server-side pipelines that accept a user-supplied docx and process it through docx4j can likely be crashed by a file containing a cyclic style reference.

Details

Representative snippet: PropertyResolver.fillPPrStack

private void fillPPrStack(String styleId, Stack<PPr> pPrStack) {
    Style style = liveStyles.get(styleId);
    ...
    // if it is based on, recurse
    if (style.getBasedOn() == null) {
        log.debug("Style " + styleId + " is a root style.");
    } else if (style.getBasedOn().getVal() != null) {
        String basedOnStyleName = style.getBasedOn().getVal();
        fillPPrStack(basedOnStyleName, pPrStack);   // ← unbounded recursion
        ...

Impact

This is a denial of service against a server-side application that processes untrusted docx files via docx4j.

An upload causes the processing thread to be terminated with StackOverflowError which may crash the worker thread, degrade the thread pool, or evade normal per-request CPU and heap-memory safeguards in containers and serverless functions (because the failure mode is thread-stack exhaustion rather than gradual resource consumption).

The attack depends on the host application's access controls and requires no user interaction beyond submitting the file. Detection is difficult because the file is a well-formed OOXML package containing ordinary style elements, and passes standard antivirus and content-inspection rules.

Severity: High for server-side applications that process untrusted DOCX files using docx4j style/property resolution (unless the application catches StackOverflowError, isolates conversion in disposable worker processes, restarts workers cleanly, and the practical impact is only failure of one request). Severity may be Medium where document upload requires authentication, processing is isolated, or the failure is limited to a single request/worker.

Credits

Thanks to Koh You Liang (@Isopach) for responsibly disclosing this issue.

References

@plutext plutext published to plutext/docx4j Jul 7, 2026
Published to the GitHub Advisory Database Aug 17, 2026
Reviewed Aug 17, 2026
Last updated Aug 17, 2026

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

EPSS score

Weaknesses

Uncontrolled Recursion

The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack. Learn more on MITRE.

Allocation of Resources Without Limits or Throttling

The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. Learn more on MITRE.

CVE ID

CVE-2026-53752

GHSA ID

GHSA-gc95-3vw8-vg43

Source code

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.