PyAthena is vulnerable to SQL Injection
98
CVE Score
Critical
SQL Injection
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.
Upgrade the PyAthena library to the patch version.
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.
0.0.1 - 3.35.3
Fixed in 3.35.4PyAthena is vulnerable to SQL Injection in versions 0.0.1 - 3.35.3.
Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.
No credit card required | Scan results in 32 seconds.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.