Skip to content
OpenAdvisories
Critical · 9.8 Scanner template Public exploit CVE-2022-29078 EUVD-2022-1801GHSA-phwq-j96m-2c2q

ejs template injection vulnerability

Published Apr 25, 2022 · Updated Aug 3, 2024 · Assigned by mitre

Description

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).

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 node-ejs 3.1.7-1 —
Debian 13 node-ejs 3.1.7-1 —
Debian 12 node-ejs 3.1.7-1 —
ReleasePackageFixed inAdvisory
Ubuntu 22.04 LTS node-ejs No fix yet —
Ubuntu 20.04 LTS node-ejs No fix yet —
Ubuntu 18.04 LTS node-ejs No fix yet —

Public exploits

Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.

Third-party code, not reviewed by us. Public PoCs are sometimes fake or contain malware. Read the code first and run it only in an isolated lab, against systems you are authorised to test.

GitHub 9 repositories

Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.

Automated scanner template

A ready-made Nuclei template detects this vulnerability automatically. Vulnerabilities with public scanner templates are typically probed across the internet soon after the template appears — exposed systems should be patched first.

Source: projectdiscovery/nuclei-templates (MIT) — updated daily. Only links are listed.

Affected packages

EcosystemPackageAffectedFixedRecord
npm ejs < 3.1.7 3.1.7 GHSA-phwq-j96m-2c2q

Advisories 1

References