子域名发现方法

1. 暴力枚举

  • subDomainBrute:https://github.com/lijiejie/subDomainsBrute
  • Layer子域名挖掘机

2. 爬虫 Scraping

3. 搜索引擎(百度,google等)

4. 证书信息

  • 证书中的 使用者可选名称 字段值
  • 通过Censys这种资产搜索引擎收集的证书信息:https://censys.io/certificates?q=0sec.com.cn

Censys_subdomain_enum.py

工具描述:提取子域名,从Censys的SSL/TLS证书中收集子域名

pip install censys
git clone https://xxx.com/appsecco/the-art-of-subdomain-enumeration.git
python censys_enumeration.py target.com

5. 证书透明度

证书透明度(Certificate Transparency)简称CT,主要用于将证书记录到公开的CT log中,日志可以被任何人浏览。

CT log

https://crt.sh/
https://censys.io/
https://developers.facebook.com/tools/ct/
谷歌证书透明度报告:https://transparencyreport.google.com/https/certificates

Crt_enum_web.py

工具描述:解析https://crt.sh/页面的子域名

pip install psycopg2
git clone https://xxx.com/appsecco/the-art-of-subdomain-enumeration.git
python3 crtsh_enum_web.py target.com

6. Passive DNS,DNS数据库

Sublist3r

工具描述:接口Baidu, Yahoo, Google, Bing, Ask, Netcraft, DNSdumpster, VirusTotal, Threat Crowd, SSL Certificates, PassiveDNS

git clone https://xxx.com/aboul3la/Sublist3r.git
cd Sublist3r
pip install -r requirements.txt
./sublist3r.py -d target.com -o $outfile
./sublist3r.py -b -d target.com -o $outfile

7. ASN(Autonomous System Numbers) - 自治系统编号

通过域名查询到 ASN,再通过 ASN 查询到所属的所有 ip 范围

8. SAN(Subject Alternate Name) - 主题备用名称

SAN(Subject Alternate Name)主题备用名称,主题备用名称证书简单来说,在需要多个域名,将其用于各项服务时,可使用SAN证书。允许在安全证书中使用subjectAltName字段将多种值与证书关联,这些值被称为主题备用名称。名称可包括:IP地址、DNS名称等。

San_subdomain_enum.py

工具描述:SSL/TLS证书中的SAN获取子域名

git clone https://xxx.com/appsecco/the-art-of-subdomain-enumeration.git
./san_subdomain_enum.py target.com

9. DNS 区域传送漏洞

Windows:

1. nslookup命令进入交互式shell
2. server命令 参数设定查询将要使用的DNS服务器
3. ls命令列出某个域中的所有域名

Linux:

dig @1.1.1.1 0sec.com.cn axfr
  • http://www.lijiejie.com/dns-zone-transfer-1/

10. DNSSEC(Domain Name System Security Extensions),DNS安全扩展,DNSSEC区域漫步

Ldns-walk

工具描述:DNSSEC zone walking, 如果DNSSEC NSEC开启,可以获得全部域名。

aptitude install ldnsutils
ldns-walk target.com
ldns-walk @nsserver.com target.com

11. SPF记录

SPF是通过域名的TXT记录来进行设置的,SPF记录列出了所有被授权代表域名发送电子邮件的主机

Assets-from-spf

工具描述:SPF域名记录

git clone https://xxx.com/yamakira/assets-from-spf.git
pip install click ipwhois
python assets_from_spf.py target.com

12. CSP HTTP首部

Domains-from-csp

工具描述:从CSP头提取子域名

git clone https://xxx.com/yamakira/domains-from-csp.git
pip install click
python csp_parser.py $URL
python csp_parser.py $URL -r

13. Alterations & permutations(换置 & 排序)

AltDNS

工具描述:通过换置&排序技术发现子域名

git clone https://xxx.com/infosec-au/altdns.git
cd altdns
pip install -r requirements.txt
./altdns.py -i subdomains.txt -o data_output -w words.txt -r -s results_output.txt

14. 自身泄漏

  • robots.txt
  • crossdomain.xml(跨域策略文件cdx)
  • 从流量中分析提取
  • Github泄露

泛解析问题

目前最好的解决方式是通过先获取一个绝对不存在域名的响应内容,再遍历获取每个字典对应的子域名的响应内容,通过和不存在域名的内容做相似度比对,来枚举子域名,但这样的实现是以牺牲速度为代价

  • https://www.freebuf.com/news/133873.html
  • https://xz.aliyun.com/t/5509

工具推荐

  通过证书/DNS/爬虫/威胁情报/搜索引擎 收集,支持子域名爆破(判断泛解析)和多线程调用等

参考链接

  • https://mp.weixin.qq.com/s/X5B1CheRDcSu62tcnNRRHg
  • https://xz.aliyun.com/t/6617
  • https://www.freebuf.com/articles/web/220344.html
发布了41 篇原创文章 · 获赞 33 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_39293438/article/details/104829825