Critical RCE via Server-Side Template Injection in OpenSAGRES XDocReport
OpenSAGRES XDocReport is vulnerable to a critical server-side template injection (SSTI) flaw via the Apache Velocity engine, allowing unauthenticated remote code execution through malicious .docx uploads.
CVE search metadata
CVE search record: CVE-2026-38165. Severity: critical. CVSS: 9.8. EPSS: 0.60%. KEV: no. Product: XDocReport, Velocity. Brief: Critical RCE via Server-Side Template Injection in OpenSAGRES XDocReport. Brief link: https://feed.craftedsignal.io/briefs/2026-08-38165-xdocreport-ssti/
OpenSAGRES XDocReport contains a critical server-side template injection (SSTI) vulnerability, tracked as CVE-2026-38165, affecting the Apache Velocity engine integration. The flaw exists because the application fails to perform adequate input validation or filtering when rendering content from uploaded .docx files. An attacker can craft a malicious .docx document containing Velocity template expressions and upload it to an application that utilizes XDocReport for document processing. When the server processes the document, the malicious expressions are executed, leading to remote code execution (RCE) with the privileges of the web application service. This vulnerability poses a severe risk to any organization that accepts user-provided .docx files for server-side template processing, potentially resulting in full system compromise, sensitive data exfiltration, and unauthorized access to backend resources.
Attack Chain
- The attacker identifies an application that utilizes OpenSAGRES XDocReport for processing or rendering .docx files.
- The attacker crafts a malicious .docx document that incorporates Apache Velocity template syntax designed to execute system commands.
- The attacker navigates to the target application's file upload interface.
- The attacker uploads the weaponized .docx file to the application.
- The application triggers the XDocReport process to handle the document rendering.
- The Apache Velocity engine parses the embedded malicious template expressions without sanitization.
- The engine executes the injected expressions in the context of the server-side process, achieving remote code execution.
Impact
Successful exploitation of CVE-2026-38165 allows for unauthenticated remote code execution on the target server. This enables attackers to steal sensitive information, execute illegal system commands, modify or delete critical application files, and potentially gain full control over the host infrastructure. The vulnerability is rated with a CVSS score of 9.8, reflecting its high potential for total system compromise in affected environments.
Recommendation
- Identify all internal and external-facing applications utilizing the OpenSAGRES XDocReport library.
- Implement strict file upload validation policies that reject files containing suspicious template syntax or perform sandboxed processing of user-supplied documents.
- Monitor web server access logs for anomalous POST requests to document upload endpoints, specifically looking for payloads containing typical Velocity or Java-related keywords.
- Coordinate with vendors and developers to ensure the XDocReport library is updated to the latest secure version once a patch becomes available.
- Review application service account permissions to ensure the principle of least privilege is applied, minimizing the potential impact of a successful RCE.
Immediate actions
Inventory all applications using XDocReport
Mitigations
Restrict file uploads and implement input filtering
CVE-2026-38165