CVE-2023-34232 (JavaScript, published 2023-06-08T21:15Z)
Description: value: snowflake-connector-nodejs, a NodeJS driver for Snowflake, is vulnerable to command injection via single sign on (SSO) browser URL authentication in versions prior to 1.6.21. In order to exploit the potential for command injection, an attacker would need to be successful in (1) establishing a malicious resource and (2) redirecting users to utilize the resource. The attacker could set up a malicious, publicly accessible server which responds to the SSO URL with an attack payload. If the attacker then tricked a user into visiting the maliciously crafted connection URL, the user’s local machine would render the malicious payload, leading to a remote code execution. This attack scenario can be mitigated through URL whitelisting as well as common anti-phishing resources. Version 1.6.21 contains a patch for this issue.
Severity: nan (CVSS v3 base score: 8.8)
Weakness: CWE-77 \u2014 Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
Repository: https://github.com/snowflakedb/snowflake-connector-nodejs
Files changed:
lib/connection/result/column.js
package.json
test/integration/testDataType.js
test/integration/testUtil.js
test/unit/connection/result/result_test_variant.js
Commit message: Replace eval() for parsing JSON strings (#465)

* Replace eval() with JSON.parse() for parsing JSON strings

* Replace eval with safe-eval for parsing JSON strings

* Replace eval with better-eval for parsing JSON strings

* Use assert without strict for comparing objects created by better-eval

* Use assert without strict for comparing objects created by better-eval

* Use assert without strict for comparing objects created by better-eval

---------

Co-authored-by: ilesh garish <111810784+sfc-gh-igarish@users.noreply.github.com>

Vulnerable code:
      ret = eval("(" + rawColumnValue + ")");
              callback
              callback
module.exports.executeQueryAndVerify = function (connection, sql, expected, callback, bindArray, normalize)
        assert.deepStrictEqual(normalize ? normalizeRowObject(row) : row, expected[rowCount]);
          assert.deepStrictEqual(row.getColumnValue('C1'), {a: 1});
          assert.strictEqual(
          assert.deepStrictEqual(row.getColumnValue('C2'), {a: 1});
          assert.strictEqual(
          assert.deepStrictEqual(row.getColumnValue('C3'), [1, 2]);
          assert.strictEqual(

Fixed code:
var betterEval = require("better-eval");
      ret = betterEval("(" + rawColumnValue + ")");
    "better-eval": "^1.3.0",
              callback,
              null,
              true,
              false
              callback,
              null,
              true,
              false
module.exports.executeQueryAndVerify = function (connection, sql, expected, callback, bindArray, normalize, strict)
  strict = (typeof strict !== "undefined" && strict != null) ? strict : true;
        if (strict)
        {
          assert.deepStrictEqual(normalize ? normalizeRowObject(row) : row, expected[rowCount]);
        }
        else
        {
          assert.deepEqual(normalize ? normalizeRowObject(row) : row, expected[rowCount]);
        }
          assert.deepEqual(row.getColumnValue('C1'), {a: 1});
          assert.equal(
          assert.deepEqual(row.getColumnValue('C2'), {a: 1});
          assert.equal(
          assert.deepEqual(row.getColumnValue('C3'), [1, 2]);
          assert.equal(