CVE-2026-65321 PyAthena SQL Injection via DefaultParameterFormatter DELETE/CTAS
Attackers can inject arbitrary SQL via improper quote escaping in PyAthena, enabling data exfiltration and destructive database modifications.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2026-65321?
CVE-2026-65321 is a critical SQL injection vulnerability in laughingman7743 PyAthena, published on 2 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official 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.
Weakness: CWE-89
Which versions are affected by CVE-2026-65321?
How do I fix CVE-2026-65321?
Upgrade to a fixed version.
Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.
Is CVE-2026-65321 being exploited?
There is no known exploitation of CVE-2026-65321 in the wild and no public exploit code.
Public exploit code: 1 proofs of concept on GitHub.
Sources
Also known as CLEANSTART-2026-DS89074, CLEANSTART-2026-WC06247, GHSA-xwj5-g6cv-4r5c.