CVE-2019-15658: Connect pg simple SQL Injection Vulnerability

HIGH
Advisory Identifier: GHSA-xqh8-5j36-4556
CVSS 7.3
CWE-89
Published
Advisory Summary

CVE-2019-15658 is a HIGH (CVSS 7.3) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Connect pg simple libraries in the npm ecosystem. The issue involves sql injection in connect-pg-simple. Remediation is available by upgrading affected packages to version 6.0.1.

CVE-2019-15658 at a Glance

CVE Identifier CVE-2019-15658
GHSA Identifier GHSA-xqh8-5j36-4556
Severity HIGH
CVSS v3.1 Base Score 7.3
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Connect pg simple
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2019-15658

To remediate this vulnerability, upgrade all affected Connect pg simple dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

connect-pg-simple fixed: 6.0.1
npm install connect-pg-simple@6.0.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls connect-pg-simple

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2019-15658, inspect your project dependencies using npm:

npm ls connect-pg-simple

Analyze the terminal output to locate any version of Connect pg simple in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.0.1), your application is affected.

Note: The npm ls connect-pg-simple command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Connect pg simple, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact An unlikely SQL injection if the case of an unsanitized table name input. ### Patches The user should upgrade to `6.0.1`. Due to its low impact a backport has not been made to the `5.x` branch. ### Workarounds If there is no likelihood that the `tableName` or `schemaName` options sent to the constructor could be of an unsanitized nature, then no workaround is needed. Else the input could be sanitized and escaped before sending it in. Take note though that such an escaping would need to be removed when upgrading to `6.0.1` or later, to avoid double escaping. ### References * [Security issue disclosure](https://github.com/voxpelli/node-connect-pg-simple/issues/151) ### For more information If you have any questions or comments about this advisory: * Open an issue in [voxpelli/node-connect-pg-simple](https://github.com/voxpelli/node-connect-pg-simple) * Email maintainer at [pelle@kodfabrik.se](mailto:pelle@kodfabrik.se)

CVE-2019-15658 Affected Connect pg simple Versions

1 component(s)
Fixed Versions:
6.0.1
Product / Package Ecosystem Affected Versions Fixed Version
connect-pg-simple
npm
< 6.0.1
6.0.1

References

Frequently Asked Questions

What is CVE-2019-15658?
CVE-2019-15658 is a security vulnerability in Connect pg simple involving SQL Injection in connect-pg-simple under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Connect pg simple versions are affected?
Affected versions include releases prior to 6.0.1 across affected packages: connect-pg-simple.
What version fixes CVE-2019-15658?
Upgrading to 6.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is connect-pg-simple affected?
Yes, connect-pg-simple is affected in releases prior to 6.0.1. Upgrade your dependency to 6.0.1 or later.
What is the CVSS score of CVE-2019-15658?
CVE-2019-15658 has a CVSS v3.1 base score of 7.3 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2019-15658?
CVE-2019-15658 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check npm dependencies for CVE-2019-15658?
Run the dependency tree command: 'npm ls connect-pg-simple'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xqh8-5j36-4556",
  "modified" : "2022-06-15T18:39:04Z",
  "published" : "2019-08-26T16:59:45Z",
  "aliases" : [ "CVE-2019-15658" ],
  "summary" : "SQL Injection in connect-pg-simple",
  "details" : "### Impact\nAn unlikely SQL injection if the case of an unsanitized table name input.\n\n### Patches\nThe user should upgrade to `6.0.1`. Due to its low impact a backport has not been made to the `5.x` branch.\n\n### Workarounds\nIf there is no likelihood that the `tableName` or `schemaName` options sent to the constructor could be of an unsanitized nature, then no workaround is needed. Else the input could be sanitized and escaped before sending it in. Take note though that such an escaping would need to be removed when upgrading to `6.0.1` or later, to avoid double escaping.\n\n### References\n* [Security issue disclosure](https://github.com/voxpelli/node-connect-pg-simple/issues/151)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [voxpelli/node-connect-pg-simple](https://github.com/voxpelli/node-connect-pg-simple)\n* Email maintainer at [pelle@kodfabrik.se](mailto:pelle@kodfabrik.se)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "connect-pg-simple"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/voxpelli/node-connect-pg-simple/security/advisories/GHSA-xqh8-5j36-4556"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-15658"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-xqh8-5j36-4556"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/voxpelli/node-connect-pg-simple"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-CONNECTPGSIMPLE-460154"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1153"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T22:04:11Z",
    "nvd_published_at" : null
  }
}