Vulnerabilities in pkg:pypi/pg-query
PACKAGECVE-2018-18482 is a HIGH (CVSS 6.5) libpg_query memory leak vulnerability (CWE-772: Missing Release of Resource after Effective Lifetime) affecting Pg query libraries in the PyPI ecosystem. The issue involves libpg_query memory leak. Remediation is available by upgrading affected packages to version 0.28.
pkg:pypi/pg-query
Vulnerability advisories affecting package pkg:pypi/pg-query. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-vm3q-58wm-2r2x | CVE-2018-18482 | HIGH | libpg_query memory leak |
CVE-2018-18482 at a Glance
Security Impact
CVSS: 6.5
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:R/S:U/C:N/I:N/A:H).
How to Fix CVE-2018-18482
To remediate this vulnerability, upgrade all affected Pg query dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install pg-query>=0.28
pip install pglast>=0.28
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show pg-query
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2018-18482, inspect your installed packages using pip:
pip show pg-query
Analyze the terminal output to locate any version of Pg query in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.28), your application is affected.
Note: The pip show pg-query command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-772: Missing Release of Resource after Effective Lifetime, where the product does not release a resource after its effective lifetime has ended, i.e., after the resource is no longer needed. In Pg query, 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
CVE-2018-18482 Affected Pg query Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pg-query
|
PyPI |
< 0.28
|
0.28
|
|
pglast
|
PyPI |
< 0.28
|
0.28
|
References
Frequently Asked Questions
What is CVE-2018-18482?
Which Pg query versions are affected?
What version fixes CVE-2018-18482?
Is pg-query affected?
Is pglast affected?
What is the CVSS score of CVE-2018-18482?
What CWE is associated with CVE-2018-18482?
How can I check PyPI dependencies for CVE-2018-18482?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vm3q-58wm-2r2x",
"modified" : "2024-11-26T18:14:48Z",
"published" : "2022-05-13T01:50:42Z",
"aliases" : [ "CVE-2018-18482" ],
"summary" : "libpg_query memory leak",
"details" : "An issue was discovered in libpg_query 10-1.0.2. There is a memory leak in pg_query_raw_parse in pg_query_parse.c, which might lead to a denial of service.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "pg-query"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.28"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "pglast"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.28"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-18482"
}, {
"type" : "WEB",
"url" : "https://github.com/lfittl/libpg_query/issues/49"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/lelit/pglast"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pg-query/PYSEC-2018-154.yaml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-772" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-11-22T20:22:50Z",
"nvd_published_at" : "2018-10-18T18:29:00Z"
}
}