Skip to main content

pg8000 CVE-2025-61385

CRITICAL
SQL Injection (CWE-89)
2025-10-27 cve@mitre.org
9.6
CVSS 3.1 · Vendor: mitre
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Submit crafted Python list as input
  2. Exploit
    Input reaches pg8000.native.literal escaping
  3. Execution
    Improper escaping allows breakout
  4. Impact
    Arbitrary 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.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available 0.4% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

pypi pg8000 fix: 1.31.5

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

Vendor (mitre) PRIMARY 9.6 CRITICAL
AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
vuln.today AI 9.8 CRITICAL

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.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
4.0 AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (mitre).

CVSS VectorVendor: mitre

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

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

Why It Matters

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.

Business Impact: High
Compensating Controls

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

EPSS Score
0.4%
Top 70% exploitable
Prevalence
Low
pg8000 is a minority pure-Python PostgreSQL driver, secondary to psycopg
Data Quality
3 sources
Confidence: Low

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.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact
High

Priority Score

48
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +48
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

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

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy