CVE-2023-5002: Pgadmin4 PgAdmin Failed To Properly Control Vulnerability

MODERATE
Advisory Identifier: GHSA-ghp8-52vx-77j4
CVSS 6.0
CWE-78
Published
Advisory Summary

CVE-2023-5002 is a MODERATE (CVSS 6.0) pgadmin failed to properly control vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Pgadmin4 libraries in the PyPI ecosystem. The issue involves pgadmin failed to properly control the server code. Remediation is available by upgrading affected packages to version 7.7.

CVE-2023-5002 at a Glance

CVE Identifier CVE-2023-5002
GHSA Identifier GHSA-ghp8-52vx-77j4
Severity MODERATE
CVSS v3.1 Base Score 6.0
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Pgadmin4
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.0

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

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

How to Fix CVE-2023-5002

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

pgadmin4 fixed: 7.7
pip install pgadmin4>=7.7
Verify Direct and Transitive Dependencies

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

pip show pgadmin4

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2023-5002, inspect your installed packages using pip:

pip show pgadmin4

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

Note: The pip show pgadmin4 command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where 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. In Pgadmin4, 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

A flaw was found in pgAdmin. This issue occurs when the pgAdmin server HTTP API validates the path a user selects to external PostgreSQL utilities such as pg_dump and pg_restore. Versions of pgAdmin prior to 7.7 failed to properly control the server code executed on this API, allowing an authenticated user to run arbitrary commands on the server.

CVE-2023-5002 Affected Pgadmin4 Versions

1 component(s)
Fixed Versions:
7.7
Product / Package Ecosystem Affected Versions Fixed Version
pgadmin4
PyPI
< 7.7
7.7

References

Frequently Asked Questions

What is CVE-2023-5002?
CVE-2023-5002 is a security vulnerability in Pgadmin4 involving pgAdmin failed to properly control the server code under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Pgadmin4 versions are affected?
Affected versions include releases prior to 7.7 across affected packages: pgadmin4.
What version fixes CVE-2023-5002?
Upgrading to 7.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pgadmin4 affected?
Yes, pgadmin4 is affected in releases prior to 7.7. Upgrade your dependency to 7.7 or later.
What is the CVSS score of CVE-2023-5002?
CVE-2023-5002 has a CVSS v3.1 base score of 6.0 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:L/I:H/A:H.
What CWE is associated with CVE-2023-5002?
CVE-2023-5002 is classified under CWE-78: 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.).
How can I check PyPI dependencies for CVE-2023-5002?
Run the dependency tree command: 'pip show pgadmin4'. 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-ghp8-52vx-77j4",
  "modified" : "2025-03-17T21:33:27Z",
  "published" : "2023-09-22T15:30:15Z",
  "aliases" : [ "CVE-2023-5002" ],
  "summary" : "pgAdmin failed to properly control the server code ",
  "details" : "A flaw was found in pgAdmin. This issue occurs when the pgAdmin server HTTP API validates the path a user selects to external PostgreSQL utilities such as pg_dump and pg_restore. Versions of pgAdmin prior to 7.7 failed to properly control the server code executed on this API, allowing an authenticated user to run arbitrary commands on the server.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:L/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pgadmin4"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-5002"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pgadmin-org/pgadmin4/issues/6763"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pgadmin-org/pgadmin4/commit/35f05e49b3632a0a674b9b36535a7fe2d93dd0c2"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2239164"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pgadmin-org/pgadmin4"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/2S24D3S2GVNGTDNE6SF2OQSOPU3H72UW"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VIRTMQZEE6K7RD37ERZ2UFYFLEUXLQU3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-09-22T20:35:36Z",
    "nvd_published_at" : "2023-09-22T14:15:47Z"
  }
}