Vulnerabilities

3 via 5 paths

Dependencies

432

Source

GitHub

Commit

ab14802d

Find, fix and prevent vulnerabilities in your code.

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

high severity

Directory Traversal

  • Vulnerable module: hexo
  • Introduced through: hexo@6.3.0

Detailed paths

  • Introduced through: nodejs-ko@nodejs/nodejs-ko#ab14802dc2e7288bdc4353a24176dce2f4ba9dff hexo@6.3.0
    Remediation: Upgrade to hexo@7.2.0.

Overview

hexo is an A fast, simple & powerful blog framework, powered by Node.js.

Affected versions of this package are vulnerable to Directory Traversal via the Hexo's file read functionality. An attacker can read arbitrary files by manipulating the file path input.

Note:

This issue is only exploitable if the attacker has the ability to control the file path input. This vulnerability was only verified successfully in the Windows environment.

PoC

{% include_code ..\..\..\..\..\..\..\..\..\..\..\test.txt %}

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 hexo to version 7.2.0 or higher.

References

high severity

Infinite loop

  • Vulnerable module: markdown-it
  • Introduced through: hexo-renderer-markdown-it@6.1.0

Detailed paths

  • Introduced through: nodejs-ko@nodejs/nodejs-ko#ab14802dc2e7288bdc4353a24176dce2f4ba9dff hexo-renderer-markdown-it@6.1.0 markdown-it@12.3.2
    Remediation: Upgrade to hexo-renderer-markdown-it@7.0.0.

Overview

markdown-it is a modern pluggable markdown parser.

Affected versions of this package are vulnerable to Infinite loop in linkify inline rule when using malformed input.

Remediation

Upgrade markdown-it to version 13.0.2 or higher.

References

medium severity

Missing Release of Resource after Effective Lifetime

  • Vulnerable module: inflight
  • Introduced through: textlint@12.6.1 and hexo-renderer-stylus@2.1.0

Detailed paths

  • Introduced through: nodejs-ko@nodejs/nodejs-ko#ab14802dc2e7288bdc4353a24176dce2f4ba9dff textlint@12.6.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: nodejs-ko@nodejs/nodejs-ko#ab14802dc2e7288bdc4353a24176dce2f4ba9dff hexo-renderer-stylus@2.1.0 stylus@0.57.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: nodejs-ko@nodejs/nodejs-ko#ab14802dc2e7288bdc4353a24176dce2f4ba9dff textlint@12.6.1 file-entry-cache@5.0.1 flat-cache@2.0.1 rimraf@2.6.3 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