PyAthena is vulnerable to SQL Injection
98
Critical Risk
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.
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.
PyAthena is vulnerable to SQL Injection in versions 0.0.1 - 3.35.3.
Upgrade the PyAthena library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant