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