信息收集初步 (Open Source Intelligence)

1.基于DNS与IP的信息收集

1.1 whois

1
whois testfire.net

1.2 nslookup

1
2
3
4
5
6
7
8
9
10
11
➜ ~ nslookup
> set type=A
> baidu.com
Server: 127.0.1.1
Address: 127.0.1.1#53
Name: baidu.com
Address: 183.207.95.143
Name: baidu.com
Address: 183.207.95.144
> exit

1.3 dig

1
2
dig @<dns服务器> <待查询域名>
dig @ns.watson.ibm.com testfire.net

1.4 ip2location

GeoIP http://www.maxmind.com/
国内
http://www.cz88.net/

1.5 子域名查询

http://searchdns,netcraft.com/
http://toolbar.netcraft.com/site_report?url=http://www.testfire.net

1.6 ip2domain 反查域名

http://www.ip-address.com/reverse_ip/
国内
http://www.7c.com/

此阶段进阶参考资料
OSINT(Open Source INTelligence)

2.基于搜索引擎

2.1 Google hacking

SiteDigger
Search Diggity

2.2 探索网站的目录结构

2.2.1 搜索关键词

parent directory site:testfire.net

inc:配置文件,或包含数据库用户名与口令
bak:备份文件
txt/sql:暴露数据库结构

2.2.2 metasploit dir scanner

Metasploit auxiliary 中的 brute_dirs,dir_listing,dir_scanner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
msf > use auxiliary/scanner/http/dir_scanner
msf auxiliary(dir_scanner) > set THREADS 50
THREADS => 50
msf auxiliary(dir_scanner) > set RHOSTS www.testfire.net
RHOSTS => www.testfire.net
msf auxiliary(dir_scanner) > exploit
[*] Detecting error code
[*] Using code '404' as not found for 65.61.137.117
[*] Found http://65.61.137.117:80/Admin/ 404 (65.61.137.117)
[*] Found http://65.61.137.117:80/admin/ 404 (65.61.137.117)
[*] Found http://65.61.137.117:80/bank/ 404 (65.61.137.117)
[*] Found http://65.61.137.117:80/images/ 404 (65.61.137.117)
[*] Found http://65.61.137.117:80/static/ 404 (65.61.137.117)
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

根据robots.txt中指出不想被爬取的目录。

2.2.3 检索特定类型文件

site:testfire.net filetype:xls

除此以外, pdf,xlsx,doc,docx等也可以考虑。

2.2.4 搜索网站中的Email

metasploit search_email_collector

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
msf > use auxiliary/gather/search_email_collector
msf auxiliary(search_email_collector) > set DOMAIN altoromutual.com
DOMAIN => altoromutual.com
msf auxiliary(search_email_collector) > run
[*] Harvesting emails .....
[*] Searching Google for email addresses from altoromutual.com
[*] Extracting emails from Google search results...
[*] Searching Bing email addresses from altoromutual.com
[*] Extracting emails from Bing search results...
[*] Searching Yahoo for email addresses from altoromutual.com
[*] Extracting emails from Yahoo search results...
[*] Located 1 email addresses for altoromutual.com
[*] test@altoromutual.com
[*] Auxiliary module execution completed

2.2.5 SQL注入点

搜索关键词
site:testfire.net inurl:login
site:sina.com inurl:login

intext:请于用于非法用途,后果作者概不负责!

邮箱及其他信息收集

信息收集系列之—重量级信息收集工具!
作者: 野驴
i春秋社区

主页地址:http://www.spiderfoot.net
项目地址:https://github.com/smicallef/spiderfoot

http://mp.weixin.qq.com/s?src=3&timestamp=1488468616&ver=1&signature=JlOYG1I7j-uZsPWrS11vIjHxM-gTtlcOrU-4PnAHiqkl7PKXjaF5TW6-6Ys*mybOJ2lWfreTTi80zC-CEA3r6kounTpY2EYwO1kR*Eaoz7fZGxVCazTstWhFJJOoJDzF39WGgeNr83qacL2jr*ZqsFdu1hifwllE26FkVa6hvKY=

