CVE-2024-45498: Apache Airflow Command injection in read_dataset_event_from_classic DAG
A DAG shipped as an example in Apache Airflow builds a bash command from a dataset URI and its extra fields, so a user allowed to create dataset events can place an OS command in that data and have it run when the DAG is triggered. The attacker could then execute arbitrary operating system commands on the Airflow worker.
Originally disclosed on HackerOne
- Triaged in 5 days
- Fixed in 47 days
- Paid in 47 days
- Disclosed after 3 months
Summary by the program
Full Security Advisory Link: https://lists.apache.org/thread/0mcwqw8cpxjtf0n789hto95rgnf7bk0f
The report
Summary
Command injection vulnerability in read_dataset_event_from_classic DAG executes bash command based on Dataset("s3://output/1.txt") but attacker with User privileges can inject OS command inside s3://output/1.txt dataset to execute any OS command.
Requirements
- Airflow version 2.10.0
- DAG: example_inlet_event_extra.py
- A user with
create DatasetandDAG triggerpermissions
Step to reproduce
- Login to
Userpermission account.

- Inject malicous command into
s3://output/1.txtdataset via the request as show below:
POST /api/v1/datasets/events HTTP/1.1
Host: 192.168.168.129:8080
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0
Accept: application/json
Accept-Language: vi-VN,vi;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Referer: http://192.168.168.129:8080/datasets?uri=s3%3A%2F%2Foutput%2F1.txt
Cookie: session=<authen-cookie>
Content-Type: application/json
Content-Length: 62
{"dataset_uri":"s3://output/1.txt","extra":{"hi":" '$(gnome-calculator)' "}}


- Go to
DAGlist and triggerread_dataset_event_from_classicDAG

- Go to
read_dataset_event_from_classictask log to see the output returned.

Impact
Execute any OS command
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
Root cause
Likely the example DAG interpolates the dataset URI and its extra metadata into a bash command without escaping or validation, so shell metacharacters in the data are executed.
Impact
An authenticated user with dataset creation and DAG trigger rights could execute arbitrary OS commands on the Airflow deployment.
What the attacker needed
Airflow 2.10.0; example_inlet_event_extra.py DAG present; account with dataset create and DAG trigger rights
How it was found
- Log in with an account that has User permissions.
- Send a request to the datasets events API that registers a dataset URI carrying an injected command in its extra data.
- Trigger the read_dataset_event_from_classic DAG from the DAG list.
- Open the task log to see the command output.
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.
Airflow runs scheduled jobs called DAGs, and one example DAG reads a dataset address and passes it into a shell command. Because the address is not cleaned, someone who can register a dataset can hide an extra command in it, and the shell runs that command too when the job starts. This is called command injection: untrusted text reaching a shell.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.