未授权访问可以理解为需要安全配置或权限认证的地址、授权页面存在缺陷,导致其他用户可以直接访问,从而引发重要权限可被操作、数据库、网站目录等敏感信息泄露。
目前主要存在未授权访问漏洞的有:NFS 服务,Samba 服务,LDAP,Rsync,FTP,GitLab,Jenkins,MongoDB,Redis,ZooKeeper,ElasticSearch,Memcache,CouchDB,Docker,Solr,Hadoop,Dubbo 等
未授权漏洞链接参考https://www.cnblogs.com/hkgan/p/17370696.html
Druid未授权访问漏洞
访问https://ip/druid/index.html页面,如果未做访问限制则存在漏洞
ElasticSearch 未授权访问记录(端口:9200)
基本语法参考https://blog.51cto.com/feelmanc/1250430
转载https://mohen.blog.csdn.net/article/details/109628426
漏洞描述
Elasticsearch是一款java编写的企业级搜索服务。越来越多的公司使用ELK作为日志分析,启动此服务默认会开放9200端口或者9300端口,可被非法操作数据
漏洞利用
http://localhost:9200/_cat/indices
http://localhost:9200/_river
http://localhost:9200/_search
http://localhost:9200/_river/_search //查看数据库敏感信息
http://localhost:9200/_nodes //查看节点数据
如有安装head插件http://localhost:9200/_plugin/head/ //web管理界面
首先找有多少数据库(其实是index,这里类比为数据库)
http://xxxx:9200/_cat/indices?v
然后找数据库中有多少数据表(其实是type,类比为数据表) // 数据表中mapping下一级目录,除了 default 都是 type
http://xxxxxx:9200/_mapping?pretty=true
查看具体数据
http://xxxx:9200/Index/Type/Id
默认值返回10条数据,需要则修改 size // 未测试,因为数据,一般十条就够干很多事情了 :)
{
"query" : { "match" : { "desc" : "管理" }},
"size": 1
}'
除了查看数据资源,还存在低版本命令执行
ES未授权访问漏洞复现利用
漏洞加固
1、限制IP访问,绑定固定IP
2、防火墙上设置禁止外网访问 9200 端口。
3、使用 Nginx 搭建反向代理,通过配置 Nginx 实现对 Elasticsearch 的认证
4、在config/elasticsearch.yml中为9200端口设置认证
http.basic.enabled true #开关,开启会接管全部HTTP连接
http.basic.user "admin" #账号
http.basic.password "admin_pw" #密码
http.basic.ipwhitelist ["localhost", "127.0.0.1"]
- 安装认证插件
wget https://github.com/Asquera/elasticsearch-http-basic/releases/download/v1.1.0/elasticsearch-http-basic-1.1.0.jar //下载es认证插件
- 添加账号密码
http.basic.log: false
http.basic.user: "loguser"
http.basic.password: "logpwd"
http.basic.ipwhitelist: ["172.16.18.171","172.16.18.114"]
http.basic.xforward: "X-Forwarded-For"
http.basic.trusted_proxy_chains: ["172.16.18.114"]
</