Kali 信息收集工具

http://www.cnblogs.com/dunitian/p/5075550.html
Kali信息收集系列:(都是我以前的笔记整理了一下,就没加水印,习惯就好)

信息收集标准化

我眼中的渗透测试信息搜集 - icq6a70641f
http://bbs.ichunqiu.com/thread-16020-1-1.html

渗透测试标准化
PTES渗透测试执行标准 (诸葛建伟翻译)

0X00前言

渗透测试按照PETS执行标准(http://www.doc88.com/p-7784047461299.html)来说,分为7个阶段,信息搜集阶段占很大的比重,本篇结合自己的一些实例来展开渗透测试中的信息搜集阶段。

0X01我们都关注什么
Whois,真实ip,子域,端口,服务,关联度高的目标,备案,企业资料,历史漏洞,员工邮箱

whois和子域,备案
http://www.freebuf.com/articles/system/58096.html
http://www.dmzlab.com/77396.html
关于kali下的信息搜集,其实这类文章都很齐全了,上面链接可以参考,主要涉及到whois,dnsenum,dig,host,dnsdict6,fierce,dmitry,maltego,theharvester,foca

########[关于kali下使用信息搜集系列工具,需要调用google,所以kali连上vpn,笔者采用的是自己的美国vps,搭的一个基于pptp协议的vpn,当然你也可以用物理机翻墙,虚拟机nat连接,都是可行的方案]########
子域搜集篇参考(http://www.freebuf.com/articles/web/117006.html)
主要涉及google hacking语法采集,暴力猜解,基于https证书,DNS,遇到域传送就更好了,crossdomain.xml文件
需要补充的一几点(ICP备案和app里的子域和威胁情报平台子域及第三方子域)
http://www.beianbeian.com/search-1/%E4%BA%ACICP%E8%AF%81030173%E5%8F%B7查备案

App里的那些二级或者多级子域

威胁情报平台里的那些子域
威胁感知里的那些子域

第三方

端口和服务

nmap -sT -P0 -sV -O –script=banner -p T:21-25,80-89,110,143,443,513,873,1080,1433,1521,1158,3306-3308,3389,3690,5900,6379,7001,8000-8090,9000,9418,27017-27019,50060,111,11211,2049 只扫一些常见端口,极大增强效率

nmap检测web漏洞
cd /usr/share/nmap/scripts/
wget http://www.computec.ch/projekte/ … _vulscan-2.0.tar.gz && tar xzf nmap_nse_vulscan-2.0.tar.gz
nmap -sS -sV –script=vulscan/vulscan.nse target
nmap -sS -sV –script=vulscan/vulscan.nse –script-args vulscandb=scipvuldb.csv target
nmap -sS -sV –script=vulscan/vulscan.nse –script-args vulscandb=scipvuldb.csv -p80 target
nmap -PN -sS -sV –script=vulscan –script-args vulscancorrelation=1 -p80 target
nmap -sV –script=vuln target
nmap -PN -sS -sV –script=all –script-args vulscancorrelation=1 target
根据端口服务来方便下一个阶段的攻击

github和svn

http://www.freebuf.com/sectool/107996.htmlgithub技巧
http://www.2cto.com/article/201407/318742.htmlgithub使用技巧http://www.myhack58.com/Article/html/3/7/2015/69241.htmBBscan敏感信息及文件扫描
真实ip

绕过CDN查看网站真实IP的一些办法 (参考lovesec公众号的)
1、验证是否存在CDN最简单的办法
通过在线的多地ping,通过每个地区ping的结果得到IP
看这些IP是否一致,如果都是一样的,极大可能不存在cdn,但不绝对
如果这些IP大多都不太一样或者规律性很强,可以尝试查询这些IP的归属地,判断是否存在CDN
0、验证IP和域名是否真实对应最简单的办法 修改本地hosts文件,强行将域名与IP解析对应
然后访问域名查看页面是否变化
1、ping
假设如下存在cdn
➜ ~ ping www.sysorem.xyz
PING 539b1c6d114eec86.360safedns.com (221.204.14.177): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
可以尝试➜ ~ ping sysorem.xyz
很多厂商可能让www使用cdn,空域名不使用CDN缓存。
所以直接ping sysorem.xyz可能就能得到真实IP
2、分站域名
很多网站主站的访问量会比较大。所以往往主站都是挂了CDN的
但是分站就不一定了,毕竟CDN要钱,而且也不便宜
所以可能一些分站就没有挂CDN,所以有时候可以尝试通过查看分站IP
可能是同个IP或者同个站都是没准的。Zoomeye.org, shodan.io ,fofa.so,微步在线,是我们不错的选择,使用api效果更佳

3、国外访问
国内的CDN往往只会针对国内用户访问加速
所以国外就不一定了。因此通过国外代理访问就能查看真实IP了
或者通过国外的DNS解析,可能就能得到真实的IP
4、MX 及 邮件
mx记录查询,一般会是c段。
一些网提供注册服务,可能会验证邮件,
还有RSS订阅邮件、忘记密码等等
可能服务器本身自带sendmail可以直接发送邮件,当然使用第三方的除外(如网易、腾讯的等)
通过邮件发送地址往往也能得到服务器IP
当然这个IP也要验证是否为主站的
Web版的邮件管理,可以通过常看网页源代码看到IP
5、xss
同4、是让服务器主动连接我们的一种方式
6、找彩蛋phpinfo();之类的探针
你懂的,不解释
7、DOS
DDOS耗尽CDN流量、那么就会回源,这样就能得到真实IP
不设防的cdn 量大就会挂,高防cdn 要增大流量。
8、社会工程学
比如勾搭卖这CDN的客服妹子,他们可能有权限
或者查看域名注册方的一些信息如电话啊、邮件地址啊、姓名啊,
有时候会有些人注册一堆域名可以尝试从这些突破
9、查看历史
查看IP与域名绑定的历史记录,说不定就能找到使用CDN前的记录
http://www.17ce.com
http://toolbar.netcraft.com/site_report?url=
10、DNS社工库
这个同9,传闻有些人去买dns解析记录
11、cloudflare
http://www.freebuf.com/articles/web/41533.html
12.全网扫描
Zmap号称44分钟扫完全网。。

企业资料

详细的企业信息查询

历史漏洞

查询历史漏洞,我们就要借助乌云和补天了,nosec.org有一个乌云9W版本的,其他的乌云历史漏洞查询在cmcc.ml

Nosec.org你需要基础版才能体验哦,不过你可以提交威胁情报去获取金币兑换基础版的使用时间。

以前没改标题前,效果很好的,后来改标题了,大家懂的

社工库

S.70sec.org
Findmima.com

总结

总之以上是笔者在信息搜集阶段主要使用到的一些方法和技巧,有更多的技巧欢迎您的精彩回复哦。

0X02参考

http://www.freebuf.com/articles/system/58096.html
http://www.dmzlab.com/77396.html
http://www.freebuf.com/articles/web/117006.html
http://www.beianbeian.com
http://www.bangcle.com
http://haosec.cn
https://x.threatbook.cn/
http://www.zoomeye.org
http://www.shodan.io
http://www.fofa.so
http://www.haosec.cn
http://www.17ce.com
http://toolbar.netcraft.com/site_report?url=
http://www.17ce.com
http://www.tianyancha.com
http://nosec.org
http://cmcc.ml

参考资料

[1] Google Hacking for Penetration Testers - Johnny Long
[2] GHDB(Google Hacking Data Base)