Remote Code Execution Vulnerability in Node.js EJS Package (CVE-2017-1000228)

node-ejs Updated 02 Oct 2025

Summary

17/11/2017
N/A
Yes i
Critical
9.8

CVE-2017-1000228: nodejs ejs versions older than 2.5.3 is vulnerable to remote code execution due to weak input validation in ejs.renderFile() function. Affects node-ejs across 2 version ranges.

< 2.5.7-1 < 89f006525f018ee4bd62b3d7527c81196cd7bea6

Fixed in 2.5.7-1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

EJS (Embedded JavaScript) is a templating engine that allows developers to generate HTML markup with plain JavaScript. It is widely used in Node.js applications for rendering views. The EJS package provides features such as template inheritance, partials, and includes, making it a popular choice for web developers. However, certain versions of EJS prior to 2.5.3 are susceptible to a critical vulnerability that can lead to remote code execution due to insufficient input validation.

Vulnerability Detail

The vulnerability identified as CVE-2017-1000228 arises from weak input validation in the ejs.renderFile() function. This flaw allows an attacker to execute arbitrary code on the server by manipulating the input to this function. If exploited, this vulnerability can lead to severe consequences, including unauthorized access to sensitive data, complete system compromise, and potential damage to the application’s integrity. The CVSS score for this vulnerability is 9.8, indicating a critical level of severity.

How To Fix

Minimum fixed version

2.5.7-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-ejs

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading is not immediately possible, a temporary workaround is to implement strict input validation in your application before passing data to the ejs.renderFile() function. This can help mitigate the risk of code execution by ensuring that only safe and expected inputs are processed.

Conclusion

The CVE-2017-1000228 vulnerability in the EJS package poses a significant risk to applications using affected versions. It is crucial for developers to upgrade to the latest version to protect their applications from potential exploitation. Regular monitoring and vulnerability assessment using tools like Vulert can help maintain application security.

See every vulnerability recorded for node-ejs →

Share this vulnerability

FAQ

CVE-2017-1000228 is a vulnerability in the EJS templating engine that allows for remote code execution due to weak input validation.

EJS versions older than 2.5.3 are vulnerable to this issue.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Exploitation of this vulnerability can lead to unauthorized access, data breaches, and complete system compromise.

The recommended action is to upgrade to EJS version 2.5.7 or later to eliminate the vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for node-ejs.

How To Fix

Minimum fixed version

2.5.7-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-ejs

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback