0%

信息收集

信息收集

1. whois 查询

1.1 在线 whois 查询

通过whois来对域名信息进行查询,可以查到注册商、注册人、邮箱、DNS解析服务器、注册人联系电话等,因为有些网站信息查得到,有些网站信息查不到,所以推荐以下信息比较全的查询网站,直接输入目标站点即可查询到相关信息。
站长之家域名WHOIS信息查询地址 http://whois.chinaz.com/ 站长之家

爱站网域名WHOIS信息查询地址 https://whois.aizhan.com/ 爱站网

腾讯云域名WHOIS信息查询地址 https://whois.cloud.tencent.com/ 腾讯云

美橙互联域名WHOIS信息查询地址 https://whois.cndns.com/ 美橙互联

爱名网域名WHOIS信息查询地址 https://www.22.cn/domain/ 爱名网

易名网域名WHOIS信息查询地址 https://whois.ename.net/ 易名网

中国万网域名WHOIS信息查询地址 https://whois.aliyun.com/ 中国万网

西部数码域名WHOIS信息查询地址 https://whois.west.cn/ 西部数码

新网域名WHOIS信息查询地址 http://whois.xinnet.com/domain/whois/index.jsp 新网

纳网域名WHOIS信息查询地址 http://whois.nawang.cn/ 纳网

中资源域名WHOIS信息查询地址 https://www.zzy.cn/domain/whois.html 中资源

三五互联域名WHOIS信息查询地址 https://cp.35.com/chinese/whois.php 三五互联

新网互联域名WHOIS信息查询地址 http://www.dns.com.cn/show/domain/whois/index.do 新网互联

国外WHOIS信息查询地址 https://who.is/ 国外WHOIS

1.2 在线网站备案查询

网站备案信息是根据国家法律法规规定,由网站所有者向国家有关部门申请的备案,如果需要查询企业备案信息(单位名称、备案编号、网站负责人、电子邮箱、联系电话、法人等),推荐以下网站查询
天眼查 https://www.tianyancha.com/ 天眼查
ICP备案查询网 http://www.beianbeian.com/ ICP备案查询网
爱站备案查询 https://icp.aizhan.com/ 爱站备案查询
域名助手备案信息查询 http://cha.fute.com/index 域名助手备案信息查询

2. 收集子域名

2.1 子域名作用

收集子域名可以扩大测试范围,同一域名下的二级域名都属于目标范围。 直接输入domain

2.1.2 如何检测CNAME记录

  1. 进入命令状态;(开始菜单 - 运行 - CMD[回车]);
  2. 输入命令” nslookup -q=cname 这里填写对应的域名或二级域名”,查看返回的结果与设置的是否一致即可。

    2.2常用方式

    子域名中的常见资产类型一般包括办公系统,邮箱系统,论坛,商城,其他管理系统,网站管理后台也有可能出现子域名中。
    首先找到目标站点,在官网中可能会找到相关资产(多为办公系统,邮箱系统等),关注一下页面底部,也许有管理后台等收获。

    子域名在线查询

    https://phpinfo.me/domain/
    https://www.t1h2ua.cn/tools/

    dns侦测

    https://dnsdumpster.com/

    ip138 查询子域名

    https://site.ip138.com/moonsec.com/domain.htm

    Hackertarget查询子域名

    https://hackertarget.com/find-dns-host-records/
    注意:通过该方法查询子域名可以得到一个目标大概的ip段,接下来可以通过ip来收集信息

    360 Quake

    https://quake.360.cn/
    domain:”*.???.com”

    Layer子域名挖掘机


Layer子域名挖掘机

SubDomainBrute

https://github.com/lijiejie/subDomainsBrute SubDomainBrute
pip install aiodns
运行命令

1
2
subDomainsBrute.py freebuf.com  
subDomainsBrute.py freebuf.com --full -o freebuf2.txt

Sublist3r

https://github.com/aboul3la/Sublist3r
pip install -r requirements.txt
提示:以上方法为爆破子域名,由于字典比较强大,所以效率较高。
帮助文档

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
usage: sublist3r.py [-h] -d DOMAIN [-b [BRUTEFORCE]] [-p PORTS] [-v [VERBOSE]]
[-t THREADS] [-e ENGINES] [-o OUTPUT] [-n]

