CVE-2023-28710 Apache Airflow Spark Provider Arbitrary File Read via JDBC
The Apache Airflow Spark Provider did not properly validate JDBC connection parameters, allowing an attacker to supply a malicious JDBC URL. When a DAG using SparkJDBCOperator ran, it connected to an attacker-controlled MySQL server, which could read arbitrary files from the Airflow host and potentially lead to deserialisation-based remote code execution.
Originally disclosed on HackerOne
- Triaged in 4 days
- Fixed in 44 days
- Paid in 44 days
- Disclosed after 2 months
Summary by the program
CVE-2023-28710: Apache Airflow Spark Provider Arbitrary File Read via JDBC
Severity: low
Description: Improper Input Validation vulnerability in Apache Software Foundation Apache Airflow Spark Provider.This issue affects Apache Airflow Spark Provider: before 4.0.1.
Credit: Xie Jianming of Nsfocus (finder)
Full Security Advisory: https://lists.apache.org/thread/lb9w9114ow00h2nkn8bjm106v5x1p1d2
The report
In all versions of Apache Airflow Spark Provider (the verification version is 4.0.0), because the parameters are not effectively filtered, the attacker can pass in malicious schema parameters (including malicious JDBC url) when establishing a connection with SparkJDBCHook, so that when establishing When connecting, a malicious mysql server can read any file on airflow.
this is screenshot of email and ASF response email I submitted
████████████████
Impact
When airflow does not enable authentication, the attacker can modify the existing connection configuration information, so that the DAG that uses SparkJDBCOperator in the system is running and connected to a malicious mysql server (or other types of servers), and is read by the attacker on the system , and more seriously, attackers can send malicious serialized data, which eventually leads to remote code execution.
This deserialization command was not successfully verified because the version of apache-common-collections-3.2.2 used by pyspark is too high, but when the jdk version used by the target system is 7u21 or there are other exploit chains, it can Causes the deserialization command to execute
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the SparkJDBCHook failed to validate or restrict the JDBC URL and schema parameters supplied in connection configuration, allowing an attacker to direct the connection to an arbitrary server.
Impact
An attacker could read arbitrary files from the Airflow host and, if the JDK version is vulnerable or another exploit chain exists, could achieve remote code execution through deserialisation; the deserialisation step was not verified because the bundled commons-collections version was too high.
What the attacker needed
Airflow authentication disabled; Ability to modify connection settings; A DAG using SparkJDBCOperator runs
The fix
The issue affects Apache Airflow Spark Provider before 4.0.1; the text does not describe the fix.
How it was found
- Ensure Airflow authentication is disabled so connection settings can be modified.
- Change an existing connection configuration to use a malicious JDBC URL pointing to an attacker-controlled MySQL server.
- Trigger a DAG that uses SparkJDBCOperator so it connects to the malicious server.
- The malicious server reads arbitrary files from the Airflow host.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Apache Airflow is a tool for scheduling data workflows. A component that lets those workflows talk to databases accepted a database address from an untrusted source without checking it. An attacker could point that address at their own database server, which then tricked Airflow into sending back files from its own machine.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.