Vulnerabilities

3 via 11 paths

Dependencies

301

Source

GitHub

Find, fix and prevent vulnerabilities in your code.

Severity
  • 1
  • 2
Status
  • 3
  • 0
  • 0

high severity
new

Directory Traversal

  • Vulnerable module: tmp
  • Introduced through: @salesforce/core@3.36.2 and @salesforce/command@5.3.9

Detailed paths

  • Introduced through: appopsdxcli@prodly/mooverdxcli @salesforce/core@3.36.2 jsforce@2.0.0-beta.29 inquirer@7.3.3 external-editor@3.1.0 tmp@0.0.33
  • Introduced through: appopsdxcli@prodly/mooverdxcli @salesforce/command@5.3.9 @salesforce/core@3.36.2 jsforce@2.0.0-beta.29 inquirer@7.3.3 external-editor@3.1.0 tmp@0.0.33

Overview

Affected versions of this package are vulnerable to Directory Traversal via unsanitized input in the prefix, postfix, or dir parameters during path construction. An attacker can create files outside the intended temporary directory, potentially overwriting or placing files in sensitive locations, by supplying crafted values containing traversal sequences or absolute paths.

Details

A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.

Directory Traversal vulnerabilities can be generally divided into two types:

  • Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.

st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.

If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.

curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa

Note %2e is the URL encoded version of . (dot).

  • Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as Zip-Slip.

One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.

The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:

2018-04-15 22:04:29 .....           19           19  good.txt
2018-04-15 22:04:42 .....           20           20  ../../../../../../root/.ssh/authorized_keys

Remediation

Upgrade tmp to version 0.2.6 or higher.

References

medium severity

Symlink Attack

  • Vulnerable module: tmp
  • Introduced through: @salesforce/core@3.36.2 and @salesforce/command@5.3.9

Detailed paths

  • Introduced through: appopsdxcli@prodly/mooverdxcli @salesforce/core@3.36.2 jsforce@2.0.0-beta.29 inquirer@7.3.3 external-editor@3.1.0 tmp@0.0.33
  • Introduced through: appopsdxcli@prodly/mooverdxcli @salesforce/command@5.3.9 @salesforce/core@3.36.2 jsforce@2.0.0-beta.29 inquirer@7.3.3 external-editor@3.1.0 tmp@0.0.33

Overview

Affected versions of this package are vulnerable to Symlink Attack via the dir parameter. An attacker can cause files or directories to be written to arbitrary locations by supplying a crafted symbolic link that resolves outside the intended temporary directory.

PoC

const tmp = require('tmp');

const tmpobj = tmp.fileSync({ 'dir': 'evil-dir'});
console.log('File: ', tmpobj.name);

try {
    tmp.fileSync({ 'dir': 'mydir1'});
} catch (err) {
    console.log('test 1:', err.message)
}

try {
    tmp.fileSync({ 'dir': '/foo'});
} catch (err) {
    console.log('test 2:', err.message)
}

try {
    const fs = require('node:fs');
    const resolved = fs.realpathSync('/tmp/evil-dir');
    tmp.fileSync({ 'dir': resolved});
} catch (err) {
    console.log('test 3:', err.message)
}

Remediation

Upgrade tmp to version 0.2.4 or higher.

References

medium severity

Missing Release of Resource after Effective Lifetime

  • Vulnerable module: inflight
  • Introduced through: @salesforce/core@3.36.2 and @salesforce/command@5.3.9

Detailed paths

  • Introduced through: appopsdxcli@prodly/mooverdxcli @salesforce/core@3.36.2 archiver@5.3.2 archiver-utils@2.1.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: appopsdxcli@prodly/mooverdxcli @salesforce/core@3.36.2 @salesforce/kit@1.9.2 shx@0.3.4 shelljs@0.8.5 glob@7.2.3 inflight@1.0.6
  • Introduced through: appopsdxcli@prodly/mooverdxcli @salesforce/command@5.3.9 @salesforce/kit@1.9.2 shx@0.3.4 shelljs@0.8.5 glob@7.2.3 inflight@1.0.6
  • Introduced through: appopsdxcli@prodly/mooverdxcli @salesforce/command@5.3.9 @salesforce/core@3.36.2 archiver@5.3.2 archiver-utils@2.1.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: appopsdxcli@prodly/mooverdxcli @salesforce/core@3.36.2 archiver@5.3.2 zip-stream@4.1.1 archiver-utils@3.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: appopsdxcli@prodly/mooverdxcli @salesforce/command@5.3.9 @salesforce/core@3.36.2 @salesforce/kit@1.9.2 shx@0.3.4 shelljs@0.8.5 glob@7.2.3 inflight@1.0.6
  • Introduced through: appopsdxcli@prodly/mooverdxcli @salesforce/command@5.3.9 @salesforce/core@3.36.2 archiver@5.3.2 zip-stream@4.1.1 archiver-utils@3.0.4 glob@7.2.3 inflight@1.0.6

Overview

Affected versions of this package are vulnerable to Missing Release of Resource after Effective Lifetime via the makeres function due to improperly deleting keys from the reqs object after execution of callbacks. This behavior causes the keys to remain in the reqs object, which leads to resource exhaustion.

Exploiting this vulnerability results in crashing the node process or in the application crash.

Note: This library is not maintained, and currently, there is no fix for this issue. To overcome this vulnerability, several dependent packages have eliminated the use of this library.

To trigger the memory leak, an attacker would need to have the ability to execute or influence the asynchronous operations that use the inflight module within the application. This typically requires access to the internal workings of the server or application, which is not commonly exposed to remote users. Therefore, “Attack vector” is marked as “Local”.

PoC

const inflight = require('inflight');

function testInflight() {
  let i = 0;
  function scheduleNext() {
    let key = `key-${i++}`;
    const callback = () => {
    };
    for (let j = 0; j < 1000000; j++) {
      inflight(key, callback);
    }

    setImmediate(scheduleNext);
  }


  if (i % 100 === 0) {
    console.log(process.memoryUsage());
  }

  scheduleNext();
}

testInflight();

Remediation

There is no fixed version for inflight.

References