EJS Template Injection Vulnerability

CVE-2022-29078

This demonstrates a critical Remote Code Execution (RCE) vulnerability in EJS versions prior to 3.1.7.

The vulnerability allows attackers to execute arbitrary JavaScript code through the outputFunctionName option, resulting in complete server compromise.

CVSS Score: 9.8 (Critical)

Vulnerability Type: Remote Code Execution (RCE)

Fixed Version: 3.1.7

Current Version: 2.6.1

Demonstration

Enter content to be rendered by the vulnerable EJS template engine:

Warning: A malicious value here can lead to code execution!

Result

Console Output:

No console output yet

Vulnerability status: Untested

About This Vulnerability

EJS (Embedded JavaScript templates) is a popular templating engine for Node.js applications that allows embedding JavaScript code within HTML templates.

CVE-2022-29078 is a vulnerability where the outputFunctionName option can be exploited to execute arbitrary code when rendering templates.

This vulnerability impacts a wide range of applications that use EJS templates and can lead to full server compromise if exploited successfully.