Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessReach app endpoint using PyAthena
-
DeliverySubmit single-quote-laden parameter to DELETE/CTAS query
-
ExploitHive escaper backslash-escapes quote
-
ExecutionTrino terminates literal early
-
PersistInjected UNION SELECT or destructive/CTAS SQL executes
-
ImpactExfiltrate or destroy data
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 embedding application to route attacker-controlled parameter values through PyAthena's DefaultParameterFormatter into a DELETE statement or a CTAS/CREATE VIEW statement (CREATE TABLE ... AS SELECT), which pre-3.35.4 were misrouted to the backslash-escaping _escape_hive function; SELECT/WITH/INSERT/UPDATE/MERGE were already handled safely and are NOT vulnerable. The concrete condition is a query whose statement type falls outside the old SELECT/WITH/INSERT/UPDATE/MERGE prefix allowlist yet is executed by Trino/Athena. Limiting factors: the attacker's input must reach one of these specific statement paths as a bound parameter, and the backend must be Athena/Trino (which ignore backslash escaping) rather than the Hive DDL engine; pure Hive DDL statements (CREATE EXTERNAL TABLE, DROP TABLE, MSCK REPAIR, SHOW/DESCRIBE) are not vulnerable because backslash escaping is correct there. Authentication requirements against the underlying app are not determinable from the library CVSS alone - CVSS PR:N reflects the injection source being untrusted input, not a confirmed unauthenticated app endpoint. |
| Impact | The provided CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H, base 9.3) indicates a network-reachable, low-complexity flaw with no privileges or user interaction and high confidentiality, integrity, and availability impact - consistent with the described data exfiltration, destructive DML, and attacker-controlled CTAS. However, real-world reachability is conditional: this is a library defect, so an attacker only benefits when a downstream application actually passes untrusted input into a parameterized DELETE or CTAS query through the vulnerable formatter path. No EPSS score, KEV entry, or POC was supplied, so the PR:N/AV:N rating reflects worst-case library exposure rather than confirmed mass exploitability; treat the 'unauthenticated network' framing as dependent on the embedding application's exposure. Given a confirmed fixing commit, a clear root cause, and high impact, this is a genuine priority for anyone running PyAthena in a path that parameterizes DELETE/CTAS with external input, but it is not confirmed as actively exploited. |
| Exploit ScenarioDerived | An application built on PyAthena exposes a data-management endpoint that deletes rows matching a user-supplied filter, e.g. cursor.execute("DELETE FROM t WHERE c = %(v)s", {"v": user_input}). The attacker submits a value like a' OR 1=1 -- ; because the pre-fix Hive escaper only backslash-escapes the quote, Trino terminates the string literal early and the injected clause executes, allowing mass deletion, a UNION SELECT exfiltration through a CTAS destination the attacker controls, or writing attacker-chosen content to an S3 location. No public exploit was identified at time of analysis, though the fixing commit and its tests illustrate the payload. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 02, 2026
SQL injection in PyAthena before 3.35.4 lets remote unauthenticated attackers break out of parameterized string literals in DELETE and CTAS (CREATE TABLE ... AS SELECT) statements because DefaultParameterFormatter.format() routes these to the Hive escaper, which backslash-escapes single quotes instead of doubling them. Since Athena/Trino treat backslashes as ordinary characters inside string literals, a single quote in attacker-supplied input terminates the literal early and injects arbitrary SQL, enabling data exfiltration via UNION SELECT, destructive statement execution, and attacker-controlled CTAS output. There is no public exploit identified at time of analysis, but a fixing commit and vendor advisory are public.
RemediationAI
Vendor-released patch: upgrade PyAthena to 3.35.4 or later, which replaces the naive prefix check with _get_escaper() and safely defaults DELETE, CTAS, and CREATE VIEW statements to the quote-doubling Trino escaper (commit 27901d1); consult GHSA-xwj5-g6cv-4r5c and the VulnCheck advisory for details. If immediate upgrade is not possible, do not pass untrusted input into parameterized DELETE or CREATE TABLE ... AS SELECT / CREATE VIEW statements - instead validate and strictly allowlist any user-supplied values (reject single quotes and SQL metacharacters) before they reach cursor.execute with parameters, or restrict such statements to trusted internal callers; the trade-off is that input validation is error-prone and can break legitimate values containing quotes, so it is a stopgap rather than a fix. Additionally scope the IAM role used by Athena to least privilege so a successful injection cannot perform destructive DROP/CTAS actions or write to arbitrary S3 destinations, accepting that this limits blast radius but does not close the injection.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
PyAthena is a Python DB-API 2.0 / SQLAlchemy client for AWS Athena, whose queries are executed by the Trino/Presto engine (for DML and CTAS) or the Hive DDL engine (for catalog/table DDL). The flaw is a CWE-89 SQL injection rooted in an escaper-selection bug: the pre-fix code chose _escape_presto only for statements literally beginning with SELECT/WITH/INSERT/UPDATE/MERGE and fell back to _escape_hive for everything else, silently including DELETE and CTAS. _escape_hive backslash-escapes single quotes (\'), which is correct only for the Hive lexer; Trino and Athena do not honor backslash as an escape character inside string literals, so the doubled-quote convention ('') is required. The fix (commit 27901d1) introduces _get_escaper with a Hive-statement allowlist regex, strips leading SQL comments before detection so a leading /* ... */ or -- comment cannot defeat statement typing, and defaults all other statements (including DELETE, CTAS, CREATE VIEW) to the safe Presto/Trino escaper.
Know when the next one hits your stack
- 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
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
Injection originates from untrusted input reaching a parameterized DELETE/CTAS path, so AV:N/AC:L/PR:N/UI:N; full read, tamper, and destructive/availability impact yields C:H/I:H/A:H.
Primary rating from Vendor (vulncheck).
CVSS VectorVendor: vulncheck
DescriptionCVE.org
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.
Executive ViewAI
PyAthena, the Python client for Amazon Athena, contains a critical SQL injection vulnerability (CVSS 9.3) permitting remote unauthenticated attackers to extract sensitive data or corrupt database contents. No public exploit identified at time of analysis, but the vulnerability is highly exploitable and requires immediate mitigation. Organizations using PyAthena to query Amazon Athena data warehouses face urgent risk of data breach and integrity compromise without interim compensating controls.
No vendor-released patch identified at time of analysis. Interim mitigations: (1) enforce parameterized queries and input validation at the application layer independent of PyAthena; (2) restrict network access to Athena to authorized internal systems only; (3) implement detailed query monitoring and alerting for suspicious SQL patterns; (4) apply restrictive IAM policies limiting Athena principal permissions to minimal required datasets and operations; (5) enable and review CloudTrail logs for Athena API calls; (6) use read-only or limited-scope Athena credentials for PyAthena client connections.
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.
EUVD-2026-52004
NVD
CVE.org
EPSS
Vulnrichment
GitHub
VulDB
Exploit-DB