total.js@3.4.6-5 vulnerabilities

MVC framework for Node.js

Direct Vulnerabilities

Known vulnerabilities in the total.js package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • C
Arbitrary Code Execution

total.js is a framework for Node.js platfrom written in pure JavaScript similar to PHP's Laravel or Python's Django or ASP.NET MVC. It can be used as web, desktop, service or IoT application.

Affected versions of this package are vulnerable to Arbitrary Code Execution via the U.set() and U.get() functions.

PoC by Alessio Della Libera

const total = require('total.js');
U.set({}, 'a;let {mainModule}=process; let {require}=mainModule; let {exec}=require("child_process"); exec("touch HACKED")//');

NOTE: This vulnerability has also been identified as: CVE-2021-32831

How to fix Arbitrary Code Execution?

Upgrade total.js to version 3.4.9 or higher.

<3.4.9
  • C
Arbitrary Code Execution

total.js is a framework for Node.js platfrom written in pure JavaScript similar to PHP's Laravel or Python's Django or ASP.NET MVC. It can be used as web, desktop, service or IoT application.

Affected versions of this package are vulnerable to Arbitrary Code Execution via the U.set() and U.get() functions.

PoC by Alessio Della Libera

const total = require('total.js');
U.set({}, 'a;let {mainModule}=process; let {require}=mainModule; let {exec}=require("child_process"); exec("touch HACKED")//');

NOTE: This vulnerability has also been identified as: CVE-2021-23389

How to fix Arbitrary Code Execution?

Upgrade total.js to version 3.4.9 or higher.

<3.4.9
  • C
Remote Code Execution (RCE)

total.js is a framework for Node.js platfrom written in pure JavaScript similar to PHP's Laravel or Python's Django or ASP.NET MVC. It can be used as web, desktop, service or IoT application.

Affected versions of this package are vulnerable to Remote Code Execution (RCE) via set.

PoC

// To be run in a nodejs console:
require('total.js/utils').set({},'a;eval(`require("child_process")\\x2eexecSync("touch pwned")`);//')

How to fix Remote Code Execution (RCE)?

Upgrade total.js to version 3.4.8 or higher.

<3.4.8
  • H
Prototype Pollution

total.js is a framework for Node.js platfrom written in pure JavaScript similar to PHP's Laravel or Python's Django or ASP.NET MVC. It can be used as web, desktop, service or IoT application.

Affected versions of this package are vulnerable to Prototype Pollution. The set function can be used to set a value into the object according to the path. However the keys of the path being set are not properly sanitized, leading to a prototype pollution vulnerability. The impact depends on the application. In some cases it is possible to achieve Denial of service (DoS), Remote Code Execution or Property Injection.

PoC

const total = require('total.js');
let obj = {};
console.log("Before : " + obj.polluted);
U.set({}, '__proto__.polluted', "yes");
console.log("After : " + obj.polluted);

How to fix Prototype Pollution?

Upgrade total.js to version 3.4.7 or higher.

<3.4.7
  • H
Command Injection

total.js is a framework for Node.js platfrom written in pure JavaScript similar to PHP's Laravel or Python's Django or ASP.NET MVC. It can be used as web, desktop, service or IoT application.

Affected versions of this package are vulnerable to Command Injection. The issue occurs in the image.pipe and image.stream functions. The type parameter is used to build the command that is then executed using child_process.spawn. The issue occurs because child_process.spawn is called with the option shell set to true and because the type parameter is not properly sanitized.

PoC

const total = require('total.js');
let image = Image.load("");
let payload = ";touch HACKED;";
image.stream(payload);
// image.pipe(null, payload);

How to fix Command Injection?

Upgrade total.js to version 3.4.7 or higher.

<3.4.7
  • H
Improper Access Control

total.js is a framework for Node.js platfrom written in pure JavaScript similar to PHP's Laravel or Python's Django or ASP.NET MVC. It can be used as web, desktop, service or IoT application.

Affected versions of this package are vulnerable to Improper Access Control. An authenticated user with limited privileges can get access to a resource that they do not own by calling the associated API. The application correctly manages privileges only for the front-end resource path, and not for API requests. This leads to vertical and horizontal privilege escalation.

How to fix Improper Access Control?

There is no fixed version for total.js.

>=3.1.0
  • H
Improper Authentication

total.js is a framework for Node.js platfrom written in pure JavaScript similar to PHP's Laravel or Python's Django or ASP.NET MVC. It can be used as web, desktop, service or IoT application.

Affected versions of this package are vulnerable to Improper Authentication via cookie enumeration. A low privilege user can perform a simple transformation of a cookie to obtain the random values inside it. If an attacker can discover a session cookie owned by an admin, then it is possible to brute force it with O(n)=2n instead of O(n)=n^x complexity, and steal the admin password.

How to fix Improper Authentication?

There is no fixed version for total.js.

>=3.1.0
  • H
Remote Code Execution (RCE)

total.js is a framework for Node.js platfrom written in pure JavaScript similar to PHP's Laravel or Python's Django or ASP.NET MVC. It can be used as web, desktop, service or IoT application.

Affected versions of this package are vulnerable to Remote Code Execution (RCE). It is possible for an attacker to create a malicious widget with a special tag containing JavaScript code which will then be evaluated application.

PoC by Riccardo Krauter

<script total>global.process.mainModule.require(child_process).exec(RCE);</script>.

How to fix Remote Code Execution (RCE)?

There is no fixed version for total.js.

>=3.1.0