Lucene search

K
hackerone
Happyhacking123H1:1671140
HistoryAug 16, 2022 - 3:02 p.m.

Internet Bug Bounty: CVE-2022-38362: Apache Airflow Docker Provider <3.0 RCE vulnerability in example dag

2022-08-1615:02:54
happyhacking123
hackerone.com
107

8.8 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

LOW

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

6.5 Medium

CVSS2

Access Vector

NETWORK

Access Complexity

LOW

Authentication

SINGLE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:N/AC:L/Au:S/C:P/I:P/A:P

0.001 Low

EPSS

Percentile

26.6%

Apache Airflow Docker’s Provider shipped with an example DAG that was vulnerable to (authenticated) remote code exploit of code on the Airflow worker host.

##Vulnerability summary:
In DAG script of airflow 2.3.3, there is a command injection vulnerability (RCE) in the script (example_docker_copy_data.py of docker provider), which can obtain the permission of the operating system.

source path:
airflow-2.3.3/airflow/providers/docker/example_dags/example_docker_copy_data.py

##Vulnerability details:
(1) Vulnerability principle:

  1. It can be seen from the source code of example_docker_copy_data.py script that there is the function of executing bash command, The parameter ‘source_location’ in the template expression {{params.source_location}} is externally controllable and rendered through the jiaja2 template:

{F1869746}

  1. Further analysis “from airflow.operators.bash import BashOperator” code, we can see bash_command parameter value will be executed as a bash script;

{F1869748}

(2)Vulnerability exploit:

  1. Enter the DAGs menu and start docker_sample_copy_data task, select “Trigger DAG w/ config”.

http://192.168.3.17:8080/trigger?dag_id=docker_sample_copy_data

{F1869749}

  1. To construct payload, we can separate commands with ‘;’, so as to inject any operating system commands to be executed(RCE).

{F1869750}

PAYLOAD:{"source_location":";touch /tmp/thisistest;"}, Then click trigger to execute the task.

{F1869755}

The final command is as follows:

find ;touch /tmp/thisistest; -type f -printf “%f\n” | head -1
“””

Through the log and server view, it can be seen that arbitrary command has been executed successfully.

{F1869756}

{F1869757}

Impact

An attacker can execute arbitrary commands on the airflow host.

How to be winner in bugbounty?

Try incredible fast Vulners Perimeter Scanner and find vulnerabilities and unnecessary ip and ports in network devices inside your network before anyone else.

Try Network Scanner

8.8 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

LOW

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

6.5 Medium

CVSS2

Access Vector

NETWORK

Access Complexity

LOW

Authentication

SINGLE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:N/AC:L/Au:S/C:P/I:P/A:P

0.001 Low

EPSS

Percentile

26.6%

Related for H1:1671140