pg8000 CVE-2025-61385
CRITICALAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit crafted Python list as input
-
ExploitInput reaches pg8000.native.literal escaping
-
ExecutionImproper escaping allows breakout
-
ImpactArbitrary SQL executed against PostgreSQL
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Parameterized queries, prepared statements
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Persistence The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the target application to call pg8000.native.literal() to escape a Python list value and to feed attacker-controlled data into that list argument while constructing SQL; the crafted list then bypasses escaping. Limiting factors: this is specific to the native.literal escaping path, so applications that rely on pg8000's parameterized/prepared query interface rather than string-building with literal() are not exposed by this vector, and the affected version is pinned to pg8000 1.31.4. No special PostgreSQL server configuration is described. The trigger beyond 'specially crafted list input' is not further detailed in the available sources. |
| Impact | Signals mostly agree this is high priority but with an important real-world caveat. The provided CVSS is 9.6 (critical) with vector AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H, and the vuln.today decision label is act_now, which argues for prompt remediation. However, no EPSS score and no KEV status were supplied, so there is NO evidence of confirmed active exploitation - exploitation status here is best described as: a public PoC reference exists (bmcyver/vulnerability-research) but it is not verified as working exploit code. The CVSS AV:N/PR:N framing implies remote, unauthenticated reach, yet the flaw is in a library escaping helper (pg8000.native.literal), so real-world exploitability is gated by whether a given application actually calls that function on attacker-controlled list input - a usage condition the raw CVSS does not capture. One discrepancy to flag: the NVD vector asserts UI:R (user interaction required), but the description describes direct crafted-input injection with no clear victim-interaction step; UI:R appears to model the developer's use of the function rather than classic victim interaction - verify intent with the reporter. Net: treat as a genuine critical for applications that use pg8000.native.literal to escape list values, but a large population of pg8000 users relying on parameterized queries are not exposed by this specific path. |
| Exploit ScenarioDerived | An application uses pg8000.native.literal() to build a SQL statement and passes attacker-influenced data as a Python list; the attacker supplies a specially crafted list whose contents are not correctly escaped, breaking out of the intended literal and injecting arbitrary SQL. A public PoC reference exists for CVE-2025-61385 (though not verified as working exploit code), lowering the research barrier. Given CVSS AV:N/AC:L, the crafted input can be delivered remotely with low complexity wherever that input ultimately reaches the literal() call. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Nov 05, 2026
SQL injection in the pure-Python PostgreSQL driver pg8000 1.31.4 lets remote attackers execute arbitrary SQL commands by supplying a crafted Python list to pg8000.native.literal(), which is supposed to escape values before they are embedded in a SQL string. Exposure is limited to applications that build SQL text by calling native.literal() on attacker-influenced data, including list arguments; code that uses pg8000's parameterized query interface is not exposed through this vector. No CISA KEV entry exists, but a public PoC reference (a vulnerability-research repository entry for this CVE) exists and has not been verified as working exploit code, and an upstream fix commit is available; priority handling is warranted for any service that passes user-controlled lists into literal().
RemediationAI
Upgrade pg8000 off 1.31.4 to a release that includes upstream commit 8663c746b02286c32f19c385f0e2e5da9e4fa140 (https://codeberg.org/tlocke/pg8000/commit/8663c746b02286c32f19c385f0e2e5da9e4fa140); the exact patched version number is not confirmed in the available data, so verify the resolved version in your lockfile or requirements pin rather than assuming. Where an immediate upgrade is not possible, remove attacker-controlled data from the pg8000.native.literal() path: rewrite the affected queries to use pg8000's parameterized DB-API interface so values never pass through literal() - this requires code changes and does not cover dynamic identifiers, which must be allowlisted separately. As a narrower stopgap, restrict the types accepted by any wrapper around literal() so that list arguments are rejected or coerced before escaping, accepting that legitimate list-valued queries will break until the fix is deployed. Given the act_now priority signal, inventory dependencies for pg8000 1.31.4 and review call sites of native.literal() first.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
pg8000 is a pure-Python, DB-API 2.0 compliant PostgreSQL driver; its pg8000.native module exposes low-level helpers, including literal(), which quotes and escapes a Python value so it can be safely concatenated into a SQL statement. The flaw is CWE-89 (SQL injection) in that escaping path: the handling of Python list values is insufficient, so a specially crafted list supplied to literal() can break out of the escaped literal context and be interpreted as SQL syntax by the server. The affected release is pinned to pg8000 1.31.4. The trigger beyond 'specially crafted list input' is not described in the available sources, and no particular PostgreSQL server configuration is reported as a prerequisite. The practical attack surface is the string-building pattern - applications that instead pass parameters through pg8000's DB-API parameterized interface do not reach this code path, which is why real-world exposure depends on how the driver is used in the calling application.
Know when Python gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
Crafted list input bypasses literal() escaping with low complexity and no authentication or victim interaction; full SQL injection yields high C/I/A on the database, scope unchanged.
Primary rating from Vendor (mitre).
CVSS VectorVendor: mitre
DescriptionCVE.org
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.
Executive ViewAI
A critical SQL injection vulnerability in pg8000 version 1.31.4, a Python PostgreSQL driver, could allow attackers to execute arbitrary SQL commands. This only affects applications that improperly use the native.literal() function with user-controlled lists. Leadership should prioritize remediation if any internal or customer-facing services rely on this pattern, as it could lead to data breaches or unauthorized database access.
No vendor-released patch identified at time of analysis. Interim mitigations: avoid passing user-controlled data to native.literal(), use parameterized queries instead, implement strict input validation and sanitization, and monitor database logs for anomalous SQL commands.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
NVD
CVE.org
EPSS
GitHub
VulDB
Exploit-DB