Leak of sensitive values to Airflow rendered template
A vulnerability in Apache Airflow's UI allowed unmasked secrets to be displayed in rendered template values for tasks that were not executed, such as when a task was skipped due to depends_on_past and a previous failure. An attacker could view sensitive values like connection passwords.
- Fixed in 12 days
- Paid in 12 days
- Disclosed after 42 days
Summary by the program
##Description:
A vulnerability in UI of Apache Airflow allows an attacker to view unmasked secrets in rendered template values for tasks which were not executed (for example when they were depending on past and previous instances of the task failed). This issue affects Apache Airflow prior to 2.3.1.
##References:
https://github.com/apache/airflow/pull/22754
The report
I’m just getting started with Airflow, but seem to have got into a situation where sensitive values (e.g. connection passwords) end up in my task’s rendered template. Here’s how my DAG starts, having set up a connection called “secret” with a password specified:
t1 = BashOperator(
task_id="masked-in-rendered-template",
bash_command="echo {{ conn.secret.password }}",
)
t2 = BashOperator(
task_id="not-masked-in-rendered-template",
depends_on_past=True,
bash_command="echo {{ conn.secret.password }}",
#bash_command="fail {{ conn.secret.password }}"
)
t1 >> t2
I manually trigger this DAG and it runs as expected - it succeeds, and both the rendered template and log output show the password masked.
Next I swap t2's bash_command for the one intended to fail and manually trigger the DAG again. It also runs as expected, failing but with the password masked in both the rendered template and the log output.
Next, I manually trigger the DAG again (no changes). This time, since depends_on_past is true for t2, t1 executes fine, but t2 is not scheduled (it shows not yet started in the UI). However, if I click on t2 in the graph view and look at the rendered template, it shows the password unmasked.
Finally, if I swap the lines back again and manually trigger (so t2 succeeds), all the running DAGs complete and the output is masked,
My guess is this is a race hazard - the third invocation of t2 won't run (since depends_on_past=True and it previously failed), but the masking code comes at some point later.
I am running Airflow v2.2.4 on CentOS 7 & Python 3.9
Impact
Learn sensitive values (e.g. database passwords, API keys etc) from rendered templates
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 a race condition where the masking of sensitive values in rendered templates occurs after the template is displayed for tasks that are not executed.
Impact
An attacker could learn sensitive values such as database passwords or API keys from rendered templates.
What the attacker needed
Access to Airflow UI; a DAG with depends_on_past and a failed task; a connection with sensitive values
The fix
The issue affects Apache Airflow versions prior to 2.3.1.
How it was found
- Set up a connection with a password.
- Create a DAG with two tasks: t1 and t2, where t2 depends on past and uses the connection password in its bash command.
- Trigger the DAG; both tasks run and the password is masked in rendered templates and logs.
- Modify t2's command to fail, trigger the DAG; t2 fails but password remains masked.
- Trigger the DAG again without changes; t1 runs, t2 is not scheduled due to depends_on_past, and viewing t2's rendered template shows the password unmasked.
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 and running data workflows. When a task runs, it can show a 'rendered template' that includes values from connections, which may contain passwords. Normally these passwords are hidden (masked), but in some cases when a task is not executed, the password was shown in plain text, letting someone see secrets they should not.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.