Skip to content
RCE Disclosed report Intermediate CVE-2024-45498

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.

nhienit2010 Follow

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 Dataset and DAG trigger permissions

Step to reproduce

  1. Login to User permission account.
5.png
5.png From the original on HackerOne
  1. Inject malicous command into s3://output/1.txt dataset 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)' "}}
2.png
2.png From the original on HackerOne
3.png
3.png
  1. Go to DAG list and trigger read_dataset_event_from_classic DAG
6.png
6.png From the original on HackerOne
  1. Go to read_dataset_event_from_classic task log to see the output returned.
4.png
4.png From the original on HackerOne

Impact

Execute any OS command

Attachments

1.png
1.png From the original on HackerOne

The original report as published on HackerOne, by nhienit2010. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

  1. Log in with an account that has User permissions.
  2. Send a request to the datasets events API that registers a dataset URI carrying an injected command in its extra data.
  3. Trigger the read_dataset_event_from_classic DAG from the DAG list.
  4. 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.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.