首页
技术服务
  • 网络安全等级保护测评
  • 软件测试
  • 全生命周期安全保障
  • 实战攻防
培训赛事
  • 培训中心介绍
  • 赛事活动
  • 校企合作
  • 培训服务
  • 预约咨询
合作单位
  • 党政机关
  • 能源行业
  • 医疗行业
  • 教育行业
  • 重点用户
新闻中心
  • 企业动态
  • 行业资讯
  • 漏洞报告
人才招聘
  • 团队风采
  • 招聘信息
关于我们
  • 企业介绍
  • 企业文化
  • 发展历程
  • 荣誉资质
  • 公正性声明
  • 洽谈联系
新闻中心 漏洞报告
相关新闻
  • 2024-06-12

    CVE-2024-4577 PHP CGI远程代码执行漏洞分析

  • 2024-03-26

    CVE-2023-38545 curl & libcurl堆缓冲区溢出漏洞分析

  • 2022-04-29

    关于Apache Struts2存在远程代码执行漏洞的安全通告

  • 2021-03-05

    记一次渗透测试

【漏洞通告】Apache Airflow命令注入分析复现(CVE-2020-11978)
2020-07-31

一、漏洞背景

Airflow是一个可编程,调度和监控的工作流平台,它采用python语言编写,基于有向无环图(DAG),airflow可以定义一组有依赖的任务,按照依赖依次执行。airflow提供了丰富的命令行工具用于系统管控,而其web管理界面同样也可以方便的管控调度任务,并且对任务运行状态进行实时监控,方便了系统的运维和管理。

2020年7月14日,公布了CVE-2020-11978。按照cve mitre的描述,漏洞产生自Airflow自带的示例DAG中。

1635211707(1).jpg


二、漏洞分析

example_trigger_target_dag代码

# -*- coding: utf-8 -*-

#

# Licensed to the Apache Software Foundation (ASF) under one

# or more contributor license agreements.  See the NOTICE file

# distributed with this work for additional information

# regarding copyright ownership.  The ASF licenses this file

# to you under the Apache License, Version 2.0 (the

# "License"); you may not use this file except in compliance

# with the License.  You may obtain a copy of the License at

#

#   http://www.apache.org/licenses/LICENSE-2.0

#

# Unless required by applicable law or agreed to in writing,

# software distributed under the License is distributed on an

# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

# KIND, either express or implied.  See the License for the

# specific language governing permissions and limitations

# under the License.

import pprint

from airflow.models import DAG

from airflow.operators.bash_operator import BashOperator

from airflow.operators.python_operator import PythonOperator

from airflow.utils.dates import days_ago

pp = pprint.PrettyPrinter(indent=4)

# This example illustrates the use of the TriggerDagRunOperator. There are 2

# entities at work in this scenario:

# 1. The Controller DAG - the DAG that conditionally executes the trigger

#    (in example_trigger_controller.py)

# 2. The Target DAG - DAG being triggered

#

# This example illustrates the following features :

# 1. A TriggerDagRunOperator that takes:

#   a. A python callable that decides whether or not to trigger the Target DAG

#   b. An optional params dict passed to the python callable to help in

#      evaluating whether or not to trigger the Target DAG

#   c. The id (name) of the Target DAG

#   d. The python callable can add contextual info to the DagRun created by

#      way of adding a Pickleable payload (e.g. dictionary of primitives). This

#      state is then made available to the TargetDag

# 2. A Target DAG : c.f. example_trigger_target_dag.py

dag = DAG(

    dag_id="example_trigger_target_dag",

    default_args={"start_date": days_ago(2), "owner": "Airflow"},

    schedule_interval=None,

    tags=['example']

)

def run_this_func(ds, **kwargs):

    print("Remotely received value of {} for key=message".        format(kwargs['dag_run'].conf['message']))

run_this = PythonOperator(

    task_id='run_this',

    provide_context=True,

    python_callable=run_this_func,

    dag=dag,

)

# You can also access the DagRun object in templates

bash_task = BashOperator(

    task_id="bash_task",

    bash_command='echo "Here is the message: '

                 '{{ dag_run.conf["message"] if dag_run else "" }}" ',

    dag=dag,

)

    print("Remotely received value of {} for key=message".format(context["dag_run"].conf["message"]))
run_this = PythonOperator(task_id="run_this", python_callable=run_this_func, dag=dag)
bash_task = BashOperator(
    task_id="bash_task",
    bash_command='echo "Here is the message: \'{{ dag_run.conf["message"] if dag_run else "" }}\'"',
    dag=dag,

可以明显看到example_trigger_target_dag的代码中的

bash_command='echo "Here is the message: '

                 '{{ dag_run.conf["message"] if dag_run else "" }}" '

     存在命令执行。也就是说,我们只要能够控制dag_run.conf的数据,就能实现命令注入。

     而Airflow中,提供了一个Trigger DAG供开发者进行修改配置,也就是修改conf的模块。此时,我们便可以构造命令注入payload从而进行命令执行。


三、漏洞复现

我们需要构造语句进行命令绕过注入,重写conf构造形式如下

{"message":"'\";code;#"}

执行效果如下

1635211736(1).jpg


四、影响版本

漏洞影响 Apache Airflow 小于1.10.11的版本


五、修复方式


1、 对管理界面添加身份认证

2、删除受影响的example_trigger_target_dag和example_trigger_controller_dag

3、升级Apache Airflow到1.10.11

Previous

暂无

Next

关于通达OA前台SQL注入到getshell利用思路

联系我们

地址:
总部地址:武汉市洪山区欢乐大道9号正堂时代28层
培训中心地址:武汉市东西湖区径河街道国家网络安全人才与创新基地培训中心1期
热线:
18627879046
027-88879416
邮箱:
whay@wuhananyu.com

技术服务

实战攻防
全生命周期安全保障
软件测试
网络安全等级保护测评

培训赛事

培训中心介绍
赛事活动
校企合作
培训服务
预约咨询

人才招聘

招聘信息
团队风采

投诉与监督:
027-88879416

关注我们
返回顶部
版权所有 Copyright @   2010-2014武汉安域信息安全技术有限公司       鄂ICP备16004959号      
   鄂公网安备 42018502000535号
技术支持:幸运坐标     免责声明