Subdomain Enum

Tạo wordlist:

  • alterx: ax scan wildcards.txt -m alterx -o alterx.txt --extra-args '-silent -enrich'
Sử dụng `chaos` để tìm danh sách các subdomain (passive, có thể dựa trên wildcards), sử dụng `alterx` để tìm các biến thể của subdomain và sử dụng `dnsx` để resolve các subdomain này nhằm tìm ra các active subdomain:
 
~~~shell
chaos -d tesla.com | alterx | dnsx
~~~

Passive:

Active:

Trong trường hợp 2 cái trên không có nhiều kết quả thì dùng thêm: `subfinder` và `puredns-bruteforce`.

Visualize Subdomains

Check if Domain is Active, Resolve DNS, Detect Technology, Vhost Enum

  • httpx: ax scan subdomains.txt -m httpx -o httpx.txt --extra-args '-sc -cl -ct -title -server -td -ip -cname -t 40 -fr -nc'
`httpx` sẽ tự động resolve domain và cho ta biết IP cũng như là CNAME của domain. Nhờ vào thông tin này, ta cũng có thể xác định xem domain có sử dụng WAF hay không.
 
Ví dụ:
 
~~~log
https://community.oppo.com [200] [24071] [text/html] [OPPO Global Community] [nginx] [15.236.127.18] [oppo-alb-eu-quz6vjy-373771848.eu-west-3.elb.amazonaws.com] [Google Tag Manager,Nginx]
https://uc-heytap-web-dev.wanyol.com [200] [1513] [text/html] [nginx] [183.6.232.30] [Nginx]
~~~

Resolve Subdomains

  • massdns: ax scan domains-alive-without-scheme.ext --extra-args '-t AAAA -t MX -t TXT -t NS'.
  • dnsrecon

Subdomain Takeover

  • dnsreaper
  • nuclei: nuclei -l subdomains.txt -t http/takeovers/ -o subdomains-takeover-nuclei.txt

Fetch URLs

Lọc file JS:

awk '/\.js/ && tolower($0) !~ /403|404|204/ && tolower($0) !~ /(\.(jpg|png|svg|css|mp4|woff))|json|node\.js|vue\.js|next\.js|nuxt\.js|jses|text\/html/ {print $0}' urls-passive-httpx.txt | extract_url.sh -t httpx -s | sort -u | tee urls-passive-js.txt

Lọc file HTML (thay thế extension bằng MIME type):

awk 'tolower($0) !~ /400|403|404|405|204|504|304|502/ && tolower($0) !~ /(\.(jpg|png|svg|css|mp4|woff|js|zip|rar|pdf|ttf|apk|ico|eot|gif|txt|jpeg))|(binary\/octet-stream|application\/octet-stream|text\/plain|text\/xml|application\/json|application\/xml|application\/re-jits-protostuff)|(35m0|35m1441|jsessionid)/ {print $0}' urls-passive-httpx.txt | extract_url.sh -t httpx -s | sort -u

Fetch URLs - Passive

  • gau: ax scan domains-alive.txt -m gau -o gau.txt --blacklist ttf,woff,svg,png,otf,mp3,jpg,bmp,woff2,wav,mov,mp4,m4v,GIF,OTF,BMP,MP3,HEIC,JPG,PNG,SVG,TTF,heic,ico,icon,jpeg --fc 404 --threads 40 --verbose
  • waymore: ax scan domains-alive.txt -m waymore -o waymore.txt --extra-args '-fc 404 --verbose'.
title: Done: Chạy `httpx` với passive URLs
 
Command: `ax scan urls-passive.txt -m httpx -o urls-passive-httpx.txt --extra-args '-status-code -content-type -content-length -title -server -tech-detect -ip -cname -t 40 -follow-redirects -timeout 20'`.

Fetch URLs - Active

  • hakrawler: ax scan domains-alive.txt -m hakrawler -o hakrawler.txt --extra-args '-d 5 -insecure -t 100 -u'
  • [/] katana: ax scan domains-alive.txt -m katana -o katana.txt --extra-args '-jc -jsl -kf -s breadth-first -iqp -ef png,css,jpg,ttf,woff,woff2,gif,svg -p 100 -v'.
  • subjs: fetch JS files

