Loading...
Skip to main content

CVE-2017-16082 — Remote Code Execution in pg — CVE Details

CRITICAL

Remote Code Execution in pg

Published July 24, 2018Updated November 8, 2023Source: osv

Summary

Affected versions of `pg` contain a remote code execution vulnerability that occurs when the remote database or query specifies a crafted column name. There are two specific scenarios in which it is likely for an application to be vulnerable: 1. The application executes unsafe, user-supplied sql which contains malicious column names. 2. The application connects to an untrusted database and executes a query returning results which contain a malicious column name. ## Proof of Concept ``` const { Client } = require('pg') const client = new Client() client.connect() const sql = `SELECT 1 AS "\\'/*", 2 AS "\\'*/\n + console.log(process.env)] = null;\n//"` client.query(sql, (err, res) => { client.end() }) ``` ## Recommendation * Version 2.x.x: Update to version 2.11.2 or later. * Version 3.x.x: Update to version 3.6.4 or later. * Version 4.x.x: Update to version 4.5.7 or later. * Version 5.x.x: Update to version 5.2.1 or later. * Version 6.x.x: Update to version 6.4.2 or later. ( Note that versions 6.1.6, 6.2.5, and 6.3.3 are also patched. ) * Version 7.x.x: Update to version 7.1.2 or later. ( Note that version 7.0.2 is also patched. )

Advisory Timeline

  • First published July 24, 2018 (3002 days ago).
  • Last revised November 8, 2023 — 1932 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

npm
Update pg to 6.1.6 or later
npm install pg@6.1.6
npm
Update pg to 6.0.5 or later
npm install pg@6.0.5
npm
Update pg to 4.5.7 or later
npm install pg@4.5.7
npm
Update pg to 3.6.4 or later
npm install pg@3.6.4
npm
Update pg to 5.2.1 or later
npm install pg@5.2.1
npm
Update pg to 6.4.2 or later
npm install pg@6.4.2
npm
Update pg to 6.2.5 or later
npm install pg@6.2.5
npm
Update pg to 7.0.2 or later
npm install pg@7.0.2
npm
Update pg to 6.3.3 or later
npm install pg@6.3.3
npm
Update pg to 7.1.2 or later
npm install pg@7.1.2
npm
Update pg to 2.11.2 or later
npm install pg@2.11.2

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (11)

Affects 1 ecosystem: npm (1).

PackageEcosystemAffectedFixed In
pg
npm
All versions6.1.6
pg
npm
All versions6.0.5
pg
npm
All versions4.5.7
pg
npm
All versions3.6.4
pg
npm
All versions5.2.1
pg
npm
All versions6.4.2
pg
npm
All versions6.2.5
pg
npm
All versions7.0.2
pg
npm
All versions6.3.3
pg
npm
All versions7.1.2
pg
npm
All versions2.11.2

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Frequently Asked Questions

What is CVE-2017-16082?
Remote Code Execution in pg This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
How do I check if my project is affected by CVE-2017-16082?
CVE-2017-16082 affects pg. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2017-16082 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.8

Exploitation is straightforward and causes maximum impact. Patch immediately.

Also Known As

GHSA-wc9v-mj63-m9g5

Related CVEs

  • CVE-2026-107722
    CRITICAL

    fast-jwt: Incomplete patch of CVE-2026-34950: Non-whitespace key-prefix re-enables RSA→HS256 algorithm confusion

  • CVE-2026-108261
    CRITICAL

    TinaCMS admin preview iframe loads an attacker-controlled origin from the URL fragment

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies