Skip to content
SQL injection Disclosed report Intermediate

Apache Airflow Sql injection by authenticated user

The SQLTableCheckOperator in Apache Airflow's Common SQL Provider built SQL queries using a partition clause parameter that could be supplied by a UI user, allowing that authenticated user to inject arbitrary SQL. This let a DAG-triggering user escalate privileges and execute commands they normally could not.

nxczje Follow

Originally disclosed on HackerOne

Bounty$505 Low View original
  • Fixed in 22 days
  • Paid in 22 days
  • Disclosed after 52 days

Summary by the program

Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') vulnerability in Apache Airflow Common SQL Provider.

When using the partition clause in SQLTableCheckOperator as parameter (which was a recommended pattern), Authenticated UI User could inject arbitrary SQL command when triggering DAG exposing partition_clause to the user. This allowed the DAG Triggering user to escalate privileges to execute those arbitrary commands which they normally would not have.

https://lists.apache.org/thread/7tbt8j8d291q3l1rpqs2swdf02rsq5jb

The report

Apache Airflow, versions 2.10.5, is affected by a vulnerability that allows an attacker can manipulate query construction, leading to an SQL Injection vulnerability that may result in remote code execution.

Impact

The DAGS that use the SQLColumnCheckOperator in the system will remote code execution.

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

Apache Airflow is a workflow orchestrator: users define DAGs (directed acyclic graphs) in Python, and Airflow schedules and runs the tasks inside them. The Apache Airflow Common SQL Provider ships operators that build SQL statements for you, so a DAG author does not have to hand-write every query. Two of these operators matter here: SQLTableCheckOperator and SQLColumnCheckOperator.

The vulnerability is an SQL injection in the Common SQL Provider, classified as improper neutralisation of special elements used in an SQL command. The affected asset is the Apache Airflow repository, and the report names version 2.10.5 as affected.

The trigger is the partition clause of SQLTableCheckOperator passed as a parameter, which the program describes as a recommended pattern. When a DAG exposes partition_clause to the user, an authenticated UI user can inject arbitrary SQL while triggering the DAG.

Setup

The precondition is an authenticated Airflow UI user who is able to trigger a DAG. The DAG must use SQLTableCheckOperator with the partition clause supplied as a parameter, and that partition_clause value must be reachable from the user, for example through the DAG trigger form. The report gives no further detail on the environment, the Airflow deployment, the database backend or the account configuration used.

Finding it

The researcher's report states that the query construction can be manipulated, producing an SQL injection that may lead to remote code execution. The interesting part is the trust boundary: the partition clause is a parameter of the operator, and passing it as a parameter was a recommended pattern, so a DAG author following the documentation would expose a value that ends up in the generated SQL without being treated as untrusted input.

Exploitation

The report does not include the individual requests, payloads or responses. What it describes is the sequence below.

Step 1: reach a DAG that exposes the partition clause

An authenticated UI user triggers a DAG whose SQLTableCheckOperator receives its partition clause as a parameter, with that parameter exposed to the triggering user.

Step 2: supply a crafted partition clause

Instead of a normal partition expression, the user supplies a value containing SQL that the operator places into the query it builds. Because the value is not neutralised, the injected SQL becomes part of the statement the operator executes.

Step 3: the injected command runs with the task's privileges

The DAG runs the constructed query against the configured database. The injected command executes in that context, which is what lets the triggering user escalate beyond what their own Airflow permissions would normally allow.

Root cause

The operator builds SQL by placing the partition clause into the query text without neutralising special elements, so a value that was meant to be data is interpreted as SQL. The partition clause was passed as a parameter, a recommended pattern, and when a DAG exposed it to the user, an authenticated UI user could inject arbitrary SQL.

Impact

The program's summary is precise about the boundary: an authenticated UI user who can trigger a DAG exposing partition_clause can inject arbitrary SQL, and this lets that user escalate privileges to execute commands they normally would not have. The researcher's report goes further and says the vulnerability may result in remote code execution, and that DAGs using SQLColumnCheckOperator in the system will remote code execution. The severity assigned by the program is low, with a bounty of 505.00 USD.

Fix

The report does not describe the code change. The summary links to an Apache mailing list thread about the issue.

Variants to test

  1. Other operators in the same provider that accept SQL fragments as parameters: pass a value containing a quote and a statement terminator, and check whether the generated query changes structure or errors in a way that reveals the fragment was concatenated.
  2. Any DAG trigger form that exposes a parameter later used in a query: submit a value with SQL syntax and observe whether the task's query reflects it.
  3. Partition and filter clauses in table and column check operators: a positive result is a task run whose executed SQL contains the injected fragment rather than treating it as a literal.

Hunting notes

This kind of bug hides where a framework builds SQL from configuration or operator parameters that are assumed to be developer-controlled, and then a UI or API exposes those parameters to a less privileged user. During recon, look for DAGs with parameters surfaced in the trigger form, especially ones whose names suggest SQL fragments such as partition or filter clauses. The impact is the privilege boundary: the triggering user gains the ability to run SQL they could not otherwise run.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

What happened, in plain words

Apache Airflow is a tool that runs scheduled jobs for you. You describe the jobs in a programming language called Python, and Airflow takes care of running them at the right time. The jobs are grouped into a DAG, which stands for directed acyclic graph: a set of tasks with an order, where each task runs after the ones it depends on. Think of it as a recipe with numbered steps that Airflow follows on a schedule.

Airflow ships with extra packages called providers. One of them, the Common SQL Provider, contains ready-made building blocks called operators that write SQL statements for you. SQL is the language used to talk to databases (the systems that store and look up data). Two operators matter here: SQLTableCheckOperator and SQLColumnCheckOperator. They check that data in a table looks right, for example that a table has rows, or that a column has no empty values.

The problem is an SQL injection. That is a class of bug where a program takes a piece of text meant to be plain data and pastes it into an SQL command, so that the text is read as part of the command instead. A simple comparison: imagine a form that asks for your name and then prints "Hello, [your name]". If you type Alice. Now delete all files, a badly built program might treat the second sentence as an instruction rather than as part of your name. SQL injection is the same idea, but the instructions are database commands.

In this case the vulnerable spot is the partition clause of SQLTableCheckOperator. A partition clause is a piece of SQL that narrows a query to a slice of the data, for example only rows from one day. Passing it as a parameter was a recommended pattern, meaning the Airflow documentation encouraged DAG authors to do it that way. When a DAG exposes that partition_clause value to the user, an authenticated user of the Airflow web interface (someone who has logged in) can slip extra SQL into it while triggering the DAG. The result is that this user can run database commands they normally would not be allowed to run, which is a privilege escalation: gaining more power than your account should have.

The report names Apache Airflow version 2.10.5 as affected. The program rated the issue low severity and paid a bounty of 505.00 USD. The Apache Security Team published an advisory, linked from the summary.

Context

Apache Airflow is a workflow orchestrator: users define DAGs in Python, and Airflow schedules and runs the tasks inside them. The Apache Airflow Common SQL Provider ships operators that build SQL statements for you, so a DAG author does not have to hand-write every query. Two of these operators matter here: SQLTableCheckOperator and SQLColumnCheckOperator.

The vulnerability is an SQL injection in the Common SQL Provider, classified as improper neutralisation of special elements used in an SQL command. "Neutralisation" means making a piece of text safe before using it, for example by escaping characters that have special meaning in SQL, such as quotes. If that step is skipped, special characters keep their power and the text can change the command.

The affected asset is the Apache Airflow repository, and the report names version 2.10.5 as affected.

The trigger is the partition clause of SQLTableCheckOperator passed as a parameter, which the program describes as a recommended pattern. When a DAG exposes partition_clause to the user, an authenticated UI user can inject arbitrary SQL while triggering the DAG.

Setup

The precondition is an authenticated Airflow UI user who is able to trigger a DAG. "Authenticated" simply means logged in with a valid account. "Triggering a DAG" means pressing the button (or using the interface) that tells Airflow to run that workflow now.

The DAG must use SQLTableCheckOperator with the partition clause supplied as a parameter, and that partition_clause value must be reachable from the user, for example through the DAG trigger form. The trigger form is the page in the Airflow web interface where you fill in values before starting a run. If a parameter appears there, the person pressing the button controls it.

The report gives no further detail on the environment, the Airflow deployment, the database backend or the account configuration used.

Finding it

The researcher's report states that the query construction can be manipulated, producing an SQL injection that may lead to remote code execution. Remote code execution means running your own commands on the server, not just reading or changing data. The interesting part is the trust boundary: the line between data the system trusts and data it should not. The partition clause is a parameter of the operator, and passing it as a parameter was a recommended pattern, so a DAG author following the documentation would expose a value that ends up in the generated SQL without being treated as untrusted input.

Exploitation

The report does not include the individual requests, payloads or responses. What it describes is the sequence below.

Step 1: reach a DAG that exposes the partition clause

An authenticated UI user triggers a DAG whose SQLTableCheckOperator receives its partition clause as a parameter, with that parameter exposed to the triggering user. This step matters because the bug only becomes reachable when the value can come from the person pressing the button rather than from the DAG author's code.

Step 2: supply a crafted partition clause

Instead of a normal partition expression, the user supplies a value containing SQL that the operator places into the query it builds. Because the value is not neutralised, the injected SQL becomes part of the statement the operator executes. In everyday terms: the operator was expecting a label for a slice of data, and it got a label plus extra instructions.

Step 3: the injected command runs with the task's privileges

The DAG runs the constructed query against the configured database. The injected command executes in that context, which is what lets the triggering user escalate beyond what their own Airflow permissions would normally allow. The injected command executes in the context of the task, which lets the triggering user escalate beyond their own Airflow permissions.

Root cause

The operator builds SQL by placing the partition clause into the query text without neutralising special elements, so a value that was meant to be data is interpreted as SQL. The partition clause was passed as a parameter, a recommended pattern, and when a DAG exposed it to the user, an authenticated UI user could inject arbitrary SQL.

Impact

The program's summary is precise about the boundary: an authenticated UI user who can trigger a DAG exposing partition_clause can inject arbitrary SQL, and this lets that user escalate privileges to execute commands they normally would not have. The researcher's report goes further and says the vulnerability may result in remote code execution, and that DAGs using SQLColumnCheckOperator in the system will remote code execution. The severity assigned by the program is low, with a bounty of 505.00 USD.

Fix

The report does not describe the code change. The summary links to an Apache mailing list thread about the issue.

Variants to test

These are ideas for looking for the same kind of mistake elsewhere. Each one follows the same logic: put SQL-looking text where the program expects plain data, then watch whether the program treats it as an instruction.

  1. Other operators in the same provider that accept SQL fragments as parameters: pass a value containing a quote and a statement terminator, and check whether the generated query changes structure or errors in a way that reveals the fragment was concatenated. A quote can end a piece of text early in SQL, and a statement terminator (a semicolon) can start a new statement.
  2. Any DAG trigger form that exposes a parameter later used in a query: submit a value with SQL syntax and observe whether the task's query reflects it.
  3. Partition and filter clauses in table and column check operators: a positive result is a task run whose executed SQL contains the injected fragment rather than treating it as a literal.

Hunting notes

This kind of bug hides where a framework builds SQL from configuration or operator parameters that are assumed to be developer-controlled, and then a UI or API exposes those parameters to a less privileged user. An API is the interface a program offers so other programs can talk to it; here the point is simply that a value can arrive from outside the developer's code. During recon (the early exploration phase of a test), look for DAGs with parameters surfaced in the trigger form, especially ones whose names suggest SQL fragments such as partition or filter clauses. The impact is the privilege boundary: the triggering user gains the ability to run SQL they could not otherwise run.

Glossary

  • Apache Airflow: an open-source tool that schedules and runs workflows made of tasks.
  • DAG (directed acyclic graph): a set of tasks with dependencies and a fixed order, with no loops, used by Airflow to describe a workflow.
  • Provider: an add-on package for Airflow that adds support for a particular system, such as databases.
  • Operator: a reusable building block in Airflow that performs one kind of task, such as running a SQL check.
  • SQL: the language used to query and modify data in relational databases.
  • SQL injection: a bug where untrusted text is pasted into an SQL command and read as part of the command instead of as data.
  • Improper neutralisation of special elements: the formal name for not making special characters (quotes, semicolons) harmless before using text in a command.
  • Partition clause: a piece of SQL that restricts a query to a slice of the data, for example one day's rows.
  • Parameter: a value supplied to a function or operator from outside, rather than written directly in its code.
  • Authenticated user: someone who has logged in with a valid account.
  • Trigger (a DAG): to start a run of a workflow, often from a form in the web interface.
  • Trigger form: the page in the Airflow web interface where values are entered before starting a run.
  • Trust boundary: the line between data the system trusts and data it must treat as untrusted.
  • Privilege escalation: gaining access or abilities beyond what your account is supposed to have.
  • Remote code execution: running your own commands on a server, rather than only reading or changing data.
  • API: an interface that lets one program talk to another.
  • Recon: the early exploration phase of a security test, where you map out what is reachable.
  • Advisory: a public notice from a vendor describing a security issue and its fix.
  • Bounty: a payment made to a researcher who reports a valid security issue.

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.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.