CVE-2025-61385: Pg8000 SQL Injection Vulnerability
HIGHCVE-2025-61385 is a HIGH sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Pg8000 libraries in the PyPI ecosystem. The issue involves pg8000 sql injection vulnerability via a specially crafted python list input. Remediation is available by upgrading affected packages to version 1.31.5.
CVE-2025-61385 at a Glance
How to Fix CVE-2025-61385
To remediate this vulnerability, upgrade all affected Pg8000 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 pg8000>=1.31.5
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show pg8000
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2025-61385, inspect your installed packages using pip:
pip show pg8000
Analyze the terminal output to locate any version of Pg8000 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.31.5), your application is affected.
Note: The pip show pg8000 command checks currently installed packages in your active Python environment.
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 Pg8000, 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-2025-61385 Affected Pg8000 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pg8000
|
PyPI |
< 1.31.5
|
1.31.5
|
References
Frequently Asked Questions
What is CVE-2025-61385?
Which Pg8000 versions are affected?
What version fixes CVE-2025-61385?
Is pg8000 affected?
What CWE is associated with CVE-2025-61385?
How can I check PyPI dependencies for CVE-2025-61385?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-wq2g-r956-j8cc",
"modified" : "2025-10-27T23:17:04Z",
"published" : "2025-10-27T18:31:13Z",
"aliases" : [ "CVE-2025-61385" ],
"summary" : "pg8000 SQL injection vulnerability via a specially crafted Python list input",
"details" : "SQL injection vulnerability in tlocke pg8000 1.31.4 allows remote attackers to execute arbitrary SQL commands via a specially crafted Python list input to function pg8000.native.literal.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "pg8000"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.31.5"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.31.4"
}
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-61385"
}, {
"type" : "PACKAGE",
"url" : "https://codeberg.org/tlocke/pg8000"
}, {
"type" : "WEB",
"url" : "https://codeberg.org/tlocke/pg8000/commit/8663c746b02286c32f19c385f0e2e5da9e4fa140"
}, {
"type" : "WEB",
"url" : "https://github.com/bmcyver/vulnerability-research/tree/main/CVE-2025-61385"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-89" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-10-27T23:17:04Z",
"nvd_published_at" : "2025-10-27T18:15:43Z"
}
}