子域名探測方法:
?在線接口
?暴力枚舉
?搜索引擎
?Certificate Transparency(證書透明)
?Subject Alternate Name (SAN) - 主題備用名稱
?Public datasets(公開數(shù)據(jù)集)
?信息泄露
?內(nèi)容解析(HTML装畅,JavaScript捎迫,文件)
?DNS解析
?區(qū)域傳送
?DNS aggregators(DNS聚合器)
?DNS Cache Snooping(域名緩存?zhèn)蓽y)
?Alterations & permutations(換置 & 排序)
?DNSSEC(Domain Name System Security Extensions)奖慌,DNS安全擴展,DNSSEC區(qū)域漫步
?CSP HTTP首部
?SPF記錄
?虛擬主機爆破
?ASN發(fā)現(xiàn)
?爬蟲 Scraping(抓燃簿汀)
子域名探測
通過收集子域名信息來進行滲透是目前常見的一種手法。
子域名信息收集可以通過手工,也可以通過工具志鹃,還可以通過普通及漏洞搜索引擎來進行分析硫狞。在挖SRC漏洞時信轿,子域名信息的收集至關(guān)重要!
為什么要進行子域名探測残吩?
?子域名探測可以幫我們發(fā)現(xiàn)滲透測試中更多的服務(wù)财忽,這將增加發(fā)現(xiàn)漏洞的可能性
?查找一些用戶上較少,被人遺忘的子域名泣侮,其上運行的應(yīng)用程序可能會使我們發(fā)現(xiàn)關(guān)鍵漏洞
?通常即彪,同一組織的不同域名/應(yīng)用程序中存在相同的漏洞
?子域名中的常見資產(chǎn)類型一般包括辦公系統(tǒng),郵箱系統(tǒng)活尊,論壇隶校,商城等,其他管理系統(tǒng)蛹锰,網(wǎng)站管理后臺等較少出現(xiàn)在子域名中
子域名探測方法大全
在線接口
https://crt.sh/
https://censys.io/
https://transparencyreport.google.com/
https/certificates ?
https://dnsdumpster.com/
https://hackertarget.com/find-dns-host-records/
https://x.threatbook.cn/
https://www.virustotal.com/gui/home/search
https://phpinfo.me/domain/
https://site.ip138.com/
baidu.com/domain.htm
https://www.t1h2ua.cn/tools/
http://tool.chinaz.com/subdomain/
https://spyse.com/site/not-foun
暴力枚舉
Layer子域名爆破機 Layer是windows下的一款子域名探測工具深胳,其工作原理是利用子域名字典進行爆破,使用簡單容易上手宁仔。
Amass 工具描述:爆破, google, VirusTotal, alt names?
go get -u github.com/OWASP/Amass/...
amass -d target.com -o $outfile
Knock
工具描述:AXFR, virustotal, 爆破?
apt-get install python-dns
python git clone https://xxx.com/guelfoweb/knock.git
cd knock
nano knockpy/config.json # <- set your virustotal API_KEY
python setup.py install
搜索引擎
?Google?
intitle=公司名稱
過濾掉 -site:www.target.com?我們可以在Google搜索中使用 site:運算符來查找一個域的所有子域名
谷歌還額外支持減號運算符 site:*.wikimedia.org -www -store -jobs -uk 以排除我們不感興趣的子域名
?Bing?
Bing搜索引擎也支持一些高級搜索運算符稠屠。
與Google一樣,Bing也支持site:運算符翎苫,可以幫助您檢查除Google搜索之外的其他結(jié)果权埠。發(fā)現(xiàn)子域名: site:target.com
?百度?intitle=公司名稱
?鐘馗之眼?https://www.zoomeye.org/ site=域名
?FOFA?
https://fofa.so/
語法:domain=”baidu.com” 提示:以上方法無需爆破,查詢速度快煎谍,需要快速收集資產(chǎn)時可以優(yōu)先使用攘蔽,后面再用其他方法補充。
Certificate Transparency(證書透明)
SSL/TLS證書
證書透明度(Certificate Transparency)是證書授權(quán)機構(gòu)的一個項目呐粘,證書授權(quán)機構(gòu)會將每個SSL/TLS證書發(fā)布到公共日志中满俗。
一個SSL/TLS證書通常包含域名转捕、子域名和郵件地址。查找某個域名所屬證書的最簡單的方法就是使用搜索引擎搜索一些公開的CT日志唆垃。
在線查詢:?
https://crt.sh/
https://censys.io/
https://developers.facebook.com/tools/ct/
https://google.com/transparencyreport/https/ct/
https://transparencyreport.google.com/https/certificates
CTFR
工具描述:濫用證書透明記錄?
git clone https://xxx.com/UnaPibaGeek/ctfr.git
cd ctfr
pip3 install -r requirements.txt python3 ctfr.py -d target.com -o $outfile
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
Cloudflare_enum.py
工具描述:從Cloudflare提取子域名
dns聚合器?
pip install censys
git clone https://xxx.com/appsecco/the-art-of-subdomain-enumeration.git cloudflare_subdomain_enum.py?your@cloudflare.email?target.com
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
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
Subject Alternate Name (SAN) - 主題備用名稱
SAN(Subject Alternate Name)主題備用名稱,主題備用名稱證書簡單來說辕万,在需要多個域名枢步,將其用于各項服務(wù)時,可使用SAN證書渐尿。
允許在安全證書中使用subjectAltName字段將多種值與證書關(guān)聯(lián)醉途,這些值被稱為主題備用名稱。
名稱可包括:IP地址砖茸、DNS名稱等隘擎。
San_subdomain_enum.py 工具描述:SSL/TLS證書中的SAN獲取子域名?如上。
Public datasets(公開數(shù)據(jù)集)
有些項目收集了全互聯(lián)網(wǎng)范圍內(nèi)的掃描數(shù)據(jù)凉夯,并將其提供給研究人員和安全社區(qū)货葬。
該項目發(fā)布的數(shù)據(jù)集是子域名信息的寶庫。
雖然在這個龐大的數(shù)據(jù)集中找到子域名就像大海撈針恍涂,但卻值得我們?nèi)ヒ辉嚒?/p>
Rapid7 Forward DNS dataset (Project Sonar)
工具描述:來自rapid7 sonar項目的公共數(shù)據(jù)集?
wget https://scans.io/data/rapid7/sonar.fdns_v2/20170417-fdns.json.gz cat 20170417-fdns.json.gz | pigz -dc | grep ".target.org" | jq`
Forward DNS(https://scans.io/study/sonar.fdns_v2) 數(shù)據(jù)集作為Project Sonar的一部分發(fā)布宝惰。
數(shù)據(jù)格式是通過gzip壓縮的JSON文件。
我們可以解析數(shù)據(jù)集以查找給定域名的子域名再沧。
數(shù)據(jù)集很大(壓縮后:20+GB尼夺,壓縮前:300+GB)
Command to parse & 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
數(shù)據(jù)聚合網(wǎng)站?
threatcrowd
https://scans.io/study/sonar.rdns_v2
https://opendata.rapid7.com/
信息泄露
?信息泄露?
首先找到目標(biāo)站點,在官網(wǎng)中可能會找到相關(guān)資產(chǎn)(多為辦公系統(tǒng)炒瘸,郵箱系統(tǒng)等)淤堵,關(guān)注一下頁面底部,也許有管理后臺等收獲顷扩。
?文件泄漏?
crossdomain.xml(跨域策略文件cdx)? ? robots.txt
?Git倉庫泄露
?從流量中分析提取
內(nèi)容解析(HTML拐邪,JavaScript,文件)
BiLE-suite
工具描述:HTML解析隘截,反向dns解析?
aptitude install httrack
git clone https://xxx.com/sensepost/BiLE-suite.git
perl BiLE.pl target.com
Second Order
工具描述:第二階段域名掃描 通過HTML提取子域名?
go get xxx.com/mhmdiaa/second-order
cp ~/go/src/xxx.com/mhmdiaa/second-order/config.json ~/go/src/xxx.com/mhmdiaa/second-order/config-subs-enum.json
編輯修改LogCrawledURLs為True
second-order -base https://target.com -config config.json -output target.com
DNS解析
在線查詢:?
VirusTotal(https://www.virustotal.com/)
ViewDNS(https://viewdns.info/)
DNSdumpster(https://dnsdumpster.com/)
Threatcrowd(https://www.threatcrowd.org/)
BiLE-suite
工具描述:HTML解析扎阶,反向dns解析?如上。
Massdns
工具描述:dns解析?
git clone https://xxx.com/blechschmidt/massdns.git
cd massdns/
make
解析域名:/bin/massdns -r lists/resolvers.txt -t AAAA -w results.txt domains.txt -o S -w output.txt
爆破域名:./scripts/subbrute.py wordlist.txt target.com | ./bin/massdns -r lists/resolvers.txt -t A -o S -w output.txt
CT解析:./scripts/ct.py target.com | ./bin/massdns -r lists/resolvers.txt -t A -o S -w output.txt
區(qū)域傳送
域傳送是一種DNS事務(wù)婶芭,DNS服務(wù)器將其全部或部分域文件的副本傳遞給另一個DNS服務(wù)器东臀。
如果未安全地配置域傳輸送,則任何人都可以對指定名稱的服務(wù)器啟動域傳送并獲取域文件的副本犀农。
根據(jù)設(shè)計惰赋,域文件包含有關(guān)域和保存在域中的大量主機信息。
Windows:
1.nslookup命令進入交互式shell
2.server命令 參數(shù)設(shè)定查詢將要使用的DNS服務(wù)器
3.ls命令列出某個域中的所有域名
Linux:?
Dig
工具描述:dns區(qū)域傳送呵哨,dns反向解析赁濒,dns解析?
dig +multi AXFR target.com dig +multi AXFR $ns_server target.com
DNS aggregators(DNS聚合器)
Cloudflare_enum.py 工具描述:從Cloudflare提取子域名 dns聚合器?
pip install censys
git clone https://xxx.com/appsecco/the-art-of-subdomain-enumeration.git cloudflare_subdomain_enum.py?your@cloudflare.email?target.com
DNS Cache Snooping(域名緩存?zhèn)蓽y)
域名緩存?zhèn)蓽y(DNS Cache Snooping)技術(shù)?
在企業(yè)網(wǎng)絡(luò)中轨奄,通常都會配置DNS服務(wù)器,為網(wǎng)絡(luò)內(nèi)的主機提供域名解析服務(wù)拒炎。
這些DNS不僅解析自己的私有域名挪拟,還會用遞歸方式,請求公網(wǎng)的DNS解析第三方域名枝冀,如baidu.com之類舞丛。
為了提升性能耘子,通常會使用緩存記錄果漾,記錄解析過的域名,尤其是第三方域名谷誓。
域名緩存?zhèn)蓽y(DNS Cache Snooping)技術(shù)就是向這些服務(wù)器發(fā)送域名解析請求绒障,但要求不使用遞歸模式。
這樣DNS只能解析私有域名和緩存中保存的域名捍歪。
借助該項技術(shù)户辱,滲透測試人員就知道哪些域名是否被過請求過。例如糙臼,測試人員可以提交某安全軟件更新所使用的域名庐镐,如果有記錄,說明該網(wǎng)絡(luò)使用該種安全軟件变逃。
Alterations & permutations(換置 & 排序)
AltDNS?工具描述:通過換置&排序技術(shù)發(fā)現(xiàn)子域名?
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
DNSSEC(Domain Name System Security Extensions)必逆,DNS安全擴展,DNSSEC區(qū)域漫步
由于DNSSEC處理不存在域名的方式揽乱,您可以"遍歷"DNSSEC域并枚舉該域中的所有域名名眉。
您可以從這里(https://info.menandmice.com/blog/bid/73645/Take-your-DNSSEC-with-a-grain-of-salt) 了解有關(guān)此技術(shù)的更多信息。
Ldns-walk 工具描述:DNSSEC zone walking, 如果DNSSEC NSEC開啟凰棉,可以獲得全部域名损拢。?
aptitude install ldnsutils
ldns-walk target.com
ldns-walk @nsserver.com target.com
如果DNSSEC NSEC開啟,可以獲得全部域名撒犀。
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
SPF記錄
SPF是通過域名的TXT記錄來進行設(shè)置的福压,SPF記錄列出了所有被授權(quán)代表域名發(fā)送電子郵件的主機
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
虛擬主機爆破
vhost-brute
工具描述:虛擬主機爆破?
aptitude install php-curl git clone https://xxx.com/gwen001/vhost-brute.git
Virtual-host-discovery
工具描述:虛擬主機爆破?
git clone https://xxx.com/jobertabma/virtual-host-discovery.git
ruby scan.rb --ip=1.1.1.1 --host=target.com --output output.txt
ASN發(fā)現(xiàn)
通過域名查詢到 ASN,再通過 ASN 查詢到所屬的所有 ip 范圍
爬蟲 Scraping(抓然蛭琛)
泛解析問題
目前最好的解決方式是通過先獲取一個絕對不存在域名的響應(yīng)內(nèi)容荆姆,再遍歷獲取每個字典對應(yīng)的子域名的響應(yīng)內(nèi)容,通過和不存在域名的內(nèi)容做相似度比對嚷那,來枚舉子域名胞枕,但這樣的實現(xiàn)是以犧牲速度為代價
?https://www.freebuf.com/news/133873.html
?https://xz.aliyun.com/t/5509
Tools
OneForAll
https://github.com/shmilylty/OneForAll 工具也有很多厲害的,平時我一般使用 OneForALL + ESD + JSfinder 來進行搜集魏宽,(ESD 可以加載 layer 的字典腐泻,很好用)
Sublist3r
https://github.com/aboul3la/Sublist3r - 強大的快速子域枚舉工具 評分: ?????????? | 編程語言: Python 2.x/3.x | 仍在維護: ??
guelfoweb/knock
https://github.com/guelfoweb/knock - Knock子域名獲取决乎,可用于查找子域名接管漏洞 評分: ?????????? | 編程語言: Python 2.x | 仍在維護: ??
subdomain3
https://github.com/yanxiu0614/subdomain3 - 一款便捷高效的子域名爆破工具 評分: ?????????? | 編程語言: Python 3.x | 仍在維護: ??
amass
https://github.com/caffix/amass - Go語言開發(fā)的子域名枚舉工具 評分: ?????????? | 編程語言: Go | 仍在維護: ??
Ice3man543/subfinder
https://github.com/Ice3man543/subfinder - 繼承于Sublist3r項目的模塊化體系結(jié)構(gòu),一個強勁的子域名枚舉工具 評分: ?????????? | 編程語言: Go | 仍在維護: ??
horn3t
https://github.com/janniskirschner/horn3t - 帶有網(wǎng)頁截圖功能的子可視化域名枚舉工具 評分: ?????????? | 編程語言: Python 3.x | 仍在維護: ??
subDomainsBrute
https://github.com/lijiejie/subDomainsBrute - Lijiejie開發(fā)的一款使用廣泛的子域名爆破枚舉工具 評分: ?????????? | 編程語言: Python 2.x | 仍在維護: ??
wydomain
https://github.com/ring04h/wydomain - 豬豬俠開發(fā)的一款域名收集全面派桩、精準(zhǔn)的子域名枚舉工具 評分: ?????????? | 編程語言: Python 2.x | 仍在維護: ??
子域名監(jiān)控
LangSrcCurise
https://github.com/LangziFun/LangSrcCurise
Sublert
https://www.freebuf.com/sectool/198396.html
參考
子域名發(fā)現(xiàn)的20種方法?
https://xz.aliyun.com/t/3478
https://blog.csdn.net/qq_39293438/article/details/104829825