์ธ๋ถ Recon ๋ฐฉ๋ฒ๋ก
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 ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
์์ฐ ๋ฐ๊ฒฌ
์ด๋ค ํ์ฌ์ ์ํ ๋ชจ๋ ๊ฒ์ด ๋ฒ์ ๋ด์ ์๋ค๊ณ ์๋ ค์ก๊ณ , ๊ทธ ํ์ฌ๊ฐ ์ค์ ๋ก ๋ฌด์์ ์์ ํ๊ณ ์๋์ง ํ์ ํ๋ ค๋ ์ํฉ์ ๋๋ค.
์ด ๋จ๊ณ์ ๋ชฉํ๋ ์ฃผํ์ฌ๊ฐ ์์ ํ ๋ชจ๋ ํ์ฌ๋ค์ ์ฐพ์๋ด๊ณ , ๊ทธ ๋ค์ ์ด ํ์ฌ๋ค์ ๋ชจ๋ ์์ฐ์ ํ๋ณดํ๋ ๊ฒ์ ๋๋ค. ์ด๋ฅผ ์ํด ์ฐ๋ฆฌ๋ ๋ค์์ ์ํํฉ๋๋ค:
- ์ฃผํ์ฌ์ acquisitions๋ฅผ ์ฐพ์ ๋ฒ์์ ์ํ ํ์ฌ๋ฅผ ํ์ธํฉ๋๋ค.
- ๊ฐ ํ์ฌ์ ASN(์๋ค๋ฉด)์ ์ฐพ์ ๊ฐ ํ์ฌ๊ฐ ์์ ํ IP ๋ฒ์๋ฅผ ํ์ธํฉ๋๋ค.
- reverse whois lookups๋ฅผ ์ฌ์ฉํ์ฌ ์ต์ด ํญ๋ชฉ๊ณผ ๊ด๋ จ๋ ๋ค๋ฅธ ์ํธ๋ฆฌ(์กฐ์ง ์ด๋ฆ, ๋๋ฉ์ธ ๋ฑ)๋ฅผ ๊ฒ์ํฉ๋๋ค(์ฌ๊ท์ ์ผ๋ก ์ํ ๊ฐ๋ฅ).
- shodan
organdsslfilters์ ๊ฐ์ ๋ค๋ฅธ ๊ธฐ๋ฒ์ ์ฌ์ฉํ์ฌ ๋ค๋ฅธ ์์ฐ์ ๊ฒ์ํฉ๋๋ค(sslํธ๋ฆญ์ ์ฌ๊ท์ ์ผ๋ก ์ํํ ์ ์์).
์ธ์
๋ฌด์๋ณด๋ค ๋จผ์ , ์ฃผํ์ฌ๊ฐ ์์ ํ ๋ค๋ฅธ ํ์ฌ๋ค์ด ๋ฌด์์ธ์ง ์์์ผ ํฉ๋๋ค.
ํ ๊ฐ์ง ๋ฐฉ๋ฒ์ https://www.crunchbase.com/์์ ์ฃผํ์ฌ๋ฅผ ๊ฒ์ํ๊ณ โacquisitionsโ๋ฅผ ํด๋ฆญํ๋ ๊ฒ์
๋๋ค. ๊ฑฐ๊ธฐ์์ ์ฃผํ์ฌ๊ฐ ์ธ์ํ ๋ค๋ฅธ ํ์ฌ๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ ์ฃผํ์ฌ์ Wikipedia ํ์ด์ง๋ฅผ ๋ฐฉ๋ฌธํด acquisitions๋ฅผ ์ฐพ์๋ณด๋ ๊ฒ์
๋๋ค.
์์ฅ ๊ธฐ์
์ ๊ฒฝ์ฐ SEC/EDGAR filings, investor relations ํ์ด์ง ๋๋ ์ง์ญ ๋ฒ์ธ ๋ฑ๊ธฐ์(์: ์๊ตญ์ Companies House)๋ฅผ ํ์ธํ์ธ์.
๊ธ๋ก๋ฒ ๊ธฐ์
๊ตฌ์กฐ์ ์ํ์ฌ๋ฅผ ํ์
ํ๋ ค๋ฉด OpenCorporates (https://opencorporates.com/)์ GLEIF LEI ๋ฐ์ดํฐ๋ฒ ์ด์ค (https://www.gleif.org/)๋ฅผ ํ์ธํด ๋ณด์ธ์.
์ข์ต๋๋ค. ์ด ์์ ์์ ๋ฒ์์ ํฌํจ๋ ๋ชจ๋ ํ์ฌ๋ฅผ ํ์ ํ์ ๊ฒ์ ๋๋ค. ์ด์ ์ด๋ค์ ์์ฐ์ ์ฐพ๋ ๋ฐฉ๋ฒ์ ์์๋ด ์๋ค.
ASNs
autonomous system number(ASN)์ **Internet Assigned Numbers Authority (IANA)**๊ฐ autonomous system(AS)์ ํ ๋นํ๋ ๊ณ ์ ๋ฒํธ์
๋๋ค.
AS๋ ์ธ๋ถ ๋คํธ์ํฌ ์ ๊ทผ์ ๋ํด ๋ช
ํํ ์ ์๋ ์ ์ฑ
์ ๊ฐ์ง IP ์ฃผ์ ๋ธ๋ก๋ค๋ก ๊ตฌ์ฑ๋๋ฉฐ, ํ๋์ ์กฐ์ง์์ ๊ด๋ฆฌํ์ง๋ง ์ฌ๋ฌ ์ด์์๋ค๋ก ๊ตฌ์ฑ๋ ์ ์์ต๋๋ค.
ํ์ฌ๊ฐ ASN์ ํ ๋น๋ฐ์๋์ง ํ์ธํ๋ฉด IP ๋ฒ์๋ฅผ ์ฐพ์ ์ ์์ผ๋ฏ๋ก ํฅ๋ฏธ๋ก์ด ์ ๋ณด๊ฐ ๋ฉ๋๋ค. ๋ฒ์ ๋ด์ ๋ชจ๋ ํธ์คํธ์ ๋ํด vulnerability test๋ฅผ ์ํํ๊ณ ์ด๋ฌํ IP๋ค ์์์ ๋๋ฉ์ธ์ ์ฐพ์๋ณด๋ ๊ฒ์ด ์ ์ฉํฉ๋๋ค.
https://bgp.he.net/, https://bgpview.io/ ๋๋ https://ipinfo.io/์์ ํ์ฌ ์ด๋ฆ, IP ๋๋ ๋๋ฉ์ธ์ผ๋ก ๊ฒ์ํ ์ ์์ต๋๋ค.
ํ์ฌ ์ง์ญ์ ๋ฐ๋ผ ์ด ๋งํฌ๋ค์ด ์ถ๊ฐ ์ ๋ณด๋ฅผ ์์งํ๋ ๋ฐ ์ ์ฉํ ์ ์์ต๋๋ค: AFRINIC (์ํ๋ฆฌ์นด), Arin(๋ถ๋ฏธ), APNIC (์์์), LACNIC (๋ผํด์๋ฉ๋ฆฌ์นด), RIPE NCC (์ ๋ฝ). ์ด์จ๋ , ์๋ง๋ ์ฒซ ๋ฒ์งธ ๋งํฌ์์ ์ด๋ฏธ ๋ชจ๋ ์ ์ฉํ ์ ๋ณด(IP ๋ฒ์์ 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/.
์ทจ์ฝ์ ์ฐพ๊ธฐ
์ด ์์ ์์๋ ์ค์ฝํ ๋ด์ ๋ชจ๋ ์์ฐ์ ํ์
ํ์ผ๋ฏ๋ก, ํ์ฉ๋๋ค๋ฉด ๋ชจ๋ ํธ์คํธ์ ๋ํด vulnerability scanner (Nessus, OpenVAS, Nuclei)๋ฅผ ์คํํ ์ ์์ต๋๋ค.
๋๋ port scans๋ฅผ ์ํํ๊ฑฐ๋ Shodan, Censys, ๋๋ ZoomEye ๊ฐ์ ์๋น์ค๋ฅผ ์ฌ์ฉํด ์ด๋ฆฐ ํฌํธ๋ฅผ ์ฐพ์๋ณผ ์ ์์ผ๋ฉฐ, ๋ฐ๊ฒฌ ๋ด์ฉ์ ๋ฐ๋ผ ์ด ์ฑ
์์ ์ด๋ป๊ฒ ์ฌ๋ฌ ์คํ ์ค์ธ ์๋น์ค๋ฅผ pentestํ ์ง ํ์ธํด์ผ ํฉ๋๋ค.
๋ํ, ์ธ๊ธํ ๊ฐ์น๊ฐ ์๋ ์ ์ ๊ธฐ๋ณธ์ ์ธ default username ๋ฐ passwords ๋ฆฌ์คํธ๋ฅผ ์ค๋นํ๊ณ https://github.com/x90skysn3k/brutespray๋ฅผ ์ฌ์ฉํด ์๋น์ค๋ฅผ bruteforceํด ๋ณผ ์ ์๋ค๋ ๊ฒ์
๋๋ค.
Domains
We know all the companies inside the scope and their assets, itโs time to find the domains inside the scope.
์ฐธ๊ณ : ์๋์ ์ ์๋ ๊ธฐ๋ฒ๋ค๋ก subdomains๋ ์ฐพ์ ์ ์์ผ๋ฉฐ, ํด๋น ์ ๋ณด๋ ๊ณผ์ํ๊ฐ๋์ด์๋ ์ ๋ฉ๋๋ค.
์ฐ์ ๊ฐ ํ์ฌ์ main domain(๋ค)์ ์ฐพ์์ผ ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, _Tesla Inc._์ ๊ฒฝ์ฐ _tesla.com_์ด ๋ฉ๋๋ค.
Reverse DNS
์ด๋ฏธ ๋๋ฉ์ธ์ ๋ชจ๋ IP ranges๋ฅผ ์ฐพ์๋ค๋ฉด, ํด๋น IPs์ ๋ํด reverse dns lookups๋ฅผ ์ํํ์ฌ ์ค์ฝํ ๋ด ๋ ๋ง์ ๋๋ฉ์ธ์ ์ฐพ๋ ๊ฒ์ ์๋ํด๋ณผ ์ ์์ต๋๋ค. ํผํด์(victim)์ dns server๋ ์ ์๋ ค์ง 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
์ด ์์
์ด ์๋ํ๋ ค๋ฉด, ๊ด๋ฆฌ์๊ฐ ์๋์ผ๋ก PTR์ ํ์ฑํํด์ผ ํฉ๋๋ค.
์ด ์ ๋ณด๋ฅผ ์ํด ๋ค์ ์จ๋ผ์ธ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ ์๋ ์์ต๋๋ค: http://ptrarchive.com/.
๋๊ท๋ชจ ๋ฒ์์ ๊ฒฝ์ฐ massdns ๋ฐ dnsx ๊ฐ์ ๋๊ตฌ๊ฐ reverse lookups ๋ฐ enrichment๋ฅผ ์๋ํํ๋ ๋ฐ ์ ์ฉํฉ๋๋ค.
Reverse Whois (loop)
whois ๋ด๋ถ์๋ ์ ๋ณด(organisation name, address, emails, ์ ํ๋ฒํธ ๋ฑ)๋ฅผ ๋ง์ด ์ฐพ์ ์ ์์ต๋๋ค. ํ์ง๋ง ๋ ํฅ๋ฏธ๋ก์ด ์ ์ ์ด๋ฌํ ํ๋ ์ค ํ๋๋ก reverse whois lookups๋ฅผ ์ํํ๋ฉด ํ์ฌ์ ๊ด๋ จ๋ ๋ ๋ง์ ์์ฐ์ ์ฐพ์ ์ ์๋ค๋ ๊ฒ์
๋๋ค(์: ๋์ผํ ์ด๋ฉ์ผ์ด ๋ํ๋๋ ๋ค๋ฅธ whois ๋ ์ง์คํธ๋ฆฌ).
๋ค์๊ณผ ๊ฐ์ ์จ๋ผ์ธ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค:
- https://viewdns.info/reversewhois/ - ๋ฌด๋ฃ
- https://domaineye.com/reverse-whois - ๋ฌด๋ฃ
- https://www.reversewhois.io/ - ๋ฌด๋ฃ
- https://www.whoxy.com/ - ์น์ ๋ฌด๋ฃ, 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 ํค ํ์)๋ฅผ ์ฌ์ฉํด ์๋ํํ ์ ์์ต๋๋ค.
๋ํ 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๋ฅผ ๊ฐ์ง ๋๋ฉ์ธ์ ๋ฐ๊ฒฌํ ์ ์๊ฒ ํด์ค๋๋ค.
Moreover, you can also search technologies using the favicon hash as explained in this blog post. ์ฆ, ์ทจ์ฝํ ๋ฒ์ ์ ์น ๊ธฐ์ ์ 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.
์ ์๊ถ / ๊ณ ์ ๋ฌธ์์ด
์น ํ์ด์ง ๋ด์์ ๋์ผ ์กฐ์ง์ ์๋ก ๋ค๋ฅธ ์น์ ๊ฑธ์ณ ๊ณต์ ๋ ์ ์๋ ๋ฌธ์์ด์ ๊ฒ์ํ์ธ์. copyright string์ด ์ข์ ์๊ฐ ๋ ์ ์์ต๋๋ค. ๊ทธ๋ฐ ๋ค์ ํด๋น ๋ฌธ์์ด์ google, ๋ค๋ฅธ browsers ๋๋ ์ฌ์ง์ด shodan์์ ๊ฒ์ํ์ธ์: shodan search http.html:"Copyright string"
CRT Time
ํํ ๋ค์๊ณผ ๊ฐ์ cron job์ด ์์ต๋๋ค:
# /etc/crontab
37 13 */10 * * certbot renew --post-hook "systemctl reload nginx"
์๋ฒ์์ ๋ชจ๋ ๋๋ฉ์ธ ์ธ์ฆ์๋ฅผ ๊ฐฑ์ ํ๊ธฐ ์ํด์์
๋๋ค. ์ด๋ ์ด ์์
์ ์ฌ์ฉ๋ CA๊ฐ Validity ์๊ฐ์ ์์ฑ ์๊ฐ์ ์ค์ ํ์ง ์๋๋ผ๋, certificate transparency ๋ก๊ทธ์์ ๋์ผ ํ์ฌ์ ์ํ ๋๋ฉ์ธ๋ค์ ์ฐพ์ ์ ์๋ค๋ ๋ป์
๋๋ค.
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
Mail DMARC information
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.
Other useful tools are spoofcheck and dmarcian.
Passive Takeover
์ผ๋ฐ์ ์ผ๋ก ์ฌ๋๋ค์ ์๋ธ๋๋ฉ์ธ์ ํด๋ผ์ฐ๋ ์ ๊ณต์์ IP์ ํ ๋นํด ๋๊ณ ์ด๋ ์์ ์ ๊ทธ IP ์ฃผ์๋ฅผ ์์ง๋ง DNS ๋ ์ฝ๋๋ฅผ ์ญ์ ํ๋ ๊ฒ์ ์์ด๋ฒ๋ฆฌ๋ ๊ฒฝ์ฐ๊ฐ ํํฉ๋๋ค. ๋ฐ๋ผ์ (Digital Ocean๊ณผ ๊ฐ์) ํด๋ผ์ฐ๋์ ๋จ์ํ spawning a VM ํ๋ฉด ์ค์ ๋ก ์ผ๋ถ ์๋ธ๋๋ฉ์ธ์ taking over some subdomains(s) ํ๊ฒ ๋ ์ ์์ต๋๋ค.
This post explains a store about it and propose a script that spawns a VM in DigitalOcean, gets the IPv4 of the new machine, and searches in Virustotal for subdomain records pointing to it.
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 certificate์์ ์์์น ๋ชปํ ์๋ก์ด ๋๋ฉ์ธ์ด ์๋์ง ํ์ธํ์ธ์.
๋ฉ์ธ ์น ํ์ด์ง์ TLS certificate์ ์ ๊ทผํด Organisation name์ ์ป๊ณ , ๊ทธ ์ด๋ฆ์ผ๋ก shodan์ด ์๊ณ ์๋ ๋ชจ๋ ์น ํ์ด์ง์ TLS certificates์์ ๋ค์ ํํฐ๋ก ๊ฒ์ํ ์ ์์ต๋๋ค: ssl:"Tesla Motors" ๋๋ sslsearch ๊ฐ์ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ์ธ์.
Assetfinder
Assetfinder ์ ๋ฉ์ธ ๋๋ฉ์ธ๊ณผ ๊ด๋ จ๋ ๋๋ฉ์ธ ๋ฐ ๊ทธ ์๋ธ๋๋ฉ์ธ์ ์ฐพ๋ ๋๊ตฌ์ ๋๋ค. ๊ฝค ์ ์ฉํฉ๋๋ค.
Passive DNS / Historical DNS
Passive DNS ๋ฐ์ดํฐ๋ ์ฌ์ ํ ํด์๋๋ ๋๋ takeoverํ ์ ์๋ ์ค๋๋๊ณ ์ํ ๋ ์ฝ๋๋ฅผ ์ฐพ๋ ๋ฐ ์์ฃผ ์ ์ฉํฉ๋๋ค. ๋ค์์ ํ์ธํ์ธ์:
- 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.
Subdomains
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
๋ง์ ์๋ธ๋๋ฉ์ธ์ ํ๋ณดํ๋ ๊ฐ์ฅ ๋น ๋ฅธ ๋ฐฉ๋ฒ์ ์ธ๋ถ ์์ค์์ ๊ฒ์ํ๋ ๊ฒ์ ๋๋ค. ๊ฐ์ฅ ๋ง์ด ์ฌ์ฉ๋๋ ๋๊ตฌ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค (๋ ๋์ ๊ฒฐ๊ณผ๋ฅผ ์ํด API ํค๋ฅผ ์ค์ ํ์ธ์):
# 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 ์ฐพ๋ ๋ฐ ์ ์ฉํ ์ ์๋ ๊ธฐํ ํฅ๋ฏธ๋ก์ด tools/APIs์ ๋๋ค:
- Crobat: https://sonar.omnisint.io API๋ฅผ ์ฌ์ฉํด 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: ์ฃผ์ด์ง ๋๋ฉ์ธ์ ๋ํด AlienVaultโs Open Threat Exchange, the Wayback Machine ๋ฐ Common Crawl์์ ์๋ ค์ง URL์ ๊ฐ์ ธ์ต๋๋ค.
# Get subdomains from GAUs found URLs
gau --subs tesla.com | cut -d "/" -f 3 | sort -u
- SubDomainizer & subscraper: ์ด๋ค์ ์น์ ์คํฌ๋ฉํด JS ํ์ผ์ ์ฐพ์ ๊ทธ๊ณณ์์ ์๋ธ๋๋ฉ์ธ์ ์ถ์ถํฉ๋๋ค.
# 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
This project offers for free all the subdomains related to bug-bounty programs. You can access this data also using chaospy or even access the scope used by this project https://github.com/projectdiscovery/chaos-public-program-list
You can find a ๋น๊ต of many of these tools here: https://blog.blacklanternsecurity.com/p/subdomain-enumeration-tool-face-off
DNS Brute force
๊ฐ๋ฅํ subdomain ์ด๋ฆ๋ค์ ์ฌ์ฉํด DNS servers๋ฅผ brute-forceํ์ฌ ์๋ก์ด 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: This was the first tool that performed an effective DNS brute-force. Itโs very fast however itโs prone to false positives.
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๋ฅผ ์ฌ์ฉํด valid subdomains๋ฅผ enumerateํ ์ ์์ผ๋ฉฐ, wildcard handling๊ณผ ์ฌ์ด input-output ์ง์์ผ๋ก subdomains๋ฅผ resolveํ ์ ์๊ฒ ํด์ค๋๋ค.
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
๋ ๋ฒ์งธ DNS Brute-Force ๋ผ์ด๋
์คํ ์์ค์ brute-forcing์ ์ฌ์ฉํด ์๋ธ๋๋ฉ์ธ์ ์ฐพ์ ํ, ๋ฐ๊ฒฌํ ์๋ธ๋๋ฉ์ธ์ ๋ณํ์ ์์ฑํ์ฌ ๋ ๋ง์ ๊ฒ์ ์ฐพ์ ์ ์์ต๋๋ค. ์ด ๋ชฉ์ ์ ์ ์ฉํ ๋๊ตฌ๊ฐ ๋ช ๊ฐ์ง ์์ต๋๋ค:
- dnsgen: ๋๋ฉ์ธ๊ณผ ์๋ธ๋๋ฉ์ธ์ด ์ฃผ์ด์ง๋ฉด ๋ณํ์ ์์ฑํฉ๋๋ค.
cat subdomains.txt | dnsgen -
- goaltdns: ๋๋ฉ์ธ๊ณผ ์๋ธ๋๋ฉ์ธ์ผ๋ก๋ถํฐ permutations๋ฅผ ์์ฑํฉ๋๋ค.
- goaltdns permutations wordlist๋ here์์ ์ป์ ์ ์์ต๋๋ค.
goaltdns -l subdomains.txt -w /tmp/words-permutations.txt -o /tmp/final-words-s3.txt
- gotator: domains์ subdomains๋ฅผ ๋ฐ์ permutations๋ฅผ ์์ฑํฉ๋๋ค. permutations ํ์ผ์ด ์ง์ ๋์ง ์์ผ๋ฉด 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: ์๋ธ๋๋ฉ์ธ์ permutations, mutations ๋ฐ alteration์ ์ํํ๋ ๋ ๋ค๋ฅธ ๋๊ตฌ์ ๋๋ค. ์ด ๋๊ตฌ๋ ๊ฒฐ๊ณผ๋ฅผ 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 ์๊ณ ๋ฆฌ์ฆ๊ณผ ๊ฒฐํฉ๋ subdomain brute-force fuzzer์ ๋๋ค. ์ ๊ณต๋ ์ ๋ ฅ ๋ฐ์ดํฐ(๋ง์ถค wordlist ๋๋ ๊ณผ๊ฑฐ DNS/TLS ๊ธฐ๋ก ๋ฑ)๋ฅผ ์ฌ์ฉํ์ฌ ๋ ๋ง์ ๋์๋๋ ๋๋ฉ์ธ ์ด๋ฆ์ ์ ํํ ํฉ์ฑํ๊ณ , DNS scan ์ค ์์ง๋ ์ ๋ณด๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๋ฃจํ๋ฅผ ๋๋ฉฐ ์ด๋ฅผ ๋ ํ์ฅํฉ๋๋ค.
echo www | subzuf facebook.com
Subdomain Discovery Workflow
์ ๊ฐ ์ด ๋ธ๋ก๊ทธ ํฌ์คํธ๋ฅผ ํ์ธํ์ธ์. ์ด ๊ธ์ ๋๋ฉ์ธ์์ automate the subdomain discovery ํ๊ธฐ ์ํด 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
๋ง์ฝ ์๋ธ๋๋ฉ์ธ์ ์ํ one or several web pages ๋ฅผ ํฌํจํ๋ IP ์ฃผ์๋ฅผ ์ฐพ์๋ค๋ฉด, ํด๋น IP์์ ์น์ด ์๋ ๋ค๋ฅธ ์๋ธ๋๋ฉ์ธ์ ์ฐพ๊ธฐ ์ํด OSINT sources ์์ ๊ทธ IP์ ๋๋ฉ์ธ์ ์ฐพ์๋ณด๊ฑฐ๋ brute-forcing VHost domain names in that IP ๋ฅผ ์๋ํ ์ ์์ต๋๋ค.
OSINT
์ผ๋ถ VHosts in IPs using HostHunter or other APIs ๋ฅผ ํตํด ์ฐพ์ ์ ์์ต๋๋ค.
Brute Force
์ด๋ค subdomain์ด web server์ ์จ๊ฒจ์ ธ ์๋ค๊ณ ์์ฌ๋๋ฉด, ์ด๋ฅผ 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
While looking for subdomains ์ฐพ๋ ๋์ ํด๋น subdomains๊ฐ ์ด๋ค ์ ํ์ bucket์ pointing ํ๋์ง ์ฃผ์ํ๊ณ , ๊ทธ๋ฐ ๊ฒฝ์ฐ ๊ถํ์ ํ์ธํ์ธ์.
๋ํ ์ด ์์ ์๋ scope ๋ด์ ๋ชจ๋ ๋๋ฉ์ธ์ ์๊ฒ ๋๋ฏ๋ก, ๊ฐ๋ฅํ bucket ์ด๋ฆ์ brute forceํ๊ณ ๊ถํ์ ํ์ธํ์ธ์.
Monitorization
๋๋ฉ์ธ์ ์๋ก์ด subdomains๊ฐ ์์ฑ๋๋์ง ํ์ธํ๋ ค๋ฉด Certificate Transparency Logs๋ฅผ ๋ชจ๋ํฐ๋งํ๋ sublert์ ๊ฐ์ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
Looking for vulnerabilities
๊ฐ๋ฅํ subdomain takeovers๋ฅผ ํ์ธํ์ธ์.
๋ง์ฝ subdomain์ด ์ด๋ค S3 bucket์ ๊ฐ๋ฆฌํค๊ณ ์๋ค๋ฉด, ๊ถํ์ ํ์ธํ์ธ์.
์์ฐ ๊ฒ์์์ ์ด๋ฏธ ์ฐพ์ ๊ฒ๋ค๊ณผ ๋ค๋ฅธ IP๋ฅผ ๊ฐ์ง subdomain์ ๋ฐ๊ฒฌํ๋ฉด, ๊ธฐ๋ณธ ์ทจ์ฝ์ ์ค์บ(Nessus ๋๋ OpenVAS ์ฌ์ฉ)๊ณผ port scan์ nmap/masscan/shodan์ผ๋ก ์ํํด์ผ ํฉ๋๋ค. ์ด๋ค ์๋น์ค๊ฐ ์คํ ์ค์ธ์ง์ ๋ฐ๋ผ ์ด ์ฑ
์์ ๊ทธ๊ฒ๋ค์ โ๊ณต๊ฒฉโํ๊ธฐ ์ํ ๋ช ๊ฐ์ง ํธ๋ฆญ์ ์ฐพ์ ์ ์์ต๋๋ค.
์ฐธ๊ณ : ๋๋๋ก subdomain์ ํด๋ผ์ด์ธํธ๊ฐ ์ ์ดํ์ง ์๋ IP์ ํธ์คํ
๋์ด ์์ด scope์ ํฌํจ๋์ง ์์ ์ ์์ผ๋ ์ฃผ์ํ์ธ์.
IPs
์ด๊ธฐ ๋จ๊ณ์์ ์ผ๋ถ IP ๋ฒ์, ๋๋ฉ์ธ ๋ฐ subdomains๋ฅผ ๋ฐ๊ฒฌํ์ ์ ์์ต๋๋ค.
์ด์ ํด๋น ๋ฒ์์์ ๋ชจ๋ IP๋ฅผ ์์งํ๊ณ ๋๋ฉ์ธ/ subdomains(DNS ์ฟผ๋ฆฌ)๋ก๋ถํฐ๋ ์์งํ ์๊ฐ์
๋๋ค.
๋ค์์ ๋ฌด๋ฃ apis ์๋น์ค๋ฅผ ์ด์ฉํ๋ฉด ๋๋ฉ์ธ ๋ฐ subdomains๊ฐ ์ด์ ์ ์ฌ์ฉํ๋ ์ด์ IP๋ค๋ ์ฐพ์๋ผ ์ ์์ต๋๋ค. ์ด IP๋ค์ ์ฌ์ ํ ํด๋ผ์ด์ธํธ ์์ ์ผ ์ ์์ผ๋ฉฐ(๊ทธ๋ฆฌ๊ณ CloudFlare bypasses๋ฅผ ์ฐพ๋ ๋ฐ ๋์์ด ๋ ์ ์์ต๋๋ค)
ํน์ IP๋ฅผ ๊ฐ๋ฆฌํค๋ ๋๋ฉ์ธ์ ํ์ธํ๋ ค๋ฉด hakip2host ๋๊ตฌ๋ฅผ ์ฌ์ฉํ ์๋ ์์ต๋๋ค.
Looking for vulnerabilities
CDNs์ ์ํ์ง ์๋ ๋ชจ๋ IP์ ๋ํด Port scan์ ์ํํ์ธ์ (๊ฑฐ๊ธฐ์๋ ํฅ๋ฏธ๋ก์ด ๊ฒ์ ๊ฑฐ์ ์ฐพ์ง ๋ชปํ ๊ฐ๋ฅ์ฑ์ด ํฝ๋๋ค). ๋ฐ๊ฒฌ๋ ์คํ ์ค์ธ ์๋น์ค์์ ์ทจ์ฝ์ ์ ์ฐพ์ ์ ์์ ๊ฒ์ ๋๋ค.
ํธ์คํธ ์ค์บ ๋ฐฉ๋ฒ์ ๋ํ ๊ฐ์ด๋๋ฅผ ํ์ธํ์ธ์.
Web servers hunting
์ฐ๋ฆฌ๋ ๋ชจ๋ ํ์ฌ์ ๊ทธ๋ค์ ์์ฐ์ ์ฐพ์๊ณ , scope ๋ด์ IP ๋ฒ์, ๋๋ฉ์ธ ๋ฐ subdomains๋ฅผ ์๊ณ ์์ต๋๋ค. ์ด์ ์น ์๋ฒ๋ฅผ ๊ฒ์ํ ์๊ฐ์ ๋๋ค.
์ด์ ๋จ๊ณ์์ ์ด๋ฏธ ๋ฐ๊ฒฌํ IP์ ๋๋ฉ์ธ์ ๋ํด ์ด๋ ์ ๋ recon์ ์ํํ์ ๊ฐ๋ฅ์ฑ์ด ์์ผ๋ฏ๋ก, ์ด๋ฏธ ๊ฐ๋ฅํ ๋ชจ๋ ์น ์๋ฒ๋ฅผ ์ฐพ์์ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ์์ง ์ฐพ์ง ๋ชปํ๋ค๋ฉด, ์ด์ ๋ฒ์ ๋ด์์ ์น ์๋ฒ๋ฅผ ๊ฒ์ํ๋ ๋ช ๊ฐ์ง ๋น ๋ฅธ ํธ๋ฆญ์ ๋ณด๊ฒ ์ต๋๋ค.
์ฐธ๊ณ : ์ด๊ฒ์ web apps discovery์ ์ด์ ์ด ๋ง์ถฐ์ ธ ์์ผ๋ฏ๋ก, (scope์์ ํ์ฉํ๋ค๋ฉด) ์ทจ์ฝ์ ์ค์บ๊ณผ port scanning๋ ์ํํด์ผ ํฉ๋๋ค.
์น ์๋ฒ์ ๊ด๋ จ๋ ์ด๋ฆฐ ํฌํธ๋ฅผ ๋น ๋ฅด๊ฒ ์ฐพ๋ ๋ฐฉ๋ฒ์ผ๋ก masscan ์ฌ์ฉ๋ฒ์ ์ฌ๊ธฐ์์ ์ฐพ์ ์ ์์ต๋๋ค.
์น ์๋ฒ๋ฅผ ์ฐพ๊ธฐ ์ํ ๋ ๋ค๋ฅธ ์ ์ฉํ ๋๊ตฌ๋ก๋ 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
Screenshots
Now that you have discovered all the web servers present in the scope (among the IPs of the company and all the domains and subdomains) you probably donโt know where to start. So, letโs make it simple and start just taking screenshots of all of them. Just by taking a look at the main page you can find weird endpoints that are more prone to be vulnerable.
To perform the proposed idea you can use EyeWitness, HttpScreenshot, Aquatone, Shutter, Gowitness or webscreenshot.
Moreover, you could then use eyeballer to run over all the screenshots to tell you whatโs likely to contain vulnerabilities, and what isnโt.
Public Cloud Assets
In order to find potential cloud assets belonging to a company you should start with a list of keywords that identify that company. For example, a crypto for a crypto company you might use words such as: "crypto", "wallet", "dao", "<domain_name>", <"subdomain_names">.
You will also need wordlists of 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
Then, with those words you should generate permutations (check the Second Round DNS Brute-Force for more info).
With the resulting wordlists you could use tools such as cloud_enum, CloudScraper, cloudlist or S3Scanner.
Remember that when looking for Cloud Assets you should look for more than just buckets in AWS.
Looking for vulnerabilities
If you find things such as open buckets or cloud functions exposed you should access them and try to see what they offer you and if you can abuse them.
Emails
With the domains and subdomains inside the scope you basically have all what you need to start searching for emails. These are the APIs and tools that have worked the best for me to find emails of a company:
- 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 will come handy later to brute-force web logins and auth services (such as SSH). Also, they are needed for phishings. Moreover, these APIs will give you even more info about the person behind the email, which is useful for the phishing campaign.
Credential Leaks
With the domains, subdomains, and emails you can start looking for credentials leaked in the past belonging to those emails:
Looking for vulnerabilities
If you find valid leaked credentials, this is a very easy win.
Secrets Leaks
Credential leaks are related to hacks of companies where sensitive information was leaked and sold. However, companies might be affected for other leaks whose info isnโt in those databases:
Github Leaks
Credentials and APIs might be leaked in the public repositories of the company or of the users working by that github company.
You can use the tool Leakos to download all the public repos of an organization and of its developers and run gitleaks over them automatically.
Leakos can also be used to run gitleaks agains all the text provided URLs passed to it as sometimes web pages also contains secrets.
Github Dorks
Check also this page for potential github dorks you could also search for in the organization you are attacking:
Pastes Leaks
Sometimes attackers or just workers will publish company content in a paste site. This might or might not contain sensitive information, but itโs very interesting to search for it.
You can use the tool Pastos to search in more that 80 paste sites at the same time.
Google Dorks
Old but gold google dorks are always useful to find exposed information that shouldnโt be there. The only problem is that the google-hacking-database contains several thousands of possible queries that you cannot run manually. So, you can get your favourite 10 ones or you could use a tool such as Gorks to run them all.
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
If you find valid leaked credentials or API tokens, this is a very easy win.
Public Code Vulnerabilities
If you found that the company has open-source code you can analyse it and search for vulnerabilities on it.
Depending on the language there are different tools you can use:
Source code Review / SAST Tools
There are also free services that allow you to scan public repositories, such as:
Pentesting Web Methodology
The majority of the vulnerabilities found by bug hunters resides inside web applications, so at this point I would like to talk about a web application testing methodology, and you can find this information here.
I also want to do a special mention to the section Web Automated Scanners open source tools, as, if you shouldnโt expect them to find you very sensitive vulnerabilities, they come handy to implement them on workflows to have some 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).
So you have already:
- Found all the companies inside the scope
- Found all the assets belonging to the companies (and perform some vuln scan if in scope)
- Found all the domains belonging to the companies
- Found all the subdomains of the domains (any subdomain takeover?)
- Found all the IPs (from and not from CDNs) inside the scope.
- Found all the web servers and took a screenshot of them (anything weird worth a deeper look?)
- Found all the potential public cloud assets belonging to the company.
- Emails, credentials leaks, and secret leaks that could give you a big win very easily.
- Pentesting all the webs you found
Full Recon Automatic Tools
There are several tools out there that will perform part of the proposed actions against a given scope.
- 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 ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


