gotois/ProstoDiary_bot

ProstoDiary: your personal all-in-one virtual assistant.

Vulnerabilities

2 via 26 paths

Dependencies

1020

Source

GitHub

Commit

7108aaf5

Find, fix and prevent vulnerabilities in your code.

Severity
  • 2
Status
  • 2
  • 0
  • 0

medium severity

Denial of Service (DoS)

  • Vulnerable module: jpeg-js
  • Introduced through: jimp@0.10.1

Detailed paths

  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c jimp@0.10.1 @jimp/types@0.10.3 @jimp/jpeg@0.10.3 jpeg-js@0.3.7
    Remediation: Upgrade to jimp@0.12.0.

Overview

Affected versions of this package are vulnerable to Denial of Service (DoS). The attacker could manipulate the exif data in the image file such as change the image pixel to 64250x64250pixels. If the module loaded the crafted image, it tries to allocate 4128062500 pixels into memory.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade jpeg-js to version 0.4.0 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: cheerio@1.0.0-rc.3, express-winston@4.0.3 and others

Detailed paths

  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c cheerio@1.0.0-rc.3 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c express-winston@4.0.3 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c jayson@3.2.0 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c oidc-provider@6.23.5 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c snyk@1.305.1 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c archiver@3.1.1 async@2.6.3 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c winston@3.2.1 async@2.6.3 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c mailparser@2.7.7 html-to-text@5.1.1 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c openapi-jsonrpc-jsdoc@1.0.3 jsdoc-x@4.0.3 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c snyk@1.305.1 @snyk/dep-graph@1.16.1 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c snyk@1.305.1 inquirer@6.5.2 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c snyk@1.305.1 snyk-config@2.2.3 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c snyk@1.305.1 snyk-mvn-plugin@2.9.0 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c snyk@1.305.1 snyk-nodejs-lockfile-parser@1.17.0 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c snyk@1.305.1 snyk-nuget-plugin@1.16.0 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c node-telegram-bot-api@0.40.0 request-promise@4.2.5 request-promise-core@1.1.3 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c slonik@22.4.4 inline-loops.macro@1.2.2 @babel/types@7.10.2 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c snyk@1.305.1 @snyk/dep-graph@1.16.1 graphlib@2.1.8 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c snyk@1.305.1 snyk-go-plugin@1.13.0 graphlib@2.1.8 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c snyk@1.305.1 snyk-nodejs-lockfile-parser@1.17.0 graphlib@2.1.8 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c snyk@1.305.1 snyk-nuget-plugin@1.16.0 dotnet-deps-parser@4.9.0 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c snyk@1.305.1 snyk-php-plugin@1.7.0 @snyk/composer-lockfile-parser@1.2.0 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c openapi-jsonrpc-jsdoc@1.0.3 jsdoc-x@4.0.3 jsdoc@3.6.4 catharsis@0.8.11 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c openapi-jsonrpc-jsdoc@1.0.3 jsdoc-x@4.0.3 jsdoc@3.6.4 requizzle@0.2.3 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.
  • Introduced through: prosto-diary@gotois/ProstoDiary_bot#7108aaf51d99c888145db04117e82889bc53844c slonik-interceptor-query-logging@1.3.8 slonik@22.4.10 inline-loops.macro@1.2.2 @babel/types@7.10.2 lodash@4.17.15
    Remediation: Open PR to patch lodash@4.17.15.

Overview

lodash is a modern JavaScript utility library delivering modularity, performance, & extras.

Affected versions of this package are vulnerable to Prototype Pollution. The function zipObjectDeep can be tricked into adding or modifying properties of the Object prototype. These properties will be present on all objects.

PoC

const _ = require('lodash');
_.zipObjectDeep(['__proto__.z'],[123])
console.log(z) // 123

Details

Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as _proto_, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.

There are two main ways in which the pollution of prototypes occurs:

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

The logic of a vulnerable recursive merge function follows the following high-level model:

merge (target, source)

  foreach property of source

    if property exists and is an object on both the target and the source

      merge(target[property], source[property])

    else

      target[property] = source[property]

<br>

When the source object contains a property named _proto_ defined with Object.defineProperty() , the condition that checks if the property exists and is an object on both the target and the source passes and the merge recurses with the target, being the prototype of Object and the source of Object as defined by the attacker. Properties are then copied on the Object prototype.

Clone operations are a special sub-class of unsafe recursive merges, which occur when a recursive merge is conducted on an empty object: merge({},source).

lodash and Hoek are examples of libraries susceptible to recursive merge attacks.

Property definition by path

There are a few JavaScript libraries that use an API to define property values on an object based on a given path. The function that is generally affected contains this signature: theFunction(object, path, value)

If the attacker can control the value of “path”, they can set this value to _proto_.myValue. myValue is then assigned to the prototype of the class of the object.

Types of attacks

There are a few methods by which Prototype Pollution can be manipulated:

Type Origin Short description
Denial of service (DoS) Client This is the most likely attack. <br>DoS occurs when Object holds generic functions that are implicitly called for various operations (for example, toString and valueOf). <br> The attacker pollutes Object.prototype.someattr and alters its state to an unexpected value such as Int or Object. In this case, the code fails and is likely to cause a denial of service. <br>For example: if an attacker pollutes Object.prototype.toString by defining it as an integer, if the codebase at any point was reliant on someobject.toString() it would fail.
Remote Code Execution Client Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation.<br>For example: eval(someobject.someattr). In this case, if the attacker pollutes Object.prototype.someattr they are likely to be able to leverage this in order to execute code.
Property Injection Client The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens.<br> For example: if a codebase checks privileges for someuser.isAdmin, then when the attacker pollutes Object.prototype.isAdmin and sets it to equal true, they can then achieve admin privileges.

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

How to prevent

  1. Freeze the prototype— use Object.freeze (Object.prototype).

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

  4. Consider using objects without prototypes (for example, Object.create(null)), breaking the prototype chain and preventing pollution.

  5. As a best practice use Map instead of Object.

For more information on this vulnerability type:

Arteau, Oliver. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018

Remediation

There is no fixed version for lodash.

References