ejs template injection vulnerability
The ejs (aka Embedded JavaScript templates) package 3.1.6 for Node.js allows server-side template injection in settings[view options][outputFunctionName]. This is parsed as an internal option, and overwrites the outputFunctionName option with an arbitrary OS command (which is executed upon template compilation).
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| npm package | ejs | < 3.1.7 | 3.1.7 |
References
- https://nvd.nist.gov/vuln/detail/CVE-2022-29078
- https://github.com/mde/ejs/commit/15ee698583c98dadc456639d6245580d17a24baf
- https://eslam.io/posts/ejs-server-side-template-injection-rce
- https://github.com/mde/ejs
- https://github.com/mde/ejs/releases
- https://security.netapp.com/advisory/ntap-20220804-0001
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H- Weakness (CWE)
CWE-74- Platform
- npm
- Package
ejs- Disclosed
- 26.04.2022
- Updated
- 11.10.2026 10:22
Sources and licenses
OSV / GitHub Advisory Database - GHSA-phwq-j96m-2c2q - CC BY 4.0
Vulnerability history: ejs
All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 5
- First → latest
- 11.2017 04.2024
- Without a fix
- 0
- Exploited in attacks
- 0
Severity breakdown
- Critical 2
- High 1
- Medium 2
Disclosures per year
- 2017: 2
- 2018: 1
- 2019: 0
- 2020: 0
- 2021: 0
- 2022: 1
- 2023: 0
- 2024: 1
- 2025: 0
- 2026: 0
-
ejs template injection vulnerability this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.