Apache Flink: Remote code execution via SQL injection in code generation
Apache Software Foundation Apache Flink
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| org.apache.flink:flink-table-planner_2.12 Maven |
|
|
Apache Software Foundation Apache Flink
| Product | Affected | Fixed in |
|---|---|---|
| org.apache.flink:flink-table-planner_2.12 Maven |
|
|
| org.apache.flink:flink-table-api-java Maven |
|
|
| org.apache.flink:flink-table-runtime Maven |
|
|
Code injection in SQL code generation in Apache Flink 1.15.0 through 1.20.x and 2.0.0 through 2.x allows authenticated users with query submission privileges to execute arbitrary code on TaskManagers via maliciously crafted SQL queries. The vulnerability affects JSON functions (1.15.0+) and LIKE expressions with ESCAPE clauses (1.17.0+). User-controlled strings are interpolated into generated Java code without proper escaping, allowing attackers to break out of string literals and inject arbitrary expressions.
Users are recommended to upgrade to either version 1.20.4, 2.0.2, 2.1.2 or 2.2.1, which fixes this issue.
From the CVE record · apache
Apache Flink SQL code generation is vulnerable in JSON functions and LIKE expressions with ESCAPE clauses. Authenticated users with query submission privileges can execute arbitrary code on TaskManagers by submitting crafted SQL queries.
Teams running Apache Flink with Maven packages flink-table-planner_2.12, flink-table-api-java, or flink-table-runtime should check versions >=1.15.0 <1.20.4, >=2.0.0 <2.0.2, >=2.1.0 <2.1.2, and >=2.2.0 <2.2.1.