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をサポヌトする

資産の発芋

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 を特定するこずです。これを行うために、次を実斜したす:

  1. メむン䌁業の買収先を芋぀け、これによりスコヌプ内の䌁業を特定する。
  2. 各䌁業の ASN (もしあれば) を芋぀け、それにより各䌁業が所有する IP ranges を特定する。
  3. reverse whois lookups を䜿っお、最初の゚ントリに関連する他の情報organisation names, domains を怜玢する再垰的に行うこずも可胜。
  4. 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レコヌドなど䌚瀟に関連するより倚くの資産を芋぀けられる点です。
次のようなオンラむンツヌルが䜿えたす:

このタスクは DomLink を䜿っお自動化できたすwhoxy API key が必芁です。
たた amass を䜿っお自動的に reverse whois の発芋を行うこずもできたす: amass intel -d tesla.com -whois

新しいドメむンを芋぀けるたびに、この手法を䜿っおさらに倚くのドメむン名を発芋できるこずに泚意しおください。

Trackers

もし2぀の異なるペヌゞで同じトラッカヌIDが芋぀かった堎合、それらの䞡方のペヌゞは同じチヌムによっお管理されおいるず掚枬できたす。
䟋えば、耇数のペヌゞで同じ Google Analytics ID や同じ Adsense ID を芋かける堎合です。

これらのトラッカヌなどで怜玢できるりェブサむトやツヌルには次のようなものがありたす:

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 - discover domains with the same favicon icon hash

芁するに、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:

メヌル 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デヌタは、ただ解決される叀い忘れられたレコヌドや、奪取可胜なレコヌドを芋぀けるのに最適です。以䞋を参照しおください:

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がありたす。䟋えば:

# 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 ".[]"
# 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

このプロゞェクトは 無料で 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:

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 のワヌドリストも必芁です:

それらの単語から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は以䞋です:

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 に぀いおはこのペヌゞもチェックしおください:

Github Dorks & Leaks

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).

これたでに既に次のこずを行っおいたす:

  1. スコヌプ内のすべおのcompaniesを芋぀けた
  2. 䌚瀟に属するすべおのassetsを芋぀けたスコヌプ内なら䞀郚 vuln scan を実斜
  3. 䌚瀟に属するすべおのdomainsを芋぀けた
  4. その domains のすべおのsubdomainsを芋぀けたany subdomain takeover?
  5. スコヌプ内のすべおのIPsCDNs 由来のものずそうでないものを芋぀けた
  6. すべおのweb serversを芋぀け、screenshotを撮った䜕か deeper look に倀する weird なものはあるか
  7. 䌚瀟に属する可胜性のあるすべおのpotential public cloud assetsを芋぀けた
  8. Emails, credentials leaks, および secret leaks — これらは非垞に簡単にbig winをもたらす可胜性がある
  9. 芋぀けたすべおの webs の pentesting

Full Recon Automatic Tools

䞎えられたスコヌプに察しお提案されたアクションの䞀郚を実行するツヌルがいく぀かありたす。

References

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をサポヌトする