CVE-2026-65321
Received Received - Intake

SQL Injection in PyAthena Prior to 3.35.4

Vulnerability report for CVE-2026-65321, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-08-02

Last updated on: 2026-08-02

Assigner: VulnCheck

Description

PyAthena prior to 3.35.4 contains a sql injection vulnerability that allows unauthenticated attackers to inject arbitrary SQL by exploiting improper quote-escaping in DefaultParameterFormatter.format(), which routes DELETE and CTAS statements to the _escape_hive function that backslash-escapes single quotes rather than doubling them. Because Athena and Trino do not treat backslashes as escape characters inside string literals, attacker-supplied input such as a single quote followed by SQL syntax causes the parser to terminate the string literal prematurely, enabling data exfiltration via UNION SELECT, execution of destructive statements, and attacker-controlled CTAS destination and content.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-08-02
Last Modified
2026-08-02
Generated
2026-08-02
AI Q&A
2026-08-02
EPSS Evaluated
N/A
NVD
EUVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
pyathena pyathena to 3.35.4 (exc)

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-89 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.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

PyAthena before version 3.35.4 has a SQL injection flaw due to improper quote-escaping in DefaultParameterFormatter.format(). Attackers can inject arbitrary SQL by exploiting this to route DELETE and CTAS statements through _escape_hive, which backslash-escapes single quotes instead of doubling them. Since Athena and Trino do not treat backslashes as escape characters, injected input can prematurely end string literals, allowing data theft via UNION SELECT, destructive commands, or attacker-controlled CTAS operations.

Detection Guidance

Detecting this vulnerability requires checking for outdated PyAthena versions and testing for SQL injection via improper quote handling. Inspect installed PyAthena packages using pip show pyathena or pip list. Test for vulnerability by attempting to inject SQL via single quotes in parameters and observing if queries execute unintended commands.

Impact Analysis

This vulnerability allows unauthenticated attackers to execute arbitrary SQL commands, potentially leading to data exfiltration, unauthorized data deletion or modification, and creation of malicious tables or files. Systems using PyAthena for database interactions are at risk if they have not updated to version 3.35.4 or later.

Compliance Impact

This vulnerability could lead to unauthorized access or exposure of sensitive data, violating GDPR's data protection principles and HIPAA's security and privacy rules. Organizations may face compliance breaches, legal penalties, and reputational damage if exploited.

Mitigation Strategies

Upgrade PyAthena to version 3.35.4 or later to address the SQL injection vulnerability caused by improper quote-escaping in DefaultParameterFormatter.format().

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-65321. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart