External Recon Methodology
Tip
AWSãããã³ã°ãåŠã³ãå®è·µããïŒ
HackTricks Training AWS Red Team Expert (ARTE)
GCPãããã³ã°ãåŠã³ãå®è·µããïŒHackTricks Training GCP Red Team Expert (GRTE)
Azureãããã³ã°ãåŠã³ãå®è·µããïŒ
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricksããµããŒããã
- ãµãã¹ã¯ãªãã·ã§ã³ãã©ã³ã確èªããŠãã ããïŒ
- **ð¬ Discordã°ã«ãŒããŸãã¯ãã¬ã°ã©ã ã°ã«ãŒãã«åå ããããTwitter ðŠ @hacktricks_liveããã©ããŒããŠãã ããã
- HackTricksããã³HackTricks Cloudã®GitHubãªããžããªã«PRãæåºããŠãããã³ã°ããªãã¯ãå ±æããŠãã ããã
è³ç£ã®çºèŠ
So you were said that everything belonging to some company is inside the scope, and you want to figure out what this company actually owns.
ãã®ãã§ãŒãºã®ç®çã¯ããŸãã¡ã€ã³äŒæ¥ãææãããã¹ãŠã® companies owned by the main company ãååŸãããããããããã®äŒæ¥ãæã€ãã¹ãŠã® assets ãç¹å®ããããšã§ãããããè¡ãããã«ã次ã宿œããŸã:
- ã¡ã€ã³äŒæ¥ã®è²·åå ãèŠã€ããããã«ããã¹ã³ãŒãå ã®äŒæ¥ãç¹å®ããã
- åäŒæ¥ã® ASN (ããããã°) ãèŠã€ããããã«ããåäŒæ¥ãææãã IP ranges ãç¹å®ããã
- reverse whois lookups ã䜿ã£ãŠãæåã®ãšã³ããªã«é¢é£ããä»ã®æ å ±ïŒorganisation names, domainsâŠïŒãæ€çŽ¢ããïŒååž°çã«è¡ãããšãå¯èœïŒã
- shodan ã®
orgãsslãã£ã«ã¿ãªã©ä»ã®ææ³ã䜿ã£ãŠä»ã®ã¢ã»ãããæ¢çŽ¢ããïŒsslããªãã¯ã¯ååž°çã«è¡ããïŒã
Acquisitions
ãŸãæåã«ãã©ã® other companies are owned by the main company ãç¥ãå¿
èŠããããŸãã
äžã€ã®æ¹æ³ã¯ https://www.crunchbase.com/ ã蚪ããsearch ã§ main company ãæ¢ããclick ã㊠âacquisitionsâ ãèŠãããšã§ããããã«ã¡ã€ã³äŒæ¥ãè²·åããä»ã®äŒæ¥ã衚瀺ãããŸãã
å¥ã®æ¹æ³ã¯ãã¡ã€ã³äŒæ¥ã® Wikipedia ããŒãžã蚪ã㊠acquisitions ãæ¢ãããšã§ãã
äžå ŽäŒæ¥ã®å Žåã¯ãSEC/EDGAR filingsãinvestor relations ããŒãžããŸãã¯å°åã®äŒæ¥ç»èšïŒäŸïŒè±åœã® Companies HouseïŒã確èªããŠãã ããã
ã°ããŒãã«ãªäŒæ¥ããªãŒãåäŒç€Ÿã調ã¹ãã«ã¯ãOpenCorporates (https://opencorporates.com/) ã GLEIF LEI ããŒã¿ããŒã¹ (https://www.gleif.org/) ã詊ããŠã¿ãŠãã ããã
Ok, at this point you should know all the companies inside the scope. Lets figure out how to find their assets.
ASNs
An autonomous system number (ASN) ã¯ãInternet Assigned Numbers Authority (IANA) ã«ãã£ãŠ autonomous systemïŒASïŒã«å²ãåœãŠãããäžæã®çªå·ã§ãã
AS ã¯ãå€éšãããã¯ãŒã¯ãžã®ã¢ã¯ã»ã¹ã«é¢ããããªã·ãŒãæç¢ºã«å®çŸ©ããã blocks ã® IP addresses ã§æ§æãããåäžã®çµç¹ã«ãã£ãŠç®¡çãããŸãããè€æ°ã®äºæ¥è
ã§æ§æãããããšããããŸãã
äŒæ¥ã ASN ãå²ãåœãŠãããŠãããã確èªããããšã¯ããã® IP ranges ãèŠã€ããããã«æçšã§ããã¹ã³ãŒãå
ã®ãã¹ãŠã® hosts ã«å¯Ÿã㊠vulnerability test ãè¡ãããããã® IP å
ã«ãã domains ãæ¢ãããšã«èå³ãããã§ãããã
https://bgp.he.net/ãhttps://bgpview.io/ ãŸã㯠https://ipinfo.io/ ã§äŒç€Ÿã® nameãIPããŸã㯠domain ã§ search ã§ããŸãã
äŒç€Ÿã®å°åã«ãã£ãŠã¯è¿œå ã§æçšãªæ
å ±ãåŸããããªã³ã¯: AFRINIC (ã¢ããªã«), Arin(åã¢ã¡ãªã«), APNIC (ã¢ãžã¢), LACNIC (ã©ãã³ã¢ã¡ãªã«), RIPE NCC (ãšãŒããã). ãšã«ããããã¶ãæåã®ãªã³ã¯ã§ãã§ã«å¿
èŠãªæçšãªæ
å ±ïŒIP ranges ãš WhoisïŒã¯åŸãããã§ãããã
#You can try "automate" this with amass, but it's not very recommended
amass intel -org tesla
amass intel -asn 8911,50313,394161
ãŸããBBOTâs enumeration ã¯ã¹ãã£ã³ã®æåŸã«ASNsãèªåçã«éçŽããŠèŠçŽããŸãã
bbot -t tesla.com -f subdomain-enum
...
[INFO] bbot.modules.asn: +----------+---------------------+--------------+----------------+----------------------------+-----------+
[INFO] bbot.modules.asn: | AS394161 | 8.244.131.0/24 | 5 | TESLA | Tesla Motors, Inc. | US |
[INFO] bbot.modules.asn: +----------+---------------------+--------------+----------------+----------------------------+-----------+
[INFO] bbot.modules.asn: | AS16509 | 54.148.0.0/15 | 4 | AMAZON-02 | Amazon.com, Inc. | US |
[INFO] bbot.modules.asn: +----------+---------------------+--------------+----------------+----------------------------+-----------+
[INFO] bbot.modules.asn: | AS394161 | 8.45.124.0/24 | 3 | TESLA | Tesla Motors, Inc. | US |
[INFO] bbot.modules.asn: +----------+---------------------+--------------+----------------+----------------------------+-----------+
[INFO] bbot.modules.asn: | AS3356 | 8.32.0.0/12 | 1 | LEVEL3 | Level 3 Parent, LLC | US |
[INFO] bbot.modules.asn: +----------+---------------------+--------------+----------------+----------------------------+-----------+
[INFO] bbot.modules.asn: | AS3356 | 8.0.0.0/9 | 1 | LEVEL3 | Level 3 Parent, LLC | US |
[INFO] bbot.modules.asn: +----------+---------------------+--------------+----------------+----------------------------+-----------+
You can find the IP ranges of an organisation also using http://asnlookup.com/ (it has free API).
You can find the IP and ASN of a domain using http://ipv4info.com/.
Looking for vulnerabilities
At this point we know ã¹ã³ãŒãå
ã®ãã¹ãŠã®ã¢ã»ãã, so if you are allowed you could launch some vulnerability scanner (Nessus, OpenVAS, Nuclei) over all the hosts.
Also, you could launch some port scans or use services like Shodan, Censys, or ZoomEye to find open ports and depending on what you find you should take a look in this book to how to pentest several possible services running.
Also, It could be worth it to mention that you can also prepare some default username and passwords lists and try to bruteforce services with https://github.com/x90skysn3k/brutespray.
Domains
We know all the companies inside the scope and their assets, itâs time to find the domains inside the scope.
Please, note that in the following purposed techniques you can also find subdomains and that information shouldnât be underrated.
First of all you should look for the main domain(s) of each company. For example, for Tesla Inc. is going to be tesla.com.
Reverse DNS
As you have found all the IP ranges of the domains you could try to perform reverse dns lookups on those IPs to find more domains inside the scope. Try to use some dns server of the victim or some well-known dns server (1.1.1.1, 8.8.8.8)
dnsrecon -r <DNS Range> -n <IP_DNS> #DNS reverse of all of the addresses
dnsrecon -d facebook.com -r 157.240.221.35/24 #Using facebooks dns
dnsrecon -r 157.240.221.35/24 -n 1.1.1.1 #Using cloudflares dns
dnsrecon -r 157.240.221.35/24 -n 8.8.8.8 #Using google dns
For this to work, the administrator has to enable manually the PTR.
ãªã³ã©ã€ã³ããŒã«ã§ããã®æ
å ±ãååŸã§ããŸã: http://ptrarchive.com/.
倧ããªã¬ã³ãžã®å Žåãmassdns ã dnsx ã®ãããªããŒã«ã¯ãªããŒã¹ã«ãã¯ã¢ããããšã³ãªããã¡ã³ãã®èªååã«äŸ¿å©ã§ãã
Reverse Whois (loop)
Inside a whois you can find a lot of interesting æ
å ± like çµç¹å, äœæ, ã¡ãŒã«ã¢ãã¬ã¹, é»è©±çªå·âŠ ãããããã«è峿·±ãã®ã¯ããããã®ãã£ãŒã«ãã®ããããã§reverse whois lookupsãè¡ãããšã§ãïŒäŸãã°åãã¡ãŒã«ã¢ãã¬ã¹ãçŸããä»ã®whoisã¬ã³ãŒããªã©ïŒäŒç€Ÿã«é¢é£ããããå€ãã®è³ç£ãèŠã€ããããç¹ã§ãã
次ã®ãããªãªã³ã©ã€ã³ããŒã«ã䜿ããŸã:
- https://viewdns.info/reversewhois/ - ç¡æ
- https://domaineye.com/reverse-whois - ç¡æ
- https://www.reversewhois.io/ - ç¡æ
- https://www.whoxy.com/ - ç¡æïŒwebïŒãAPIã¯ææ
- http://reversewhois.domaintools.com/ - ææ
- https://drs.whoisxmlapi.com/reverse-whois-search - ææïŒãã ã100åç¡æã®æ€çŽ¢ä»ãïŒ
- https://www.domainiq.com/ - ææ
- https://securitytrails.com/ - ææïŒAPIïŒ
- https://whoisfreaks.com/ - ææïŒAPIïŒ
ãã®ã¿ã¹ã¯ã¯ DomLink ã䜿ã£ãŠèªååã§ããŸãïŒwhoxy API key ãå¿
èŠã§ãïŒã
ãŸã amass ã䜿ã£ãŠèªåçã« reverse whois ã®çºèŠãè¡ãããšãã§ããŸã: amass intel -d tesla.com -whois
æ°ãããã¡ã€ã³ãèŠã€ãããã³ã«ããã®ææ³ã䜿ã£ãŠããã«å€ãã®ãã¡ã€ã³åãçºèŠã§ããããšã«æ³šæããŠãã ããã
Trackers
ãã2ã€ã®ç°ãªãããŒãžã§åããã©ãã«ãŒIDãèŠã€ãã£ãå Žåããããã®äž¡æ¹ã®ããŒãžã¯åãããŒã ã«ãã£ãŠç®¡çãããŠãããšæšæž¬ã§ããŸãã
äŸãã°ãè€æ°ã®ããŒãžã§åã Google Analytics ID ãåã Adsense ID ãèŠãããå Žåã§ãã
ãããã®ãã©ãã«ãŒãªã©ã§æ€çŽ¢ã§ãããŠã§ããµã€ããããŒã«ã«ã¯æ¬¡ã®ãããªãã®ããããŸã:
- Udon
- BuiltWith
- Sitesleuth
- Publicwww
- SpyOnWeb
- WebscoutïŒanalytics/trackersã®å ±æããé¢é£ãµã€ããçºèŠïŒ
Favicon
åãfaviconã®ããã·ã¥ãæ¢ãããšã§ãã¿ãŒã²ããã«é¢é£ãããã¡ã€ã³ããµããã¡ã€ã³ãèŠã€ããããããšããåç¥ã§ãããïŒããã¯ãŸãã« favihash.pyïŒäœæ: @m4ll0k2ïŒãè¡ããã®ã§ããäœ¿ãæ¹ã¯æ¬¡ã®éãã§ã:
cat my_targets.txt | xargs -I %% bash -c 'echo "http://%%/favicon.ico"' > targets.txt
python3 favihash.py -f https://target/favicon.ico -t targets.txt -s

èŠããã«ãfavihash ã¯ã¿ãŒã²ãããšåã favicon ã¢ã€ã³ã³ã® hash ãæã€ãã¡ã€ã³ãçºèŠããããšãå¯èœã«ããŸãã
ããã«ãfavicon hash ã䜿ã£ãŠæè¡ãæ€çŽ¢ããããšãã§ããŸãïŒè©³çŽ°ã¯ this blog post ãåç §ïŒãã€ãŸãããã web tech ã®è匱ãªããŒãžã§ã³ã® favicon ã® hash ãç¥ã£ãŠããã°ãshodan ã§ãããæ€çŽ¢ã㊠ããå€ãã®è匱ãªç®æãèŠã€ãã ããšãã§ããŸãïŒ
shodan search org:"Target" http.favicon.hash:116323821 --fields ip_str,port --separator " " | awk '{print $1":"$2}'
ãŠã§ãã® favicon hash ãèšç®ããæ¹æ³:
import mmh3
import requests
import codecs
def fav_hash(url):
response = requests.get(url)
favicon = codecs.encode(response.content,"base64")
fhash = mmh3.hash(favicon)
print(f"{url} : {fhash}")
return fhash
You can also get favicon hashes at scale with httpx (httpx -l targets.txt -favicon) and then pivot in Shodan/Censys.
èäœæš© / ãŠããŒã¯æåå
ãŠã§ãããŒãžå
ã§ãåãçµç¹å
ã®ç°ãªããŠã§ããµã€ãéã§å
±æãããå¯èœæ§ã®ããæååãæ€çŽ¢ããŸããèäœæš©æååã¯è¯ãäŸã§ããæ¬¡ã«ããã®æååãgoogleãä»ã®ãã©ãŠã¶ããããã¯shodanã§æ€çŽ¢ããŸã: shodan search http.html:"Copyright string"
CRT Time
äŸãã°ã次ã®ãããªcronãžã§ããèšå®ããŠããããšããããããŸãã
# /etc/crontab
37 13 */10 * * certbot renew --post-hook "systemctl reload nginx"
ãµãŒãäžã®ãã¹ãŠã®ãã¡ã€ã³èšŒææžãæŽæ°ããããã«ãããã¯ã䜿çšãããCAãValidityæéã«çææå»ãèšå®ããŠããªããŠããcertificate transparency logsã§åãäŒç€Ÿã«å±ãããã¡ã€ã³ãèŠã€ããããšãã§ããããšãæå³ããŸãã
Check out this writeup for more information.
Also use certificate transparency logs directly:
- https://crt.sh/
- https://certspotter.com/
- https://search.censys.io/
- https://chaos.projectdiscovery.io/ + chaos-client
ã¡ãŒã« DMARC æ å ±
You can use a web such as https://dmarc.live/info/google.com or a tool such as https://github.com/Tedixx/dmarc-subdomains to find domains and subdomain sharing the same dmarc information.
ä»ã«æçšãªããŒã«ã¯spoofcheckãšdmarcianã§ãã
Passive Takeover
äžè¬çã«ããµããã¡ã€ã³ãã¯ã©ãŠããããã€ãã«å±ããIPã«å²ãåœãŠããã®åŸãã®IPã¢ãã¬ã¹ã倱ããDNSã¬ã³ãŒãã®åé€ãå¿ããããšããããããŸãããããã£ãŠãåã«ã¯ã©ãŠãïŒäŸ: Digital OceanïŒã§VMãèµ·åããã ãã§ãå®éã«ããã€ãã®ãµããã¡ã€ã³ã奪åããããšãã§ããŸãã
This post ã¯ãã®ä»¶ã«ã€ããŠèª¬æããDigitalOceanã§VMãäœæããæ°ãããã·ã³ã®IPv4ãååŸããŠãVirustotalã§ãããæããµããã¡ã€ã³ã¬ã³ãŒããæ€çŽ¢ããã¹ã¯ãªãããææ¡ããŠããŸãã
Other ways
Note that you can use this technique to discover more domain names every time you find a new domain.
Shodan
æ¢ã«IP空éãææããçµç¹åãåãã£ãŠããã®ã§ãshodanã§ãã®æ
å ±ã䜿ã£ãŠæ€çŽ¢ã§ããŸã: org:"Tesla, Inc."ãèŠã€ãã£ããã¹ãã®TLSèšŒææžã確èªããäºæããªãæ°ãããã¡ã€ã³ããªãããã§ãã¯ããŠãã ããã
You could access the TLS certificate of the main web page, obtain the Organisation name and then search for that name inside the TLS certificates of all the web pages known by shodan with the filter : ssl:"Tesla Motors" or use a tool like sslsearch.
Assetfinder
Assetfinder ã¯ãã¡ã€ã³ãã¡ã€ã³ã«é¢é£ãããã¡ã€ã³ããããã®ãµããã¡ã€ã³ãæ¢ãããŒã«ã§ãããªãåªç§ã§ãã
Passive DNS / Historical DNS
Passive DNSããŒã¿ã¯ããŸã 解決ãããå€ãå¿ããããã¬ã³ãŒããã奪åå¯èœãªã¬ã³ãŒããèŠã€ããã®ã«æé©ã§ãã以äžãåç §ããŠãã ãã:
- https://securitytrails.com/
- https://community.riskiq.com/ (PassiveTotal)
- https://www.domaintools.com/products/iris/
- https://www.farsightsecurity.com/solutions/dnsdb/
Looking for vulnerabilities
Check for some domain takeover. Maybe some company is using some a domain but they lost the ownership. Just register it (if cheap enough) and let know the company.
If you find any domain with an IP different from the ones you already found in the assets discovery, you should perform a basic vulnerability scan (using Nessus or OpenVAS) and some port scan with nmap/masscan/shodan. Depending on which services are running you can find in this book some tricks to âattackâ them.
Note that sometimes the domain is hosted inside an IP that is not controlled by the client, so itâs not in the scope, be careful.
ãµããã¡ã€ã³
We know all the companies inside the scope, all the assets of each company and all the domains related to the companies.
ããã§ãèŠã€ãã£ãåãã¡ã€ã³ã®å¯èœãªãã¹ãŠã®ãµããã¡ã€ã³ãèŠã€ããæã§ãã
Tip
ãã¡ã€ã³ãèŠã€ããããã®ããŒã«ãææ³ã®äžã«ã¯ããµããã¡ã€ã³ã®çºèŠã«ã圹ç«ã€ãã®ãããç¹ã«æ³šæããŠãã ããã
DNS
DNSã¬ã³ãŒããããµããã¡ã€ã³ãååŸããŠã¿ãŸãããããŸããZone Transferã詊ãã¹ãã§ãïŒè匱ãªãã¬ããŒãããŠãã ããïŒã
dnsrecon -a -d tesla.com
OSINT
å€ãã®ãµããã¡ã€ã³ãååŸããæãéãæ¹æ³ã¯ãå€éšãœãŒã¹ãæ€çŽ¢ããããšã§ããæããã䜿ãããtoolsã¯ä»¥äžã®éãã§ãïŒããè¯ãçµæãåŸãã«ã¯API keysãèšå®ããŠãã ããïŒ:
# subdomains
bbot -t tesla.com -f subdomain-enum
# subdomains (passive only)
bbot -t tesla.com -f subdomain-enum -rf passive
# subdomains + port scan + web screenshots
bbot -t tesla.com -f subdomain-enum -m naabu gowitness -n my_scan -o .
amass enum [-active] [-ip] -d tesla.com
amass enum -d tesla.com | grep tesla.com # To just list subdomains
# Subfinder, use -silent to only have subdomains in the output
./subfinder-linux-amd64 -d tesla.com [-silent]
# findomain, use -silent to only have subdomains in the output
./findomain-linux -t tesla.com [--quiet]
python3 oneforall.py --target tesla.com [--dns False] [--req False] [--brute False] run
assetfinder --subs-only <domain>
# It requires that you create a sudomy.api file with API keys
sudomy -d tesla.com
vita -d tesla.com
theHarvester -d tesla.com -b "anubis, baidu, bing, binaryedge, bingapi, bufferoverun, censys, certspotter, crtsh, dnsdumpster, duckduckgo, fullhunt, github-code, google, hackertarget, hunter, intelx, linkedin, linkedin_links, n45ht, omnisint, otx, pentesttools, projectdiscovery, qwant, rapiddns, rocketreach, securityTrails, spyse, sublist3r, threatcrowd, threatminer, trello, twitter, urlscan, virustotal, yahoo, zoomeye"
ä»ã«ããçŽæ¥subdomainsã®çºèŠã«ç¹åããŠããªãå Žåã§ãsubdomainsãèŠã€ããã®ã«åœ¹ç«ã€other interesting tools/APIsããããŸããäŸãã°:
- Crobat: API https://sonar.omnisint.io ã䜿çšã㊠subdomains ãååŸããŸã
# Get list of subdomains in output from the API
## This is the API the crobat tool will use
curl https://sonar.omnisint.io/subdomains/tesla.com | jq -r ".[]"
curl https://jldc.me/anubis/subdomains/tesla.com | jq -r ".[]"
- RapidDNS ç¡æã®API
# Get Domains from rapiddns free API
rapiddns(){
curl -s "https://rapiddns.io/subdomain/$1?full=1" \
| grep -oE "[\.a-zA-Z0-9-]+\.$1" \
| sort -u
}
rapiddns tesla.com
# Get Domains from crt free API
crt(){
curl -s "https://crt.sh/?q=%25.$1" \
| grep -oE "[\.a-zA-Z0-9-]+\.$1" \
| sort -u
}
crt tesla.com
- gau: æå®ãããã¡ã€ã³ã®æ¢ç¥ã®URLã AlienVaultâs Open Threat ExchangeãWayback MachineãCommon Crawl ããååŸããŸãã
# Get subdomains from GAUs found URLs
gau --subs tesla.com | cut -d "/" -f 3 | sort -u
- SubDomainizer & subscraper: ãããã¯Webãã¹ã¯ã¬ã€ãã³ã°ããŠJSãã¡ã€ã«ãæ¢ããããããsubdomainsãæœåºããŸãã
# Get only subdomains from SubDomainizer
python3 SubDomainizer.py -u https://tesla.com | grep tesla.com
# Get only subdomains from subscraper, this already perform recursion over the found results
python subscraper.py -u tesla.com | grep tesla.com | cut -d " " -f
# Get info about the domain
shodan domain <domain>
# Get other pages with links to subdomains
shodan search "http.html:help.domain.com"
export CENSYS_API_ID=...
export CENSYS_API_SECRET=...
python3 censys-subdomain-finder.py tesla.com
python3 DomainTrail.py -d example.com
- securitytrails.com 㯠subdomains ãš IP history ãæ€çŽ¢ããããã®ç¡æã® API ãæäŸããŠããŸã
- chaos.projectdiscovery.io
ãã®ãããžã§ã¯ãã¯ ç¡æã§ bug-bounty programs ã«é¢é£ãããã¹ãŠã® subdomains ãæäŸããŠããŸãããã®ããŒã¿ã«ã¯ chaospy ã䜿ã£ãŠã¢ã¯ã»ã¹ããããšãããããžã§ã¯ãã§äœ¿çšãããŠããã¹ã³ãŒãã«ã¢ã¯ã»ã¹ããããšãã§ããŸã: https://github.com/projectdiscovery/chaos-public-program-list
å€ãã®ãããã®ããŒã«ã®æ¯èŒã¯ããã§ç¢ºèªã§ããŸã: https://blog.blacklanternsecurity.com/p/subdomain-enumeration-tool-face-off
DNS Brute force
å¯èœãª subdomain names ã䜿ã£ãŠ DNS servers ããã«ãŒããã©ãŒã¹ããæ°ãã subdomains ãèŠã€ããŠã¿ãŸãããã
For this action you will need some common subdomains wordlists like:
- https://gist.github.com/jhaddix/86a06c5dc309d08580a018c66354a056
- https://wordlists-cdn.assetnote.io/data/manual/best-dns-wordlist.txt
- https://localdomain.pw/subdomain-bruteforce-list/all.txt.zip
- https://github.com/pentester-io/commonspeak
- https://github.com/danielmiessler/SecLists/tree/master/Discovery/DNS
And also IPs of good DNS resolvers. In order to generate a list of trusted DNS resolvers you can download the resolvers from https://public-dns.info/nameservers-all.txt and use dnsvalidator to filter them. Or you could use: https://raw.githubusercontent.com/trickest/resolvers/main/resolvers-trusted.txt
The most recommended tools for DNS brute-force are:
- massdns: ããã¯å¹æç㪠DNS brute-force ãå®è¡ããæåã®ããŒã«ã§ãããéåžžã«é«éã§ããã誀æ€ç¥ãçºçããããã§ãã
sed 's/$/.domain.com/' subdomains.txt > bf-subdomains.txt
./massdns -r resolvers.txt -w /tmp/results.txt bf-subdomains.txt
grep -E "tesla.com. [0-9]+ IN A .+" /tmp/results.txt
- gobuster: ããã¯1ã€ã®resolverãã䜿ããªããšæããŸã
gobuster dns -d mysite.com -t 50 -w subdomains.txt
- shuffledns ã¯
massdnsã®ã©ãããŒã§ãgoã§æžãããŠãããactive bruteforce ã䜿ã£ãŠæå¹ãªãµããã¡ã€ã³ãåæã§ããã»ããã¯ã€ã«ãã«ãŒãåŠçãšç°¡åãªå ¥åºåãµããŒãã§ãµããã¡ã€ã³ã解決ã§ããŸãã
shuffledns -d example.com -list example-subdomains.txt -r resolvers.txt
- puredns:
massdnsã䜿çšããŸãã
puredns bruteforce all.txt domain.com
- aiodnsbrute 㯠asyncio ã䜿ã£ãŠãã¡ã€ã³åãéåæã« brute force ããŸãã
aiodnsbrute -r resolvers -w wordlist.txt -vv -t 1024 domain.com
2åç®ã® DNS Brute-Force ã©ãŠã³ã
å ¬éãœãŒã¹ãš brute-forcing ã䜿ã£ãŠãµããã¡ã€ã³ãèŠã€ããåŸãèŠã€ãã£ããµããã¡ã€ã³ã®æŽŸçãçæããŠããã«å€ãèŠã€ããããšãã§ããŸãããã®ç®çã«åœ¹ç«ã€ããŒã«ãããã€ããããŸãïŒ
- dnsgen: ãã¡ã€ã³ãšãµããã¡ã€ã³ãäžãããšãããªãšãŒã·ã§ã³ïŒããŒãã¥ããŒã·ã§ã³ïŒãçæããŸãã
cat subdomains.txt | dnsgen -
- goaltdns: ãã¡ã€ã³ãšãµããã¡ã€ã³ããããŒãã¥ããŒã·ã§ã³ãçæããŸãã
- goaltdnsã®ããŒãã¥ããŒã·ã§ã³çšwordlistã¯hereã§å ¥æã§ããŸãã
goaltdns -l subdomains.txt -w /tmp/words-permutations.txt -o /tmp/final-words-s3.txt
- gotator: ãã¡ã€ã³ãšãµããã¡ã€ã³ãããšã«ããŒãã¥ããŒã·ã§ã³ãçæããŸããããŒãã¥ããŒã·ã§ã³ãã¡ã€ã«ãæå®ãããŠããªãå Žåãgotatorã¯çµã¿èŸŒã¿ã®ãã®ã䜿çšããŸãã
gotator -sub subdomains.txt -silent [-perm /tmp/words-permutations.txt]
- altdns: subdomains permutationsãçæããã ãã§ãªããããããresolveããããšããããšãã§ããŸãïŒãã ããåã«æããããŒã«ãäœ¿ãæ¹ãè¯ãã§ãïŒã
- altdns permutationsçšwordlistã¯hereã§å ¥æã§ããŸãã
altdns -i subdomains.txt -w /tmp/words-permutations.txt -o /tmp/asd3
- dmut: ãµããã¡ã€ã³ã®é åãå€ç°ã倿Žãè¡ãå¥ã®ããŒã«ã§ãããã®ããŒã«ã¯çµæãbrute forceããŸãïŒdns wild cardã¯ãµããŒãããŠããŸããïŒã
- dmut permutations wordlist 㯠here ã§å ¥æã§ããŸãã
cat subdomains.txt | dmut -d /tmp/words-permutations.txt -w 100 \
--dns-errorLimit 10 --use-pb --verbose -s /tmp/resolvers-trusted.txt
- alterx: ãã¡ã€ã³ã«åºã¥ããæå®ããããã¿ãŒã³ã«åŸã£ãŠæ°ããæœåšçãªãµããã¡ã€ã³åãçæããããå€ãã®ãµããã¡ã€ã³ãçºèŠããããšããŸãã
ã¹ããŒããªé åçæ
- regulator: 詳现ã¯ãã®postãåç §ããŠãã ãããåºæ¬çã«ãäž»èŠéšåãçºèŠããããµããã¡ã€ã³ããæœåºããããããçµã¿åãããŠããå€ãã®ãµããã¡ã€ã³ãèŠã€ããŸãã
python3 main.py adobe.com adobe adobe.rules
make_brute_list.sh adobe.rules adobe.brute
puredns resolve adobe.brute --write adobe.valid
- subzuf: subzuf ã¯ãéåžžã«åçŽã ã广ç㪠DNS response-guided algorithm ãšçµã¿åãããã subdomain brute-force fuzzer ã§ããæäŸãããå ¥åããŒã¿ïŒtailored wordlist ã historical DNS/TLS records ãªã©ïŒãå©çšããŠãããå€ãã®å¯Ÿå¿ãã domain names ãæ£ç¢ºã«åæããDNS scan äžã«åéãããæ å ±ã«åºã¥ããŠã«ãŒãã§ããã«æ¡åŒµããŸãã
echo www | subzuf facebook.com
ãµããã¡ã€ã³çºèŠã¯ãŒã¯ãããŒ
ç§ãæžãããã®ããã°èšäºããã§ãã¯ããŠãã ãããããã§ã¯ããã¡ã€ã³ããã®ãµããã¡ã€ã³æ¢çŽ¢ãèªååããæ¹æ³ããTrickest workflowsã䜿ã£ãŠèª¬æããŠãããæå ã®ã³ã³ãã¥ãŒã¿ã§å€æ°ã®ããŒã«ãæåã§èµ·åããå¿ èŠããããŸãã:
https://trickest.com/blog/full-subdomain-discovery-using-workflow/
https://trickest.com/blog/full-subdomain-brute-force-discovery-using-workflow/
VHosts / Virtual Hosts
ãããµããã¡ã€ã³ã«å±ãã1ã€ãŸãã¯è€æ°ã®ãŠã§ãããŒãžãå«ãIPã¢ãã¬ã¹ãèŠã€ããå ŽåãIPå ã®ãã¡ã€ã³ã調ã¹ãããã«OSINT sourcesãåç §ããããåãIPã§brute-forcing VHost domain names in that IPãè¡ã£ãŠããã®IPå ã®ä»ã®ãµããã¡ã€ã³ãèŠã€ããããšã詊ã¿ãããšãã§ããŸãã
OSINT
ããã€ãã®VHosts in IPs usingãHostHunter or other APIsã§èŠã€ããããšãã§ããŸãã
Brute Force
ãããµããã¡ã€ã³ããŠã§ããµãŒãã«é ãããŠãããšæãããå Žåããããbrute forceã§æ¢ãããšã詊ã¿ãããšãã§ããŸã:
ffuf -c -w /path/to/wordlist -u http://victim.com -H "Host: FUZZ.victim.com"
gobuster vhost -u https://mysite.com -t 50 -w subdomains.txt
wfuzz -c -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-20000.txt --hc 400,404,403 -H "Host: FUZZ.example.com" -u http://example.com -t 100
#From https://github.com/allyshka/vhostbrute
vhostbrute.py --url="example.com" --remoteip="10.1.1.15" --base="www.example.com" --vhosts="vhosts_full.list"
#https://github.com/codingo/VHostScan
VHostScan -t example.com
Tip
ãã®ææ³ã䜿ããšãå éš/é ãã endpoints ã«ã¢ã¯ã»ã¹ã§ããããšãããããŸãã
CORS Brute Force
å Žåã«ãã£ãŠã¯ãæå¹ãª domain/subdomain ã Origin ããããŒã«èšå®ãããŠãããšãã«ã®ã¿ãããŒãžã Access-Control-Allow-Origin ããããŒãè¿ãããšããããŸããããããç¶æ³ã§ã¯ããã®æåãæªçšããŠæ°ãã subdomains ã çºèŠ ããããšãã§ããŸãã
ffuf -w subdomains-top1million-5000.txt -u http://10.10.10.208 -H 'Origin: http://FUZZ.crossfit.htb' -mr "Access-Control-Allow-Origin" -ignore-body
Buckets Brute Force
subdomainsãæ¢ãéã¯ãã©ã®ã¿ã€ãã®bucketã«pointingããŠãããæ³šæãããã®å Žåã¯check the permissions.
ãŸãããã®æç¹ã§ã¹ã³ãŒãå
ã®ãã¹ãŠã®ãã¡ã€ã³ãåãã£ãŠããã¯ããªã®ã§ãbrute force possible bucket names and check the permissionsã詊ããŠã¿ãŠãã ããã
ç£èŠ
ãã¡ã€ã³ã®new subdomainsãäœæããããã©ããã¯ãCertificate Transparency Logsãmonitorããããšã§ç¢ºèªã§ããŸããããã¯sublertãè¡ãããšã§ãã
è匱æ§ã®æ¢çŽ¢
å¯èœãªsubdomain takeoversã確èªããŠãã ããã
ããsubdomainãS3 bucketãæããŠããå Žåã¯ãcheck the permissionsã
ã¢ã»ããçºèŠã§æ¢ã«èŠã€ãã£ãŠãããã®ãšã¯ç°ãªãIPãæã€subdomain with an IP differentãèŠã€ããå Žåã¯ãbasic vulnerability scanïŒNessus ã OpenVAS ã䜿çšïŒãè¡ããport scanãnmap/masscan/shodanã§å®æœãã¹ãã§ããã©ã®ãµãŒãã¹ãåäœããŠãããã«ãã£ãŠã¯ãthis book some tricks to âattackâ themãèŠã€ããããããšããããŸãã
泚æ: å Žåã«ãã£ãŠã¯ãµããã¡ã€ã³ãã¯ã©ã€ã¢ã³ã管çå€ã®IPäžã«ãã¹ããããŠããããã®ããã¹ã³ãŒãå€ã§ããããšãããã®ã§æ³šæããŠãã ããã
IPs
åæã®ã¹ãããã§found some IP ranges, domains and subdomainsãèŠã€ãã£ãŠãããããããŸããã
ãããã®ã¬ã³ãžããrecollect all the IPs from those rangesãããã¡ã€ã³/ãµããã¡ã€ã³ïŒDNS ã¯ãšãªïŒã«ã€ããŠãåéããæã§ãã
以äžã®free apisãå©çšãããšããã¡ã€ã³ããµããã¡ã€ã³ã以åã«äœ¿çšããŠããprevious IPs used by domains and subdomainsãèŠã€ããããšãã§ããŸãããããã®IPã¯ãŸã ã¯ã©ã€ã¢ã³ããææããŠããå¯èœæ§ããããCloudFlare bypassesãèŠã€ããããããšããããŸãã
ç¹å®ã®IPã¢ãã¬ã¹ãæããŠãããã¡ã€ã³ã調ã¹ãã«ã¯ããŒã«hakip2hostã䜿ãããšãã§ããŸãã
è匱æ§ã®æ¢çŽ¢
Port scan all the IPs that doesnât belong to CDNsïŒCDNã«å±ããªããã¹ãŠã®IPãããŒãã¹ãã£ã³ããïŒããšãæšå¥šããŸãïŒCDNå ã§ã¯è峿·±ããã®ãèŠã€ããå¯èœæ§ã¯äœãã§ãïŒãçºèŠãã皌åäžã®ãµãŒãã¹ããable to find vulnerabilitiesããšããããŸãã
Find a guide about how to scan hosts.
Web servers æ¢çŽ¢
We have found all the companies and their assets and we know IP ranges, domains and subdomains inside the scope. Itâs time to search for web servers.
åã®ã¹ãããã§ããããæ¢ã«recon of the IPs and domains discoveredãè¡ã£ãŠãããããalready found all the possible web serversã§ããå¯èœæ§ããããŸãããããããŸã ãªãããããã¹ã³ãŒãå ã§fast tricks to search for web serversãèŠãŠãããŸãã
ããã¯oriented for web apps discoveryåããªã®ã§ãperform the vulnerabilityãport scanningãïŒã¹ã³ãŒããèš±å¯ããŠããã°ïŒå®æœãã¹ãã§ãã
masscan can be found hereã䜿ã£ãfast methodã§ports openïŒweb ã«é¢é£ããããŒãïŒãçºèŠããæ¹æ³ããããŸãã
web servers ãæ¢ãå¥ã®äŸ¿å©ãªããŒã«ã¯httprobe, fprobe ãš httpxã§ãããã¡ã€ã³ã®ãªã¹ããæž¡ããšãããŒã80 (http) ãš443 (https) ã«æ¥ç¶ã詊ã¿ãŸããããã«ä»ã®ããŒãã詊ãããæå®ããããšãã§ããŸãïŒ
cat /tmp/domains.txt | httprobe #Test all domains inside the file for port 80 and 443
cat /tmp/domains.txt | httprobe -p http:8080 -p https:8443 #Check port 80, 443 and 8080 and 8443
ã¹ã¯ãªãŒã³ã·ã§ãã
ä»ãã¹ã³ãŒãå ã«ååšããall the web serversïŒäŒç€Ÿã®IPsããã¹ãŠã®domainsãšsubdomainsã®äžã§ïŒãçºèŠããã®ã§ãããããã©ãããå§ããã°ãããåãããªãã§ããããããã§ã·ã³ãã«ã«ããŠããŸãããããã¹ãŠã®ã¹ã¯ãªãŒã³ã·ã§ãããæ®ãããšããå§ããŸããmain pageãäžç®èŠãã ãã§ãããè匱ã«ãªããããweird endpointsãèŠã€ããããããšããããŸãã
ææ¡ããã¢ã€ãã¢ãå®è¡ããã«ã¯ EyeWitness, HttpScreenshot, Aquatone, Shutter, Gowitness ãŸã㯠webscreenshot.
ããã«ããã¹ãŠã®screenshotsãè§£æããŠwhatâs likely to contain vulnerabilitiesãæããŠããã eyeballer ã䜿ãããšãã§ããŸãã
Public Cloud Assets
äŒç€Ÿã«å±ããå¯èœæ§ã®ããã¯ã©ãŠãè³ç£ãèŠã€ããã«ã¯ããŸããã®äŒç€Ÿãèå¥ããããŒã¯ãŒãã®ãªã¹ããäœãã¹ãã§ããäŸãã°ãcrypto äŒæ¥ãªã "crypto", "wallet", "dao", "<domain_name>", <"subdomain_names"> ã®ãããªåèªã䜿ããŸãã
ãŸããcommon words used in buckets ã®ã¯ãŒããªã¹ããå¿ èŠã§ã:
- https://raw.githubusercontent.com/cujanovic/goaltdns/master/words.txt
- https://raw.githubusercontent.com/infosec-au/altdns/master/words.txt
- https://raw.githubusercontent.com/jordanpotti/AWSBucketDump/master/BucketNames.txt
ãããã®åèªããpermutationsãçæããå¿ èŠããããŸãïŒè©³çŽ°ã¯ Second Round DNS Brute-Force ãåç §ïŒã
çæããã¯ãŒããªã¹ãã䜿ã£ãŠãcloud_enum, CloudScraper, cloudlist ãŸã㯠S3Scanner** ã®ãããªããŒã«ã䜿ãããšãã§ããŸãã**
Cloud Assets ãæ¢ãéã¯ãlook for more than just buckets in AWS ã¹ãã ãšããç¹ãå¿ããªãã§ãã ããã
Looking for vulnerabilities
ãã open buckets or cloud functions exposed ã®ãããªãã®ãèŠã€ããããaccess them ããŠäœãåŸãããããæªçšã§ãããã詊ããŠã¿ãŠãã ããã
Emails
ã¹ã³ãŒãå ã®domainsãšsubdomainsãããã°ãåºæ¬çã«emails æ€çŽ¢ãå§ããããã«å¿ èŠãªãã®ã¯æã£ãŠããŸããäŒç€Ÿã®ã¡ãŒã«ãèŠã€ããããã«ç§ãæããã䜿ãAPIsãštoolsã¯ä»¥äžã§ã:
- theHarvester - with APIs
- API of https://hunter.io/ (free version)
- API of https://app.snov.io/ (free version)
- API of https://minelead.io/ (free version)
Looking for vulnerabilities
Emails ã¯åŸã§ brute-force web logins and auth servicesïŒäŸãã° SSHïŒã詊ãã®ã«åœ¹ç«ã¡ãŸãããŸããphishings ã«ãå¿ èŠã§ããããã«ããããã® APIs ã¯ã¡ãŒã«ã®èåŸã«ãã人ç©ã«ã€ããŠããã«å€ãã®info about the personãäžããŠãããã®ã§ããã£ãã·ã³ã°ãã£ã³ããŒã³ã«æçšã§ãã
Credential Leaks
domains, subdomains, ããã³ emails ãããã°ããããã®ã¡ãŒã«ã«å±ããéå»ã® credential leaked ãæ¢ãå§ããããšãã§ããŸã:
Looking for vulnerabilities
ãã valid leaked credentials ãèŠã€ããããããã¯éåžžã«ç°¡åãªåå©ã§ãã
Secrets Leaks
Credential leaks ã¯äŒæ¥ã®ããã¯ã§sensitive information ãæŒæŽ©ããŠè²©å£²ãããã±ãŒã¹ã«é¢é£ããŸããããããäŒæ¥ã¯ãã®ããŒã¿ããŒã¹ã«èŒããªããã®ä»ã® leaksã®åœ±é¿ãåããŠããå¯èœæ§ããããŸãã
Github Leaks
Credentials ã APIs ã¯ãäŒç€ŸãŸãã¯ãã®äŒç€Ÿã§åããŠãŒã¶ãŒã®public repositoriesã§æŒããŠããå ŽåããããŸãã
ããŒã« Leakos ã䜿ã£ãŠãçµç¹ãšãã®éçºè
ã®public repos ãdownloadããèªåçã« gitleaks ãå®è¡ã§ããŸãã
Leakos ã¯æž¡ããã URLs å ã®text ã«å¯ŸããŠã gitleaks ãå®è¡ããããã«äœ¿ããŸãããªããªããæã«ã¯ web pages also contains secrets ããããšãããããã§ãã
Github Dorks
æ»æå¯Ÿè±¡ã®çµç¹ã§æ€çŽ¢ã§ããæœåšç㪠github dorks ã«ã€ããŠã¯ãã®ããŒãžããã§ãã¯ããŠãã ãã:
Pastes Leaks
æã«ã¯æ»æè
ãåŸæ¥å¡ã company content ã paste site ã«å
¬éããããšããããŸããããã«ã¯sensitive informationãå«ãŸããããšãããã®ã§ãæ€çŽ¢ãã䟡å€ã¯é«ãã§ãã
ããŒã« Pastos ã䜿ãã°ã80 ãè¶
ãã paste sites ãåæã«æ€çŽ¢ã§ããŸãã
Google Dorks
å€ããŠæçšãª google dorks ã¯ãexposed information that shouldnât be there ãèŠã€ããã®ã«åžžã«åœ¹ç«ã¡ãŸããåé¡ã¯ google-hacking-database ãæ°thousandsãã®ã¯ãšãªãå«ãã§ããããããæäœæ¥ã§å®è¡ããããšã¯ã§ããªãç¹ã§ãããªã®ã§ãèªåã®ãæ°ã«å ¥ãã®10åã䜿ããããã¹ãŠãå®è¡ããããã« Gorks ã®ãããªtoolã䜿ãããšãã§ããŸãã
Note that the tools that expect to run all the database using the regular Google browser will never end as google will block you very very soon.
Looking for vulnerabilities
ãã valid leaked credentials or API tokens ãèŠã€ããããããã¯éåžžã«ç°¡åãªåå©ã§ãã
Public Code Vulnerabilities
ããäŒç€Ÿãopen-source codeãæã£ãŠãããšåãã£ããããããanalyseããŠè匱æ§ãæ¢ãããšãã§ããŸãã
èšèªã«ãã£ãŠäœ¿ããtoolsãç°ãªããŸã:
Source code Review / SAST Tools
public repositories ãã¹ãã£ã³ã§ããç¡æãµãŒãã¹ããããŸããäŸãã°:
Pentesting Web Methodology
ãã°ãã³ã¿ãŒãèŠã€ããmajority of the vulnerabilitiesã¯web applicationså ã«ãããããããã§web application testing methodologyã«ã€ããŠè§ŠããããšæããŸãã詳现ã¯ãã¡ãã§ç¢ºèªã§ããŸãã
ãŸããã»ã¯ã·ã§ã³ Web Automated Scanners open source tools ãç¹å¥ã«æããŠãããŸãããããã¯éåžžã«ã»ã³ã·ãã£ããªè匱æ§ãèŠã€ããŠããããšæåŸ ãã¹ãã§ã¯ãããŸããããworkflows ã«çµã¿èŸŒãã§initial web informationãåŸãç®çã§ã¯äŸ¿å©ã§ãã
Recapitulation
Congratulations! At this point you have already perform all the basic enumeration. Yes, itâs basic because a lot more enumeration can be done (will see more tricks later).
ãããŸã§ã«æ¢ã«æ¬¡ã®ããšãè¡ã£ãŠããŸã:
- ã¹ã³ãŒãå ã®ãã¹ãŠã®companiesãèŠã€ãã
- äŒç€Ÿã«å±ãããã¹ãŠã®assetsãèŠã€ããïŒã¹ã³ãŒãå ãªãäžéš vuln scan ã宿œïŒ
- äŒç€Ÿã«å±ãããã¹ãŠã®domainsãèŠã€ãã
- ãã® domains ã®ãã¹ãŠã®subdomainsãèŠã€ããïŒany subdomain takeover?ïŒ
- ã¹ã³ãŒãå ã®ãã¹ãŠã®IPsïŒCDNs ç±æ¥ã®ãã®ãšããã§ãªããã®ïŒãèŠã€ãã
- ãã¹ãŠã®web serversãèŠã€ããscreenshotãæ®ã£ãïŒäœã deeper look ã«å€ãã weird ãªãã®ã¯ãããïŒïŒ
- äŒç€Ÿã«å±ããå¯èœæ§ã®ãããã¹ãŠã®potential public cloud assetsãèŠã€ãã
- Emails, credentials leaks, ããã³ secret leaks â ãããã¯éåžžã«ç°¡åã«big winãããããå¯èœæ§ããã
- èŠã€ãããã¹ãŠã® webs ã® pentesting
Full Recon Automatic Tools
äžããããã¹ã³ãŒãã«å¯ŸããŠææ¡ãããã¢ã¯ã·ã§ã³ã®äžéšãå®è¡ããããŒã«ãããã€ããããŸãã
- https://github.com/yogeshojha/rengine
- https://github.com/j3ssie/Osmedeus
- https://github.com/six2dez/reconftw
- https://github.com/hackerspider1/EchoPwn - A little old and not updated
References
- All free courses of @Jhaddix like The Bug Hunterâs Methodology v4.0 - Recon Edition
Tip
AWSãããã³ã°ãåŠã³ãå®è·µããïŒ
HackTricks Training AWS Red Team Expert (ARTE)
GCPãããã³ã°ãåŠã³ãå®è·µããïŒHackTricks Training GCP Red Team Expert (GRTE)
Azureãããã³ã°ãåŠã³ãå®è·µããïŒ
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricksããµããŒããã
- ãµãã¹ã¯ãªãã·ã§ã³ãã©ã³ã確èªããŠãã ããïŒ
- **ð¬ Discordã°ã«ãŒããŸãã¯ãã¬ã°ã©ã ã°ã«ãŒãã«åå ããããTwitter ðŠ @hacktricks_liveããã©ããŒããŠãã ããã
- HackTricksããã³HackTricks Cloudã®GitHubãªããžããªã«PRãæåºããŠãããã³ã°ããªãã¯ãå ±æããŠãã ããã


