Intel

AIKIDO-2026-845159

PyAthena is vulnerable to SQL Injection

SQL InjectionCVE-2026-65321 Published 4 days ago

98

Critical Risk

This Affects:

PYTHONPyAthena
0.0.1 - 3.35.3
Fixed in 3.35.4
Are you affected? Scan for Free

TL;DR

PyAthena builds parameterized SQL through DefaultParameterFormatter, which chooses an escaping strategy for each statement. Only SELECT, WITH, INSERT, UPDATE, and MERGE route to the Trino-safe escaper (quote-doubling); every other statement — including DELETE and CTAS (CREATE TABLE ... AS SELECT) — falls through to the Hive escaper, which backslash-escapes single quotes instead of doubling them. Because Athena and Trino do not treat backslashes as escape characters inside string literals, an externally influenced string value can terminate a literal early and inject arbitrary SQL, enabling data exfiltration and destructive statements. The fix selects the escaper by statement type so non-Hive statements use quote-doubling, and it strips leading comments before making that decision.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you pass externally influenced values as parameters to DELETE or CTAS (CREATE TABLE ... AS SELECT) statements, expecting PyAthena to safely quote them.

Background info

PyAthena is vulnerable to SQL Injection in versions 0.0.1 - 3.35.3.

How to fix this

Upgrade the PyAthena library to the patch version.