周六不休息 發表於 2020-12-27 16:21:00

子域名探测方法大全

<h1 id="子域名探测方法">子域名探测方法</h1>
<pre><code>在线接口
暴力枚举
搜索引擎
Certificate Transparency(证书透明)
Subject Alternate Name (SAN) - 主题备用名称
Public datasets(公开数据集)
信息泄露
内容解析(HTML,JavaScript,文件)
DNS解析
区域传送
DNS aggregators(DNS聚合器)
DNS Cache Snooping(域名缓存侦测)
Alterations &amp; permutations(换置 &amp; 排序)
DNSSEC(Domain Name System Security Extensions),DNS安全扩展,DNSSEC区域漫步
CSP HTTP首部
SPF记录
虚拟主机爆破
ASN发现
爬虫 Scraping(抓取)
</code></pre>
<h1 id="子域名探测">子域名探测</h1>
<blockquote>
<p>通过收集子域名信息来进行渗透是目前常见的一种手法。<br>
子域名信息收集可以通过手工,也可以通过工具,还可以通过普通及漏洞搜索引擎来进行分析。<br>
在挖SRC漏洞时,子域名信息的收集至关重要!</p>
</blockquote>
<h2 id="为什么要进行子域名探测">为什么要进行子域名探测?</h2>
<blockquote>
<p>子域名探测可以帮我们发现渗透测试中更多的服务,这将增加发现漏洞的可能性</p>
<p>查找一些用户上较少,被人遗忘的子域名,其上运行的应用程序可能会使我们发现关键漏洞</p>
<p>通常,同一组织的不同域名/应用程序中存在相同的漏洞</p>
<p>子域名中的常见资产类型一般包括办公系统,邮箱系统,论坛,商城等,其他管理系统,网站管理后台等较少出现在子域名中</p>
</blockquote>
<h2 id="子域名探测方法大全">子域名探测方法大全</h2>
<h3 id="在线接口">在线接口</h3>
<blockquote>
<p>https://crt.sh/<br>
https://censys.io/<br>
https://transparencyreport.google.com/https/certificates<br>
https://dnsdumpster.com/<br>
https://hackertarget.com/find-dns-host-records/<br>
https://x.threatbook.cn/<br>
https://www.virustotal.com/gui/home/search<br>
https://phpinfo.me/domain/<br>
https://site.ip138.com/baidu.com/domain.htm<br>
https://www.t1h2ua.cn/tools/<br>
http://tool.chinaz.com/subdomain/<br>
https://spyse.com/site/not-found?q=domain%3A"github"&amp;criteria=cert</p>
</blockquote>
<h3 id="暴力枚举">暴力枚举</h3>
<blockquote>
<p>Layer子域名爆破机 Layer是windows下的一款子域名探测工具,其工作原理是利用子域名字典进行爆破,使用简单容易上手。<br>
<img src="https://img2020.cnblogs.com/blog/1765210/202012/1765210-20201227161839323-652330047.png" alt="" loading="lazy"></p>
</blockquote>
<blockquote>
<p><strong>Amass 工具描述:爆破, google, VirusTotal, alt names</strong><br>
go get -u github.com/OWASP/Amass/...<br>
amass -d target.com -o $outfile<br>
Knock</p>
</blockquote>
<blockquote>
<p><strong>工具描述:AXFR, virustotal, 爆破</strong><br>
apt-get install python-dnspython git clone https://xxx.com/guelfoweb/knock.git<br>
cd knock<br>
nano knockpy/config.json # &lt;- set your virustotal API_KEY python setup.py install</p>
<p><img src="https://img2020.cnblogs.com/blog/1765210/202012/1765210-20201227161850496-506773497.png" alt="" loading="lazy"></p>
</blockquote>
<h3 id="搜索引擎">搜索引擎</h3>
<blockquote>
<p><strong>•Google</strong><br>
intitle=公司名称<br>
过滤掉 -site:www.target.com<br>
我们可以在Google搜索中使用 site:运算符来查找一个域的所有子域名<br>
谷歌还额外支持减号运算符 site:*.wikimedia.org -www -store -jobs -uk 以排除我们不感兴趣的子域名</p>
<p><img src="https://img2020.cnblogs.com/blog/1765210/202012/1765210-20201227161859391-245047809.png" alt="" loading="lazy"></p>
</blockquote>
<blockquote>
<p><strong>•Bing</strong><br>
Bing搜索引擎也支持一些高级搜索运算符。<br>
与Google一样,Bing也支持site:运算符,可以帮助您检查除Google搜索之外的其他结果。<br>
发现子域名: site:target.com</p>
<p><strong>•百度</strong><br>
intitle=公司名称</p>
<p><strong>•钟馗之眼</strong><br>
https://www.zoomeye.org/ site=域名</p>
<p><strong>•FOFA</strong><br>
https://fofa.so/<br>
语法:domain=”baidu.com”<br>
提示:以上方法无需爆破,查询速度快,需要快速收集资产时可以优先使用,后面再用其他方法补充。</p>
</blockquote>
<h3 id="certificate-transparency证书透明">Certificate Transparency(证书透明)</h3>
<p><strong>SSL/TLS证书</strong></p>
<blockquote>
<p>证书透明度(Certificate Transparency)是证书授权机构的一个项目,证书授权机构会将每个SSL/TLS证书发布到公共日志中。<br>
一个SSL/TLS证书通常包含域名、子域名和邮件地址。<br>
查找某个域名所属证书的最简单的方法就是使用搜索引擎搜索一些公开的CT日志。</p>
</blockquote>
<blockquote>
<p><strong>在线查询:</strong><br>
https://crt.sh/<br>
https://censys.io/<br>
https://developers.facebook.com/tools/ct/<br>
https://google.com/transparencyreport/https/ct/<br>
https://transparencyreport.google.com/https/certificates</p>
</blockquote>
<blockquote>
<p><strong>CTFR 工具描述:滥用证书透明记录</strong><br>
git clone https://xxx.com/UnaPibaGeek/ctfr.git<br>
cd ctfr<br>
pip3 install -r requirements.txt<br>
python3 ctfr.py -d target.com -o $outfile</p>
</blockquote>
<blockquote>
<p><strong>Censys_subdomain_enum.py<br>
工具描述:提取子域名,从Censys的SSL/TLS证书中收集子域名</strong><br>
pip install censys<br>
git clone https://xxx.com/appsecco/the-art-of-subdomain-enumeration.git<br>
python censys_enumeration.py target.com<br>
<img src="https://img2020.cnblogs.com/blog/1765210/202012/1765210-20201227161913488-705662000.png" alt="" loading="lazy"></p>
</blockquote>
<blockquote>
<p><strong>Cloudflare_enum.py<br>
工具描述:从Cloudflare提取子域名 dns聚合器</strong><br>
pip install censys<br>
git clone https://xxx.com/appsecco/the-art-of-subdomain-enumeration.git<br>
cloudflare_subdomain_enum.py your@cloudflare.email target.com</p>
</blockquote>
<blockquote>
<p><strong>Crt_enum_web.py<br>
工具描述:解析https://crt.sh/页面的子域名</strong><br>
pip install psycopg2<br>
git clone https://xxx.com/appsecco/the-art-of-subdomain-enumeration.git<br>
python3 crtsh_enum_web.py target.com</p>
</blockquote>
<blockquote>
<p><strong>San_subdomain_enum.py<br>
工具描述:SSL/TLS证书中的SAN获取子域名</strong><br>
git clone https://xxx.com/appsecco/the-art-of-subdomain-enumeration.git<br>
./san_subdomain_enum.py target.com</p>
</blockquote>
<h3 id="subject-alternate-name-san---主题备用名称">Subject Alternate Name (SAN) - 主题备用名称</h3>
<blockquote>
<p>SAN(Subject Alternate Name)主题备用名称,主题备用名称证书简单来说,在需要多个域名,将其用于各项服务时,可使用SAN证书。<br>
允许在安全证书中使用subjectAltName字段将多种值与证书关联,这些值被称为主题备用名称。名称可包括:IP地址、DNS名称等。</p>
</blockquote>
<blockquote>
<p><strong>San_subdomain_enum.py<br>
工具描述:SSL/TLS证书中的SAN获取子域名 如上。</strong></p>
</blockquote>
<h3 id="public-datasets公开数据集">Public datasets(公开数据集)</h3>
<blockquote>
<p>有些项目收集了全互联网范围内的扫描数据,并将其提供给研究人员和安全社区。<br>
该项目发布的数据集是子域名信息的宝库。<br>
虽然在这个庞大的数据集中找到子域名就像大海捞针,但却值得我们去一试。</p>
</blockquote>
<blockquote>
<p><strong>Rapid7 Forward DNS dataset (Project Sonar)<br>
工具描述:来自rapid7 sonar项目的公共数据集</strong><br>
wget https://scans.io/data/rapid7/sonar.fdns_v2/20170417-fdns.json.gz cat 20170417-fdns.json.gz | pigz -dc | grep ".target.org" | jq`</p>
</blockquote>
<blockquote>
<p><strong>Forward DNS</strong>(https://scans.io/study/sonar.fdns_v2) 数据集作为Project Sonar的一部分发布。<br>
数据格式是通过gzip压缩的JSON文件。<br>
我们可以解析数据集以查找给定域名的子域名。<br>
数据集很大(压缩后:20+GB,压缩前:300+GB)<br>
Command to parse &amp; extract sub-domains for a given domain $ curl -silent https://scans.io/data/rapid7/sonar.fdns_v2/20170417-fdns.json.gz | pigz -dc | grep ".icann.org" | jq</p>
<p><img src="https://img2020.cnblogs.com/blog/1765210/202012/1765210-20201227161925658-908571933.png" alt="" loading="lazy"></p>
</blockquote>
<blockquote>
<p>数据聚合网站<br>
threatcrowd<br>
https://scans.io/study/sonar.rdns_v2<br>
https://opendata.rapid7.com/</p>
</blockquote>
<h3 id="信息泄露">信息泄露</h3>
<blockquote>
<p><strong>•信息泄露</strong><br>
首先找到目标站点,在官网中可能会找到相关资产(多为办公系统,邮箱系统等),关注一下页面底部,也许有管理后台等收获。</p>
<p><strong>•文件泄漏</strong><br>
crossdomain.xml(跨域策略文件cdx) robots.txt</p>
<p><strong>•Git仓库泄露</strong></p>
<p><strong>•从流量中分析提取</strong></p>
</blockquote>
<h3 id="内容解析htmljavascript文件">内容解析(HTML,JavaScript,文件)</h3>
<blockquote>
<p><strong>BiLE-suite<br>
工具描述:HTML解析,反向dns解析</strong><br>
aptitude install httrack<br>
git clone https://xxx.com/sensepost/BiLE-suite.git<br>
perl BiLE.pl target.com</p>
</blockquote>
<blockquote>
<p><strong>Second Order<br>
工具描述:第二阶段域名扫描 通过HTML提取子域名</strong><br>
go get xxx.com/mhmdiaa/second-order<br>
cp ~/go/src/xxx.com/mhmdiaa/second-order/config.json<br>
~/go/src/xxx.com/mhmdiaa/second-order/config-subs-enum.json<br>
编辑修改LogCrawledURLs为True<br>
second-order -base https://target.com -config config.json -output target.com</p>
</blockquote>
<h3 id="dns解析">DNS解析</h3>
<blockquote>
<p><strong>在线查询:</strong><br>
VirusTotal(https://www.virustotal.com/)<br>
ViewDNS(https://viewdns.info/)<br>
DNSdumpster(https://dnsdumpster.com/)<br>
Threatcrowd(https://www.threatcrowd.org/)</p>
</blockquote>
<blockquote>
<p><strong>BiLE-suite<br>
工具描述:HTML解析,反向dns解析 如上。</strong></p>
</blockquote>
<blockquote>
<p><strong>Massdns<br>
工具描述:dns解析</strong><br>
git clone https://xxx.com/blechschmidt/massdns.git<br>
cd massdns/<br>
make<br>
解析域名:/bin/massdns -r lists/resolvers.txt -t AAAA -w results.txt domains.txt -o S -w output.txt<br>
爆破域名:./scripts/subbrute.py wordlist.txt target.com | ./bin/massdns -r lists/resolvers.txt -t A -o S -w output.txt<br>
CT解析:./scripts/ct.py target.com | ./bin/massdns -r lists/resolvers.txt -t A -o S -w output.txt</p>
<p><img src="https://img2020.cnblogs.com/blog/1765210/202012/1765210-20201227161944518-661043738.png" alt="" loading="lazy"></p>
</blockquote>
<h3 id="区域传送">区域传送</h3>
<blockquote>
<p>域传送是一种DNS事务,DNS服务器将其全部或部分域文件的副本传递给另一个DNS服务器。<br>
如果未安全地配置域传输送,则任何人都可以对指定名称的服务器启动域传送并获取域文件的副本。<br>
根据设计,域文件包含有关域和保存在域中的大量主机信息。</p>
</blockquote>
<blockquote>
<p><strong>Windows:</strong></p>
<p>1.nslookup命令进入交互式shell<br>
2.server命令 参数设定查询将要使用的DNS服务器<br>
3.ls命令列出某个域中的所有域名</p>
</blockquote>
<blockquote>
<p><strong>Linux:</strong><br>
<strong>Dig<br>
工具描述:dns区域传送,dns反向解析,dns解析</strong><br>
dig +multi AXFR target.com<br>
dig +multi AXFR $ns_server target.com</p>
</blockquote>
<h3 id="dns-aggregatorsdns聚合器">DNS aggregators(DNS聚合器)</h3>
<blockquote>
<p><strong>Cloudflare_enum.py<br>
工具描述:从Cloudflare提取子域名 dns聚合器</strong><br>
pip install censys<br>
git clone https://xxx.com/appsecco/the-art-of-subdomain-enumeration.git<br>
cloudflare_subdomain_enum.py your@cloudflare.email target.com</p>
</blockquote>
<h3 id="dns-cache-snooping域名缓存侦测">DNS Cache Snooping(域名缓存侦测)</h3>
<blockquote>
<p><strong>域名缓存侦测(DNS Cache Snooping)技术</strong><br>
在企业网络中,通常都会配置DNS服务器,为网络内的主机提供域名解析服务。<br>
这些DNS不仅解析自己的私有域名,还会用递归方式,请求公网的DNS解析第三方域名,如baidu.com之类。<br>
为了提升性能,通常会使用缓存记录,记录解析过的域名,尤其是第三方域名。<br>
域名缓存侦测(DNS Cache Snooping)技术就是向这些服务器发送域名解析请求,但要求不使用递归模式。<br>
这样DNS只能解析私有域名和缓存中保存的域名。<br>
借助该项技术,渗透测试人员就知道哪些域名是否被过请求过。<br>
例如,测试人员可以提交某安全软件更新所使用的域名,如果有记录,说明该网络使用该种安全软件。</p>
</blockquote>
<h3 id="alterations--permutations换置--排序">Alterations &amp; permutations(换置 &amp; 排序)</h3>
<blockquote>
<p><strong>AltDNS<br>
工具描述:通过换置&amp;排序技术发现子域名</strong><br>
git clone https://xxx.com/infosec-au/altdns.git<br>
cd altdns<br>
pip install -r requirements.txt<br>
./altdns.py -i subdomains.txt -o data_output -w words.txt -r -s results_output.txt</p>
<p><img src="https://img2020.cnblogs.com/blog/1765210/202012/1765210-20201227161957115-105053007.png" alt="" loading="lazy"></p>
</blockquote>
<h3 id="dnssecdomain-name-system-security-extensionsdns安全扩展dnssec区域漫步">DNSSEC(Domain Name System Security Extensions),DNS安全扩展,DNSSEC区域漫步</h3>
<blockquote>
<p>由于DNSSEC处理不存在域名的方式,您可以"遍历"DNSSEC域并枚举该域中的所有域名。<br>
您可以从这里(https://info.menandmice.com/blog/bid/73645/Take-your-DNSSEC-with-a-grain-of-salt) 了解有关此技术的更多信息。</p>
</blockquote>
<blockquote>
<p><strong>Ldns-walk<br>
工具描述:DNSSEC zone walking, 如果DNSSEC NSEC开启,可以获得全部域名。</strong><br>
aptitude install ldnsutils<br>
ldns-walk target.com<br>
ldns-walk @nsserver.com target.com<br>
如果DNSSEC NSEC开启,可以获得全部域名。</p>
<p><img src="https://img2020.cnblogs.com/blog/1765210/202012/1765210-20201227162005307-1623637503.png" alt="" loading="lazy"></p>
</blockquote>
<h3 id="csp-http首部">CSP HTTP首部</h3>
<blockquote>
<p><strong>Domains-from-csp<br>
工具描述:从CSP头提取子域名</strong><br>
git clone https://xxx.com/yamakira/domains-from-csp.git<br>
pip install click<br>
python csp_parser.py $URL<br>
python csp_parser.py $URL -r</p>
</blockquote>
<h3 id="spf记录">SPF记录</h3>
<blockquote>
<p>SPF是通过域名的TXT记录来进行设置的,SPF记录列出了所有被授权代表域名发送电子邮件的主机</p>
</blockquote>
<blockquote>
<p><strong>Assets-from-spf<br>
工具描述:SPF域名记录</strong><br>
git clone https://xxx.com/yamakira/assets-from-spf.git<br>
pip install click ipwhois<br>
python assets_from_spf.py target.com</p>
<p><img src="https://img2020.cnblogs.com/blog/1765210/202012/1765210-20201227162012819-884228177.png" alt="" loading="lazy"></p>
</blockquote>
<h3 id="虚拟主机爆破">虚拟主机爆破</h3>
<blockquote>
<p><strong>vhost-brute<br>
工具描述:虚拟主机爆破</strong><br>
aptitude install php-curl git clone https://xxx.com/gwen001/vhost-brute.git</p>
<p><img src="https://img2020.cnblogs.com/blog/1765210/202012/1765210-20201227162021421-1976253768.png" alt="" loading="lazy"></p>
</blockquote>
<blockquote>
<p><strong>Virtual-host-discovery<br>
工具描述:虚拟主机爆破</strong><br>
git clone https://xxx.com/jobertabma/virtual-host-discovery.git<br>
ruby scan.rb --ip=1.1.1.1 --host=target.com --output output.txt</p>
</blockquote>
<h3 id="asn发现">ASN发现</h3>
<blockquote>
<p>通过域名查询到 ASN,再通过 ASN 查询到所属的所有 ip 范围</p>
</blockquote>
<h3 id="爬虫-scraping抓取">爬虫 Scraping(抓取)</h3>
<h2 id="泛解析问题">泛解析问题</h2>
<blockquote>
<p>目前最好的解决方式是通过先获取一个绝对不存在域名的响应内容,再遍历获取每个字典对应的子域名的响应内容,通过和不存在域名的内容做相似度比对,来枚举子域名,但这样的实现是以牺牲速度为代价</p>
<p>•https://www.freebuf.com/news/133873.html<br>
•https://xz.aliyun.com/t/5509</p>
</blockquote>
<h2 id="tools">Tools</h2>
<h3 id="oneforall">OneForAll</h3>
<blockquote>
<p>https://github.com/shmilylty/OneForAll<br>
工具也有很多厉害的,平时我一般使用 OneForALL + ESD + JSfinder 来进行搜集,(ESD 可以加载 layer 的字典,很好用)</p>
</blockquote>
<h3 id="sublist3r">Sublist3r</h3>
<blockquote>
<p>https://github.com/aboul3la/Sublist3r<br>
- 强大的快速子域枚举工具 评分: 🌟🌟🌟🌟🌟 | 编程语言: Python 2.x/3.x | 仍在维护: ✔️</p>
</blockquote>
<h3 id="guelfowebknock">guelfoweb/knock</h3>
<blockquote>
<p>https://github.com/guelfoweb/knock<br>
- Knock子域名获取,可用于查找子域名接管漏洞 评分: 🌟🌟🌟🌟🌟 | 编程语言: Python 2.x | 仍在维护: ✔️</p>
</blockquote>
<h3 id="subdomain3">subdomain3</h3>
<blockquote>
<p>https://github.com/yanxiu0614/subdomain3<br>
- 一款便捷高效的子域名爆破工具 评分: 🌟🌟🌟🌟🌟 | 编程语言: Python 3.x | 仍在维护: ✔️</p>
</blockquote>
<h3 id="amass">amass</h3>
<blockquote>
<p>https://github.com/caffix/amass<br>
- Go语言开发的子域名枚举工具 评分: 🌟🌟🌟🌟🌟 | 编程语言: Go | 仍在维护: ✔️</p>
</blockquote>
<h3 id="ice3man543subfinder">Ice3man543/subfinder</h3>
<blockquote>
<p>https://github.com/Ice3man543/subfinder<br>
- 继承于Sublist3r项目的模块化体系结构,一个强劲的子域名枚举工具 评分: 🌟🌟🌟🌟🌟 | 编程语言: Go | 仍在维护: ✔️</p>
</blockquote>
<h3 id="horn3t">horn3t</h3>
<blockquote>
<p>https://github.com/janniskirschner/horn3t<br>
- 带有网页截图功能的子可视化域名枚举工具 评分: 🌟🌟🌟🌟🌟 | 编程语言: Python 3.x | 仍在维护: ✔️</p>
</blockquote>
<h3 id="subdomainsbrute">subDomainsBrute</h3>
<blockquote>
<p>https://github.com/lijiejie/subDomainsBrute<br>
- Lijiejie开发的一款使用广泛的子域名爆破枚举工具 评分: 🌟🌟🌟🌟🌟 | 编程语言: Python 2.x | 仍在维护: ✖️</p>
</blockquote>
<h3 id="wydomain">wydomain</h3>
<blockquote>
<p>https://github.com/ring04h/wydomain<br>
- 猪猪侠开发的一款域名收集全面、精准的子域名枚举工具 评分: 🌟🌟🌟🌟🌟 | 编程语言: Python 2.x | 仍在维护: ✖️</p>
</blockquote>
<h1 id="子域名监控">子域名监控</h1>
<h2 id="langsrccurise">LangSrcCurise</h2>
<blockquote>
<p>https://github.com/LangziFun/LangSrcCurise</p>
</blockquote>
<h2 id="sublert">Sublert</h2>
<blockquote>
<p>https://www.freebuf.com/sectool/198396.html</p>
</blockquote>
<h1 id="参考">参考</h1>
<blockquote>
<p>https://mp.weixin.qq.com/s/m8ucI1bDxILM8wLU6pLmoQ<br>
https://xz.aliyun.com/t/3478 https://blog.csdn.net/qq_39293438/article/details/104829825</p>
</blockquote><br><br>
来源:https://www.cnblogs.com/forforever/p/14197630.html
頁: [1]
查看完整版本: 子域名探测方法大全