OPTIONS:
-h, --help show this help message and exit
-d DOMAIN, --domain DOMAIN
Domain name to enumerate it's subdomains
-b [BRUTEFORCE], --bruteforce [BRUTEFORCE]
Enable the subbrute bruteforce module
-p PORTS, --ports PORTS
Scan the found subdomains against specified tcp ports
-v [VERBOSE], --verbose [VERBOSE]
Enable Verbosity and display results in realtime
-t THREADS, --threads THREADS
Number of threads to use for subbrute bruteforce
-e ENGINES, --engines ENGINES
Specify a comma-separated list of search engines
-o OUTPUT, --output OUTPUT
Save the results to text file
-n, --no-color Output without color

Example: python sublist3r.py -d google.com

中文翻译
-h :帮助
-d :指定主域名枚举子域名
-b :调用subbrute暴力枚举子域名
-p :指定tpc端口扫描子域名
-v :显示实时详细信息结果
-t :指定线程
-e :指定搜索引擎
-o :将结果保存到文本
-n :输出不带颜色

默认参数扫描子域名
python sublist3r.py -d baidu.com

使用暴力枚举子域名
python sublist3r -b -d baidu.com

OneForALL (kali)

pip3 install —user -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/`
python3 oneforall.py —target baidu.com run /收集/
爆破子域名
Example:
brute.py —target domain.com —word True run
brute.py —targets ./domains.txt —word True run
brute.py —target domain.com —word True —concurrent 2000 run
brute.py —target domain.com —word True —wordlist subnames.txt run
brute.py —target domain.com —word True —recursive True —depth 2 run
brute.py —target d.com —fuzz True —place m..d.com —rule ‘[a-z]’ run
brute.py —target d.com —fuzz True —place m.
.d.com —fuzzlist subnames.txt run

FuzzDomain

3. 端口扫描

当确定了目标大概的ip段后,可以先对ip的开放端口进行探测,一些特定服务可能开起在默认端口上,探测开放端口有利于快速收集目标资产,找到目标网站的其他功能站点。

msscan端口扫描 (kali)

https://gitee.com/youshusoft/GoScanner/
msscan -p 1-65535 ip --rate=1000

御剑端口扫描 holdsword

nmap扫描端口和探测端口信息

常用参数,如:

1
2
3
4
nmap -sV 192.168.0.2
nmap -sT 92.168.0.2
nmap -Pn -A -sC 192.168.0.2
nmap -sU -sT -p0-65535 192.168.122.1

sU—UDP sT—TCP
用于扫描目标主机服务版本号与开放的端口

如果需要扫描多个ip或ip段,可以将他们保存到一个txt文件中
nmap -iL ip.txt
来扫描列表中所有的ip。
Nmap为端口探测最常用的方法,操作方便,输出结果非常直观。

在线端口检测

http://coolaf.com/tool/port

端口扫描器

御剑,msscan,zmap

渗透端口

21,22,23,1433,152,3306,3389,5432,5900,50070,50030,50000,27017,27018,11211,9200,9300,7001,7002,6379,5984,873,443,8000-9090,80-89,80,10000,8888,8649,8083,8080,8089,9090,7778,7001,7002,6082,5984,4440,3312,3311,3128,2601,2604,2222,2082,2083,389,88,512,513,514,1025,111,1521,445,135,139,53

渗透常见端口及对应服务

1.web类(web漏洞/敏感目录)

第三方通用组件漏洞struts thinkphp jboss ganglia zabbix
80 web
80-89 web
8000-9090 web

2.数据库类(扫描弱口令)

1433 MSSQL
1521 Oracle
3306 MySQL
5432 PostgreSQL

3.特殊服务类(未授权/命令执行类/漏洞)

443 SSL心脏滴血
873 Rsync未授权
5984 CouchDB http://xxx:5984/_utils/
6379 redis未授权
7001,7002 WebLogic默认弱口令,反序列
9200,9300 elasticsearch 参考WooYun: 多玩某服务器ElasticSearch命令执行漏洞
11211 memcache未授权访问
27017,27018 Mongodb未授权访问
50000 SAP命令执行
50070,50030 hadoop默认端口未授权访问

4.常用端口类(扫描弱口令/端口爆破)

21 ftp
22 SSH
23 Telnet
2601,2604 zebra路由,默认密码zebra
3389 远程桌面

5.端口合计详情

21 ftp
22 SSH
23 Telnet
80 web
80-89 web
161 SNMP
389 LDAP
443 SSL心脏滴血以及一些web漏洞测试
445 SMB

512,513,514 Rexec
873 Rsync未授权
1025,111 NFS
1433 MSSQL
1521 Oracle:(iSqlPlus Port:5560,7778)
2082/2083 cpanel主机管理系统登陆 (国外用较多)
2222 DA虚拟主机管理系统登陆 (国外用较多)
2601,2604 zebra路由,默认密码zebra
3128 squid代理默认端口,如果没设置口令很可能就直接漫游内网了
3306 MySQL
3312/3311 kangle主机管理系统登陆
3389 远程桌面
4440 rundeck 参考WooYun: 借用新浪某服务成功漫游新浪内网
5432 PostgreSQL
5900 vnc
5984 CouchDB http://xxx:5984/_utils/
6082 varnish 参考WooYun: Varnish HTTP accelerator CLI 未授权访问易导致网站被直接篡改或者作为代理进入内网
6379 redis未授权
7001,7002 WebLogic默认弱口令,反序列
7778 Kloxo主机控制面板登录
8000-9090 都是一些常见的web端口,有些运维喜欢把管理后台开在这些非80的端口上
8080 tomcat/WDCP主机管理系统,默认弱口令
8080,8089,9090 JBOSS
8083 Vestacp主机管理系统 (国外用较多)
8649 ganglia
8888 amh/LuManager 主机管理系统默认端口
9200,9300 elasticsearch 参考WooYun: 多玩某服务器ElasticSearch命令执行漏洞
10000 Virtualmin/Webmin 服务器虚拟主机管理系统
11211 memcache未授权访问
27017,27018 Mongodb未授权访问
28017 mongodb统计页面
50000 SAP命令执行
50070,50030 hadoop默认端口未授权访问

常见的端口和攻击方法

常见的端口和攻击方法

4.查找真实ip

4.1 多地ping确认是否使用CDN

http://ping.chinaz.com/
http://ping.aizhan.com/

4.2 查询历史DNS解析记录

在查询到的历史解析记录中,最早的历史解析ip很有可能记录的就是真实ip,快速查找真实IP推荐此方法,但并不是所有网站都能查到

4.2.1 DNSDB

https://dnsdb.io/zh-cn/

4.2.2 微步在线

https://x.threatbook.cn/

4.2.3 Ipip.net

https://tools.ipip.net/cdn.php

4.2.4 iewdns

https://viewdns.info/

4.3 phpinfo

如果目标网站存在phpinfo泄露等,可以在phpinfo中的SERVER_ADDR或_SERVER[“SERVER_ADDR”]找到真实ip

4.4 绕过CDN

绕过CDN的多种方法具体可以参考
https://www.cnblogs.com/qiudabai/p/9763739.html 绕过CDN

5 旁站和C段

旁站往往存在业务功能站点,建议先收集已有IP的旁站,再探测C段,确认C段目标后,再在C段的基础上再收集一次旁站。

旁站是和已知目标站点在同一服务器但不同端口的站点,通过以下方法搜索到旁站后,先访问一下确定是不是自己需要的站点信息。

5.1 google hacking

https://blog.csdn.net/qq_36119192/article/details/84029809

5.1.1 网络空间搜索引擎

如FOFA搜索旁站和C段
该方法效率较高,并能够直观地看到站点标题,但也有不常见端口未收录的情况,虽然这种情况很少,但之后补充资产的时候可以用下面的方法nmap扫描再收集一遍。
shodan

5.1.2 在线c段 webscan.cc

webscan.cc
https://c.webscan.cc/ webscan.cc

5.1.3 c段 利用脚本

pip install requests

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#coding:utf-8
import requests
import json

def get_c(ip):
print("正在收集{}".format(ip))
url="http://api.webscan.cc/?action=query&ip={}".format(ip)
req=requests.get(url=url)
html=req.text
data=req.json()
if 'null' not in html:
with open("resulit.txt", 'a', encoding='utf-8') as f:
f.write(ip + '\n')
f.close()
for i in data:
with open("resulit.txt", 'a',encoding='utf-8') as f:
f.write("\t{} {}\n".format(i['domain'],i['title']))
print(" [+] {} {}[+]".format(i['domain'],i['title']))
f.close()

def get_ips(ip):
iplist=[]
ips_str = ip[:ip.rfind('.')]
for ips in range(1, 256):
ipadd=ips_str + '.' + str(ips)
iplist.append(ipadd)
return iplist


ip=input("请你输入要查询的ip:")

ips=get_ips(ip)
for p in ips:
get_c(p)

5.1.4 Nmap,Msscan扫描等

nmap -p 80,443,8000,8080 -Pn 192.168.0.0/24

5.? 站长之家 (接口不稳定)

同ip网站查询
http://stool.chinaz.com/same
https://chapangzhan.com/

6. 网络空间搜索引擎

如果想要在短时间内快速收集资产,那么利用网络空间搜索引擎是不错的选择,可以直观地看到旁站,端口,站点标题,IP等信息,点击列举出站点可以直接访问,以此来判断是否为自己需要的站点信息。FOFA的常用语法

  1. 同IP旁站:ip=”192.168.0.1”
  2. C段:ip=”192.168.0.0/24”
  3. 子域名:domain=”baidu.com”
  4. 标题/关键字:title=”百度”
  5. 如果需要将结果缩小到某个城市的范围,那么可以拼接语句
    title="百度"&& region="Beijing"
  6. 特征:body=”百度”或header=”baidu”

7. 扫描敏感目录/文件

扫描敏感目录需要强大的字典,需要平时积累,拥有强大的字典能够更高效地找出网站的管理后台,敏感文件常见的如.git文件泄露,.svn文件泄露,phpinfo泄露等,这一步一半交给各类扫描器就可以了,将目标站点输入到域名中,选择对应字典类型,就可以开始扫描了,十分方便。

7.1 御剑

https://www.fujieace.com/hacker/tools/yujian.html 御剑

7.2 7kbstorm

https://github.com/7kbstorm/7kbscan-WebPathBrute 7kbstorm

7.3 bbscan (py2.7)

https://github.com/lijiejie/BBScan
在pip已经安装的前提下,可以直接:
pip install -r requirements.txt
使用示例:

  1. 扫描单个web服务 www.target.com
    python BBScan.py —host www.target.com
  2. 扫描www.target.com和www.target.com/28下的其他主机
    python BBScan.py —host www.target.com —network 28
  3. 扫描txt文件中的所有主机
    python BBScan.py -f wandoujia.com.txt
  4. 从文件夹中导入所有的主机并扫描
    python BBScan.py -d targets/
    –network 参数用于设置子网掩码,小公司设为28~30,中等规模公司设置26~28,大公司设为24~26
    当然,尽量避免设为24,扫描过于耗时,除非是想在各SRC多刷几个漏洞。
    该插件是从内部扫描器中抽离出来的.

如果你有非常有用的规则,请找几个网站验证测试后,再 pull request
脚本还会优化,接下来的事:

增加有用规则,将规则更好地分类,细化
后续可以直接从 rules\request 文件夹中导入HTTP_request
优化扫描逻辑

7.4 dirmap (kali)

pip install -r requirement.txt

https://github.com/H4ckForJob/dirmap
单个目标
python3 dirmap.py -i https://target.com -lcf
多个目标
python3 dirmap.py -iF urls.txt -lcf

7.5 dirsearch (kali)

https://gitee.com/Abaomianguan/dirsearch.git
unzip dirsearch.zip
python3 dirsearch.py -u http://m.scabjd.com/ -e *

7.6 dirbuster

7.7 gobuster

sudo apt-get install gobuster
gobuster dir -u https://www.servyou.com.cn/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php -t 50

dir -u 网址 w字典 -x 指定后缀 -t 线程数量
dir -u https://www.servyou.com.cn/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x “php,html,rar,zip” -d —wildcard -o servyou.log | grep ^”3402”

7.8 网站文件

  1. robots.txt
  2. crossdomin.xml
  3. sitemap.xml
  4. 后台目录
  5. 网站安装包
  6. 网站上传目录
  7. mysql管理页面
  8. phpinfo
  9. 网站文本编辑器
  10. 测试文件
  11. 网站备份文件(.rar、zip、.7z、.tar.gz、.bak)
  12. DS_Store 文件
  13. vim编辑器备份文件(.swp)
  14. WEB—INF/web.xml文件
  15. git
  16. svn
    https://www.secpulse.com/archives/55286.html

8.扫描网页备份

例如
config.php
config.php~
config.php.bak
config.php.swp
config.php.rar
conig.php.tar.gz

9. 网站头信息收集

1.中间件 :web服务【Web Servers】 apache iis7 iis7.5 iis8 nginx WebLogic tomcat
2.网站组件: js组件jquery、vue 页面的布局bootstrap

通过浏览器获取
http://whatweb.bugscaner.com/look/

火狐的插件Wappalyzer

cmd 查询
curl 命令查询头信息
curl https://www.????.com -i

10. 敏感文件搜索

10.1 GitHub搜索

in:name test #仓库标题搜索含有关键字test
in:descripton test #仓库描述搜索含有关键字
in:readme test #Readme文件搜素含有关键字
搜索某些系统的密码
https://github.com/search?q=smtp+58.com+password+3306&type=Code
github 关键词监控
https://www.codercto.com/a/46640.html

谷歌搜索
site:Github.com sa password
site:Github.com root password
site:Github.com User ID=’sa’;Password
site:Github.com inurl:sql
SVN 信息收集
site:Github.com svn
site:Github.com svn username
site:Github.com svn password
site:Github.com svn username password
综合信息收集
site:Github.com password
site:Github.com ftp ftppassword
site:Github.com 密码
site:Github.com 内部

1
2
3
4
https://blog.csdn.net/qq_36119192/article/details/99690742
http://www.361way.com/github-hack/6284.html
https://docs.github.com/cn/github/searching-for-information-on-github/searching-code
https://github.com/search?q=smtp+bilibili.com&type=code

10.2 Google-hacking

site:域名
inurl: url中存在的关键字网页
intext:网页正文中的关键词
filetype:指定文件类型

10.3 wooyun漏洞库

https://wooyun.website/ wooyun

10.4 网盘搜索

凌云搜索: https://www.lingfengyun.com/ 凌云搜索
盘多多:http://www.panduoduo.net/ 盘多多
盘搜搜:http://www.pansoso.com/ 盘搜搜
盘搜:http://www.pansou.com/ 盘搜

10.5 网站注册信息

www.reg007.com 网站查询注册信息

10.6 js敏感信息

  1. 网站的url连接写到js里面
  2. js的api接口 里面包含用户信息 比如 账号和密码

    10.6.1 jsfinder

    https://gitee.com/kn1fes/JSFinder
    python3 JSFinder.py -u http://www.mi.com
    python3 JSFinder.py -u http://www.mi.com -d
    python3 JSFinder.py -u http://www.mi.com -d -ou mi_url.txt -os mi_subdomain.txt
    当你想获取更多信息的时候,可以使用-d进行深度爬取来获得更多内容,并使用命令 -ou, -os来指定URL和子域名所保存的文件名
    批量指定URL和JS链接来获取里面的URL。
    指定URL:
    python JSFinder.py -f text.txt

指定JS:
python JSFinder.py -f text.txt -j

10.6.2 Packer-Fuzzer

寻找网站交互接口 授权key
随着WEB前端打包工具的流行,您在日常渗透测试、安全服务中是否遇到越来越多以Webpack打包器为代表的网站?这类打包器会将整站的API和API参数打包在一起供Web集中调用,这也便于我们快速发现网站的功能和API清单,但往往这些打包器所生成的JS文件数量异常之多并且总JS代码量异常庞大(多达上万行),这给我们的手工测试带来了极大的不便,Packer Fuzzer软件应运而生。

本工具支持自动模糊提取对应目标站点的API以及API对应的参数内容,并支持对:未授权访问、敏感信息泄露、CORS、SQL注入、水平越权、弱口令、任意文件上传七大漏洞进行模糊高效的快速检测。在扫描结束之后,本工具还支持自动生成扫描报告,您可以选择便于分析的HTML版本以及较为正规的doc、pdf、txt版本。

1
2
3
4
sudo apt-get install nodejs && sudo apt-get install npm
git clone https://gitee.com/keyboxdzd/Packer-Fuzzer.git
pip3 install -r requirements.txt
python3 PackerFuzzer.py -u https://www.liaoxuefeng.com

10.6.3 SecretFinder

一款基于Python脚本的JavaScript敏感信息搜索工具
https://gitee.com/mucn/SecretFinder
python3 SecretFinder.py -i https://www.moonsec.com/ -e

11. cms识别/指纹识别

收集好网站信息之后,应该对网站进行指纹识别,通过识别指纹,确定目标的cms及版本,方便制定下一步的测试计划,可以用公开的poc或自己累积的对应手法等进行正式的渗透测试。

11.1 云悉

http://www.yunsee.cn/info.html 云悉

11.2 潮汐指纹

http://finger.tidesec.net/ 潮汐指纹

11.3 CMS指纹识别

http://whatweb.bugscaner.com/look/
https://github.com/search?q=cms

11.4 whatcms (kali)

11.5 御剑cms识别

https://github.com/ldbfpiaoran/cmscan
https://github.com/theLSA/cmsIdentification/

12. 非常规按操作

1、如果找到了目标的一处资产,但是对目标其他资产的收集无处下手时,可以查看一下该站点的body里是否有目标的特征,然后利用网络空间搜索引擎(如fofa等)对该特征进行搜索,如:body=”XX公司”或body=”baidu”等。

该方式一般适用于特征明显,资产数量较多的目标,并且很多时候效果拔群。

2、当通过上述方式的找到test.com的特征后,再进行body的搜索,然后再搜索到test.com的时候,此时fofa上显示的ip大概率为test.com的真实IP。

3、如果需要对政府网站作为目标,那么在批量获取网站首页的时候,可以用上
http://114.55.181.28/databaseInfo/index
之后可以结合上一步的方法进行进一步的信息收集。

13. SSL/TLS证书查询

SSL/TLS证书通常包含域名、子域名和邮件地址等信息,结合证书中的信息,可以更快速地定位到目标资产,获取到更多目标资产的相关信息。
https://myssl.com/
https://crt.sh
https://censys.io
https://developers.facebook.com/tools/ct/
https://google.com/transparencyreport/https/ct/

SSL证书搜索引擎:
https://certdb.com/domain/github.com
https://crt.sh/?Identity=%.???.com
https://censys.io/
GetDomainsBySSL.py

14. 查找厂商ip段

http://ipwhois.cnnic.net.cn/index.jsp

15. 移动资产收集

15.1 微信小程序支付宝小程序

https://weixin.sogou.com/weixin?type=1&ie=utf8&query=%E6%8B%BC%E5%A4%9A%E5%A4%9A

15.2 app软件搜索

https://www.qimai.cn/

16. js敏感文件

https://github.com/m4ll0k/SecretFinder
https://github.com/Threezh1/JSFinder
https://github.com/rtcatc/Packer-Fuzzer

17. github信息泄露监控

https://github.com/0xbug/Hawkeye
https://github.com/MiSecurity/x-patrol
https://github.com/VKSRC/Github-Monitor

18. 资产收集神器

ARL(Asset Reconnaissance Lighthouse)资产侦察灯塔系统
https://github.com/TophantTechnology/ARL

AssetsHunter
https://github.com/rabbitmask/AssetsHunter

一款用于src资产信息收集的工具
https://github.com/sp4rkw/Reaper

domain_hunter_pro
https://github.com/bit4woo/domain_hunter_pro

LangSrcCurise
https://github.com/shellsec/LangSrcCurise

网段资产
https://github.com/colodoo/midscan

19. 工具

Fuzz字典推荐:https://github.com/TheKingOfDuck/fuzzDicts
BurpCollector(BurpSuite参数收集插件):https://github.com/TEag1e/BurpCollector
Wfuzz:https://github.com/xmendez/wfuzz
LinkFinder:https://github.com/GerbenJavado/LinkFinder
PoCBox:https://github.com/Acmesec/PoCBox