Miggo Logo

CVE-2024-37301:
document-merge-service vulnerable to Remote Code Execution via Server-Side Template Injection

9.1

CVSS Score

Basic Information

EPSS Score
-
Published
6/11/2024
Updated
10/16/2024
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
document-merge-servicepip< 6.5.26.5.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stemmed from using jinja2.Environment instead of SandboxedEnvironment. The commit diff shows the patching involved switching to SandboxedEnvironment, which restricts access to unsafe operations. The original Environment implementation allowed template authors to traverse object hierarchies (via class, mro, subclasses) to reach dangerous functions, as demonstrated in the POC using subprocess.Popen for RCE.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

### Imp**t * r*mot* *o** *x**ution (R**) vi* s*rv*r-si** t*mpl*t* inj**tion (SSTI) *llows *or us*r suppli** *o** to ** *x**ut** in t** s*rv*r's *ont*xt w**r* it is *x**ut** *s t** *o*um*nt-m*r**-s*rv*r us*r wit* t** UI* *** t*us *ivin* *n *tt**k*r *

Reasoning

T** vuln*r**ility st*mm** *rom usin* jinj**.*nvironm*nt inst*** o* S*n**ox***nvironm*nt. T** *ommit *i** s*ows t** p*t**in* involv** swit**in* to S*n**ox***nvironm*nt, w*i** r*stri*ts ****ss to uns*** op*r*tions. T** ori*in*l *nvironm*nt impl*m*nt*ti