Summary
This was an Apache Airflow exploitation task centered on a vulnerable example DAG. The bug was a command injection in a helper that copied a JSON field directly into a shell command.
By controlling the response that Airflow fetched, it was possible to inject shell syntax into the origin value and run arbitrary commands in the worker context.
Analysis
The important code path was a function that built a Bash command from the origin field in a JSON response. Because that value was inserted directly into a quoted command string, closing the quote was enough to append a second command.
The write-up showed the exact output once the injected command fired:

Relevant vulnerable pattern:
1
2
3
4
5
def prepare_command(raw_json: dict[str, Any]) -> dict[str, str]:
external_ip = raw_json["origin"]
return {
"command": f"echo 'Seems like today your server executing Airflow is connected from IP {external_ip}'",
}
Because external_ip is interpolated directly into a shell string, an attacker-controlled value can break out of the quotes and append a second command.
Exploitation
The solve path was:
- Host a malicious HTTP response.
- Make Airflow request that server.
- Inject shell syntax through the
originfield. - Run
cat /flag.txtin the task context. - Read the flag from the task output.
Observed output:
1
2
Seems like today your server executing Airflow is connected from IP
CTF{2539590147b12b33dfd9d0bc65c86aec525af4d4dd9c997258d57b09c9adf16d}
Flag
CTF{2539590147b12b33dfd9d0bc65c86aec525af4d4dd9c997258d57b09c9adf16d}