Jenkins功能未授权访问导致的远程命令执行漏洞
Jenkins功能未授权访问导致的远程命令执行漏洞
一、漏洞介绍
Jenkins管理登陆之后,后台”系统管理”功能,有个”脚本命令行的”功能,它的作用是执行用于管理或故障探测或诊断的任意脚本命令,利用该功能,可以执行系统命令,该功能实际上Jenkins正常的功能,由于很多管理账号使用了弱口令,或者管理后台存在未授权访问,导致该功能会对Jenkins系统服务器产生比较严重的影响和危害。
二、漏洞危害
三、漏洞验证
找到“系统管理”——“脚本命令行”。
Type in an arbitrary Groovy script and execute it on the server. Useful for trouble-shooting and diagnostics. Use the
println
command to see the output (if you useSystem.out
, it will go to the server’s stdout, which is harder to see.) Example:println(Jenkins.instance.pluginManager.plugins)
All the classes from all the plugins are visible. jenkins., jenkins.model., hudson., and hudson.model. are pre-imported.
输入任意的Groovy脚本并在服务器上执行它。对于故障排除和诊断很有用。使用’println’命令查看输出(如果使用
System.out
,它将输出到服务器的标准输出,很难看到。)示例:println(Jenkins.instance.pluginManager.plugins)
在脚本命令行中输入下面的语句,即可执行相应的命令:println "whoami".execute().text
println "ifconfig".execute().text
四、漏洞修复
屏蔽未授权IP访问,或者配置Jenkins验证。
参考链接:
http://www.rinige.com/index.php/archives/186/
http://www.nxadmin.com/penetration/1372.html