Extract From JS Files

URLs

  • jsluice
  • linkfinder
title: Done: Chạy lại `jsluice` và `linkfinder` cho toàn bộ file JS và HTML
Chỉ nên chạy `jsluice` và `linkfinder` cho các file JS/HTML của một domain đáng ngờ để dễ kiểm soát và đọc output.

Secrets

  • mantra
title: Done: Thu thập thêm các URL từ [[#fetch-urls|Fetch URLs]] của các file JavaScript, HTML để quét thêm.

Check WAF

  • wafw00f: ax scan domains-alive-without-scheme.txt -m wafw00f -o wafw00f.txt
Cũng có thể sử dụng [[Nuclei]]. Ví dụ:
 
~~~log
[waf-detect:nginxgeneric] [http] [info] https://m.uc.oppomobile.com
[waf-detect:nginxgeneric] [http] [info] https://magzinefs.nearme.com.cn
[waf-detect:safedog] [http] [info] https://magzinefs.nearme.com.cn
[waf-detect:safedog] [http] [info] https://magzinefs1.nearme.com.cn
[waf-detect:nginxgeneric] [http] [info] https://magzinefs1.nearme.com.cn
[waf-detect:nginxgeneric] [http] [info] https://magzinefs2.nearme.com.cn
[waf-detect:safedog] [http] [info] https://magzinefs2.nearme.com.cn
[waf-detect:safedog] [http] [info] https://magzinefs3.nearme.com.cn
[waf-detect:nginxgeneric] [http] [info] https://magzinefs3.nearme.com.cn
[waf-detect:nginxgeneric] [http] [info] https://magzinefs5.nearme.com.cn
[waf-detect:safedog] [http] [info] https://magzinefs5.nearme.com.cn
[waf-detect:safedog] [http] [info] https://magzinefs4.nearme.com.cn
[waf-detect:aws] [http] [info] https://magzineimgf-in1.nearme.com.cn
[waf-detect:aws] [http] [info] https://magzineimgf-sg1.nearme.com.cn
[waf-detect:safedog] [http] [info] https://magzinefs6.nearme.com.cn
[waf-detect:nginxgeneric] [http] [info] https://magzinefs6.nearme.com.cn
~~~

Forced Browsing

Cách fuzz:
- Fuzz thư mục level 1
- Fuzz thư mục level 2 và tập tin trong thư mục level 1. Dùng 2 loại wordlist trong một lần chạy.
- Fuzz thư mục level 3 và tập tin trong thư mục level 2.
- etc.
 
Chúng ta chỉ fuzz cho một hoặc một số domain nào khả nghi chứ không fuzz toàn bộ.
Để tìm các app khả nghi, ta sẽ thực hiện fuzz level 1 và chạy lại với HTTPX. Nếu những thông tin thăm dò được đáng ngờ chẳng hạn như nó có title khả nghi thì có thể pick làm target để fuzz tiếp.
  • ffuf: ax scan domain.txt -m ffuf -o ffuf.txt --extra-args '-ac -X METHOD -w /home/op/lists/methods.txt:METHOD -fc 404,405,412,502 -t 30 -recursion -recursion-depth 3 -noninteractive -s'
  • dirsearch: ax scan domain.txt -m dirsearch -o dirsearch.txt --extra-args '-t 40 -x 403,404,412,503 -q -r 3'
Đối với domain `forum.cdo.oppomobile.com` ở một số đường dẫn nó sẽ redirect về host `forum.cdo.oppomobile.com:8080`. Nếu sử dụng option follow redirect thì sẽ không có response, dẫn đến việc ta bị miss đường dẫn.

Danh sách fuzzing:

  • countly.myoas.com
  • forum.cdo.oppomobile.com
  • hio.oppo.com
  • imworkbench.myoas.com
  • [/] magazinefs4.nearme.com.cn
  • [/] moform.myoas.com
  • [/] service-in.myoppo.com
  • [/] service-in-wcsm.myoas.com
  • [/] service-in-wcsm.myoppo.com
  • mtp.myoas.com

Resources