1. 利用证书透明度收集子域
实现方法
访问以下链接搜索需要查询的域名如:tencent.com
(1) crtsh: https://crt.sh/ (2) facebook:https://developers.facebook.com/tools/ct (3) entrust: https://www.entrust.com/ct-search/ (4) certspotter:https://sslmate.com/certspotter/api/ (5) spyse: https://spyse.com/search/certificate (6) censys: https://censys.io/certificates (7) google: https://google.com/transparencyreport/https/ct/
2. 常规检查收集子域
实现方法
1. dig命令
如dig @ns2.xxx.com xxx.com axfr
ns2.xxx.com为提供数据的服务器,xxx.com为要传输的关键字,axfr为区域传输选项。
2. python中dns库
xfr = dns.query.xfr(where=server, zone=self.domain, timeout=5.0, lifetime=10.0)
zone = dns.zone.from_xfr(xfr)
存在问题
一般情况下,DNS服务器都配置正确,关闭了dns传输或设置了白名单,漏洞利用成功的概率较低。
2.2站点配置文件
实现方法
建立文件列表,拼接域名后直接访问,判断改文件是否存在。若存在则提取数据,若不存在则跳过。
1. crossdomain.xml文件
直接访问crossdomain.xml路径
2. sitemap文件
直接访问sitemap.xml、sitemap.txt、sitemap.html、sitemapindex.xml、sitemapindex.xml路径
存在问题
文件往往不存在,即使存在,域名信息也不够多不够完全。
2.3 检查内容安全策略
实现方法
1. 手动抓包获取
HTTP header的Content-Security-Policy属性
2. Python的Requests获取
import requests
res = requests.post(url=url, headers=headers, data=data, allow_redirects=False)
if not res.headers['Content-Security-Policy']:
print("There is no Content-Security-Policy in the header")
else:
# 处理主体代码
2.4 利用DNS查询收集子域
SRV记录
添加服务记录服务器服务记录时会添加此项,SRV记录了哪台计算机提供了哪个服务。格式为:服务的名字.协议的类型(例如:example-server.tcp)。
以下命令枚举给定域名的SRV记录:
nmap --script dns-srv-enum.nse --script-args "dns-srv-enum.domain='google.com'"
MX记录
建立电子邮箱服务,将指向邮件服务器地址,需要设置MX记录。建立邮箱时,一般会根据邮箱服务商提供的MX记录填写此记录。
NS记录
域名解析服务器记录,如果要将子域名指定某个域名服务器来解析,需要设置NS记录。
SOA记录
SOA叫做起始授权机构记录,NS用于标识多台域名解析服务器,SOA记录用于在众多NS记录中那一台是主服务器。
TXT记录
可任意填写,可为空。一般做一些验证记录时会使用此项,如:做SPF(反垃圾邮件)记录。
3. 利用DNS数据集收集子域
利用DNS记录公开数据收集
*注:将需要{domain}换成需要查询的域名,标?的是我们认为效果较好的。
?(1) ip138: https://site.ip138.com/{domain}/domain.htm ?(2) 百度云观测: http://ce.baidu.com/index/getRelatedSites?site_address={domain} ?(3) hackertarget: https://hackertarget.com/find-dns-host-records/ (4) riddler: https://riddler.io/search?q=pld:{domain} (5) bufferover: https://dns.bufferover.run/dns?q={domain} (6) dnsdb: https://dnsdb.io/zh-cn/search?q={domain} (7) ipv4info: http://ipv4info.com/ (8) robtex: https://www.robtex.com/dns-lookup/ (9) chinaz:https://alexa.chinaz.com/ ?(10) netcraft:https://searchdns.netcraft.com/ (11) dnsdumpster: https://dnsdumpster.com/ (12) sitedossier: http://www.sitedossier.com/ ?(13) findsubdomains: https://findsubdomains.com/
4. 利用威胁情报平台数据收集子域
*注:将需要{domain}换成需要查询的域名, 以下平台均需注册,注册后免费试用
(1) https://otx.alienvault.com/api/v1/indicators/domain/{domain}/{section} {section}指其他指令动作,可参考Docs关于API的使用说明。 https://otx.alienvault.com/api/v1/indicators/domain/qq.com/url_list (2) https://community.riskiq.com/search/{domain}/subdomains (3) https://x.threatbook.cn/nodev4/domain/{domain} API:https://api.threatbook.cn/v3/domain/sub_domains (4) https://www.threatminer.org/domain.php?q={domain} (5) https://www.virustotal.com/ui/domains/{domain}/subdomains 或者https://www.virustotal.com/gui/domain/{domain}/relations (6) https://pentest-tools.com/information-gathering/find-subdomains-of-domain#
5. 利用搜索引擎发现子域
如Baidu,google,fofa等等
6. 域名备案搜集资产
查询网址:www.beianbeian.com
7. whois查询和关联查询
工具:站长工具
在此我们以facebook.com做演示,如何进行whois查询和反查
7.1 查询whois
http://whois.chinaz.com/facebook.com
7.2 反查whois
http:[email protected]&ddlSearchMode=1&domain=facebook.com
8. 域名爆破
推荐工具
oneforall
https://github.com/shmilylty/OneForAll
SubdomainBrute
https://github.com/lijiejie/subDomainsBrute
ESD
https://github.com/FeeiCN/ESD
subfinder
https://github.com/projectdiscovery/subfinder
本文作者为TSRC,转载请注明。