Vulnerabilities

3 via 3 paths

Dependencies

93

Source

GitHub

Find, fix and prevent vulnerabilities in your code.

Severity
  • 3
Status
  • 3
  • 0
  • 0

medium severity

Asymmetric Resource Consumption (Amplification)

  • Vulnerable module: minimatch
  • Introduced through: glob@7.2.3

Detailed paths

  • Introduced through: express-jsdoc-swagger@BRIKEV/express-jsdoc-swagger › glob@7.2.3 › minimatch@3.1.5
    Remediation: Upgrade to glob@14.0.0.

Overview

minimatch is a minimal matching utility.

Affected versions of this package are vulnerable to Asymmetric Resource Consumption (Amplification) in the firstPhasePreProcess method, where the **/.. transform clones a globParts entry and pushes the clone back onto the same array inside a do...while (didSomething) fixpoint loop. An attacker can exhaust CPU and memory by supplying a glob pattern whose **/.. sequences regenerate entries during preprocessing, which secondPhasePreProcess then compares in an O(n^2) pairwise partsMatch pass over the expanded set. Exploitation requires the pattern to be parsed with optimizationLevel set to 2 or higher.

Remediation

Upgrade minimatch to version 11.0.1 or higher.

References

medium severity
new

Improper Neutralization

  • Vulnerable module: glob
  • Introduced through: glob@7.2.3

Detailed paths

  • Introduced through: express-jsdoc-swagger@BRIKEV/express-jsdoc-swagger › glob@7.2.3
    Remediation: Upgrade to glob@14.0.6.

Overview

Affected versions of this package are vulnerable to Improper Neutralization in src/ignore.ts, when composing an absolute ignore pattern, the resolved root/cwd path is pasted into a glob string and re-parsed by minimatch. The path is escaped with minimatch's escape(), but that function only escapes { and } when the magicalBraces option is enabled, which glob does not pass. A root or cwd path containing brace expressions (e.g. /root{7,8}) is therefore brace-expanded during re-parsing, causing the resulting ignore pattern to match non-existent paths instead of the real path. The exclusion is silently dropped and the excluded file is returned to the caller.

Note: This is only exploitable when the root or cwd path contains brace characters, which is reachable when those paths are derived from externally supplied data such as tenant IDs, project names, or archive extraction paths.

PoC

import { Volume, createFsFromVolume } from 'memfs'
import { glob } from 'glob'

const vol = new Volume()
const fs = createFsFromVolume(vol)
vol.fromJSON({
  '/root{7,8}/keep.txt': 'x',
  '/root{7,8}/skip.log': 'x',
})

const res = await glob('*', {
  cwd: '/root{7,8}',
  root: '/root{7,8}',
  fs,
  ignore: ['/skip.log'],
  platform: 'posix',
})

console.log(res)   // [ 'keep.txt', 'skip.log' ]  <-- skip.log should be ignored

Control with a plain root path:

vol.fromJSON({ '/root/keep.txt': 'x', '/root/skip.log': 'x' })
await glob('*', {
  cwd: '/root', root: '/root', fs, ignore: ['/skip.log'], platform: 'posix',
})
// [ 'keep.txt' ]  <-- ignore correctly enforced

Remediation

Upgrade glob to version 14.0.6 or higher.

References

medium severity

Missing Release of Resource after Effective Lifetime

  • Vulnerable module: inflight
  • Introduced through: glob@7.2.3

Detailed paths

  • Introduced through: express-jsdoc-swagger@BRIKEV/express-jsdoc-swagger › 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