CVE-2023-26156 (JavaScript, published 2023-11-09T05:15Z)
Description: value: Versions of the package chromedriver before 119.0.1 are vulnerable to Command Injection when setting the chromedriver.path to an arbitrary system binary. This could lead to unauthorized access and potentially malicious actions on the host system.**Note:**An attacker must have access to the system running the vulnerable chromedriver library to exploit it. The success of exploitation also depends on the permissions and privileges of the process running chromedriver.
Severity: nan (CVSS v3 base score: 7.5)
Weakness: CWE-78 \u2014 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
Repository: https://github.com/giggio/node-chromedriver
Files changed:
.npmignore
lib/chromedriver.js
package-lock.json
package.json
testStart.js
update.js
Commit message: Hide private attributes from exports


Vulnerable code:
  if (!args) {
  }
  if (portArg) {
  }
exports.path = process.platform === 'win32' ? path.join(__dirname, 'chromedriver', 'chromedriver.exe') : path.join(__dirname, 'chromedriver', 'chromedriver');
exports.version = '119.0.6045.105';
exports.start = function (args, returnPromise) {
  let command = exports.path;
  exports.defaultInstance = cp;
  if (!returnPromise) {
  }
};
exports.stop = function () {
  if (exports.defaultInstance != null) {
    exports.defaultInstance.kill();
  "version": "119.0.0",
      "version": "119.0.0",
  "version": "119.0.0",
   - update the version inside the ./lib/chromedriver helper file e.g. exports.version = '77.0.3865.40';
  const versionExport = 'exports.version';

Fixed code:
testStart.js
  if (!args)
  if (portArg)
const crpath = process.platform === 'win32' ? path.join(__dirname, 'chromedriver', 'chromedriver.exe') : path.join(__dirname, 'chromedriver', 'chromedriver');
const version = '119.0.6045.105';
let defaultInstance = null;

function start(args, returnPromise) {
  let command = crpath;
  defaultInstance = cp;
  if (!returnPromise)
}

function stop() {
  if (defaultInstance != null)
    defaultInstance.kill();
  defaultInstance = null;
}

module.exports = {
  path: crpath,
  version,
  start,
  stop,
  get defaultInstance() {
    return defaultInstance;
  "version": "119.0.1",
      "version": "119.0.1",
  "version": "119.0.1",
#!/usr/bin/env node

"use strict";
const chromedriver = require('./lib/chromedriver');

async function run() {
  console.log(`Starting chromedriver. Instance: ${JSON.stringify(chromedriver)}`);
  await chromedriver.start(null, true);
  console.log(`Started Chromedriver. Instance is null: ${chromedriver.defaultInstance === null}.`);
  chromedriver.stop();
  console.log(`Stopped Chromedriver. Instance is null: ${chromedriver.defaultInstance === null}.`);
}

run();
   - update the version inside the ./lib/chromedriver helper file e.g. const version = '77.0.3865.40';
  const versionExport = 'const version';