Yogi Rahman Alif

Unorganized note of Bug bounty ways and tools - Bootcamp Bug Hunter Batch 1 IDN

Categories: bugbounty , tools

Day1

Dasarlah, pengenalan masing2 dan pengenalan bug hunting itu sendiri… Pengenalan | | 200x200

Serta goals yang diharapkan dari bootcamp ini, Goals | | 200x150

serta Rekomendasi buku untuk bug hunting Buku untuk bug hunting | | 600x200

Recon Concept

Praktik

  1. Menggunakan https://whoxy.com dan whois pada domain
  2. amaas untuk melihat organisasi amaas intel -org "Nama Organisasi"
  3. menggunakan https://bgp.he.net untuk ngelist ASNs dari sebuah organisasi
  4. copy semua yang didapat pada step sebelumnya ke AI untuk di format dengan lebih cepat, seperti mengambil IP nya saja. *note: semua bisa dicatat di xmind
  5. setelah di dapat IPnya, masukkan ke file, lalu hapus yang duplikat dengan cat list-ips | sort -u | tee unique-ips
  6. melihat semua domain dari suatu organisasi melalui ip nya cat unique-ips | xargs -I {} prips {} | hakrevdns -d | tee domains.txt

Hasil

  1. Menemukan APEX domain menggunakan whoxy
  2. Menemukan blok IP dengan menggunakan bgp.he.net
  3. Mendapatkan blok IP melalui amass tools
  4. Dapat melakukan reverse DNS dari blok IP dengan hakrevdns

tools:

https://github.com/owasp-amass/amass Cari ip dari nama organisasi https://github.com/hakluke/hakrevdns Cari reverse domain dari IP https://github.com/imusabkhan/prips Mengenerate list CIDR menjadi IP https://github.com/infosec-au/altdns Mencari subdomains dengan permutasi https://github.com/eslam3kl/crtfinder Mencari subdomains dari ssl certificate

Day2

  1. mencari domain yang available dari list yang didapat pada file domains.txt dengan command cat domains.txt | httpx -mc 200,301,401,500 | tee http-avail.txt
  2. mencari subdomain tambahan menggunakan tool github-subdomains dan gitlab-subdomains
  3. menggunakan bountycatch untuk mengumpulkan subdomain yang telah di dapatkan github-subdomains -t <token> -d <target.com> -o github-domains.txt gitlab-subdomains -t <token> -d <target.com>
  4. tambahkan lagi recon subdomain dengan subfinder, sublist3r, altdns, dll
  5. masukkan semua domain yang didapat kedalam bountycatch dengan command bountycatch.py -p <nama project> -o add -f <nama file yang berisi domain>
  6. print semua domain dari bountycatch dan simpan kedalam sebuah file bountycatch.py -p <nama project> -o print | tee all-domains.txt
  7. cek apakah domain hidup dengan httpx dengan command cat all-domains.txt | httpx | tee live-domains.txt
  8. gunakan gowitness untuk akses ke domain yang aktif dan melihat services yang ada dari hasil screenshot

Another info gathering: dig +short <apex domain> | xargs -I {} whois -h whois.cymru.com {}

Hasil:

  1. domain aktif pada suatu organisasi
  2. service apa saja yang digunakan (dilihat dengan gowitness)

tools:

https://github.com/projectdiscovery/httpx Mencari domain valid dengan respon kode sesuai pengguna https://github.com/gwen001/github-subdomains Mencari subdomain yang valid dari github https://github.com/gwen001/gitlab-subdomains Mencari subdomain yang valid dari gitlab https://github.com/adelaramadhina/bountycatchremix Menyimpan subdomain yang telah di kumpulkan

Day3

  1. Mencari semua link href menggunakan gospider dengan command
mkdir link-discovery

gospider -S live-subdomain.txt --depth 3 --no-redirect -t 50 -c 3 --json -o gospider

find gospider -type f -name "*" -exec jq -r '.output' {} \; | tee gospider-js.txt
  1. Crawl link dengan menggunakan hakrawler cat ../live-subdomain.txt | hakrawler -w -json -subs | tee hakrawler.json

  2. Crawl wayback link dengan menggunakan katana (Time Travel ke masa lalu!) katana -list ../live-subdomain.txt -ps -o katana-urls.txt

  3. Another Time Travel ke masa lalu dengan waymore cat ../live-subdomain.txt | xargs -I {} waymore -i {}
  4. Ambil semua URLs yang didapat dari waymore find ~/.config/waymore/results -type f | xargs -I {} cat {} | grep monash.edu > waymore.txt

tools:

https://github.com/jaeles-project/gospider Web spider cepat dengan go language https://github.com/hakluke/hakrawler Go language web crawler https://github.com/projectdiscovery/katana Web Crawling and spidering framework https://github.com/xnl-h4ck3r/waymore Mencari link dari wayback machine https://github.com/1ndianl33t/Gf-Patterns gf patterns

Day4

  1. Gabungkan semua hasil link crawl dan spider cat link-archive/waymore.txt link-discovery/gospider-js.txt link-discovery/hakrawler-js.txt | sort -u | grep "monash.edu" > done/all-urls.txt
  2. Menggunakan gf-patterns untuk mencari tau pattern dari vuln cat done/all-urls.txt | urldedupe | gf {lfi,rce,redirect,sqli,ssrf,ssti,xss} | tee {lfi,rce,redirect,sqli,ssrf,ssti,xss}-urls.txt

  3. Menggunakan nuclei dari hasil yang di dapat/lakukan pengecekan secara manual dari hasil gf-patterns nuclei -u <url> -t http/technologies -rl 20 -c 10 nuclei -l <url.txt> -t http/technologies -rl 20 -c 10

Day5

. Gambar surface-deepweb | | 600x200

  1. Big Questions (*ada di recon concept diatas)
  2. Tentukan Scope (Narrow?, Wide?)
  3. Tech Profiling
  4. If Narrow (do manual analysis), Wide? (do automation tools)
  5. Lanjutan dari hari sebelumnya, setelah mengambil xss urls menggunakan waymore dan gf lakukan pengecekan urls tersebut dengan dalfox dalfox file xss_urls.txt -o xss_poc.txt --custom-alert-value calfcrusher --waf-evasion -F

tech profiling:

tools:

  1. https://github.com/sa7mon/S3Scanner untuk melihat misconfiguration data store (s3, gcp, dll)
  2. https://github.com/hahwul/dalfox untuk automasi xss injection
  3. https://github.com/r0oth3x49/ghauri sql injection
  4. https://github.com/sqlmapproject/sqlmap sql injection 2
  5. https://github.com/christophetd/CloudFlair mencari ip origin dari cloudflare
  6. https://github.com/AggressiveUser/AllForOne custom templates untuk nuclei
  7. https://github.com/xm1k3/cent custom templates untuk nuclei 2
  8. https://github.com/projectdiscovery/interactsh mirip dengan burpsuite collaborator URLS!

Day6

  1. Daftar akun https://cloud.projectdiscovery.io/ dan pergi ke /templates untuk mulai membuat template
  2. Bisa langsung buat template pakai AI, tinggal masukin deskripsi, misal lewat CVE Project Discovery Nuclei Template AI  | | 600x200

Day7

  1. Perkenalan singkat tentang bug yang ditemui.
  2. Hal yang perlu diperhatikan (Respon waktu yang diberikan, tanya detail jika duplicate dan follow up laporan yang kita buat, gunakan bahasa yang sopan tapi tegas dengan respek) Contoh laporan bug | | 350x400

  3. Favicon Analysis untuk aplikasi web yang banyak dengan FavFreak 4.

tools:

https://gist.github.com/jhaddix/1fb7ab2409ab579178d2a79959909b33 Github dork tool https://github.com/devanshbatham/FavFreak Favicon hash untuk mengetahui aplikasi yang digunakan web berdasarkan hash favicon https://raw.githubusercontent.com/m4ll0k/Bug-Bounty-Toolz/master/getrelationship.py Ad/Analytic tracker code. Mengetahui apex domain yang terhubung dengan organisasi berdasarkan domain (bisa juga dilihat pada https://builtwith.com/relationships/target.com) https://github.com/gwen001/github-search another github search dork like tool https://github.com/yogeshojha/rengine tool untuk passive scan website dengan web console yang interactive


Commands Summary:

amaas intel -org "Nama Organisasi"
cat list-ips | sort -u | tee unique-ips
cat unique-ips | xargs -I {} prips {} | hakrevdns -d | tee domains.txt

github-subdomains -t <isi-token-github> -d <target.com> -o sub-github.txt
gitlab-subdomains -t <isi-token-gitlab> -d <target.com>
amass enum -d <target.com> -nocolor -passive -o sub-amass.txt
subfinder -d <target.com> -o sub-subfinder.txt
sublist3r -d <target.com> -o sub-sublist3r.txt
crtfinder -u <target.com>
cat all-subdomain.txt | httpx | tee live-subdomain.txt
gowitness file -f live-subdomain.txt --timeout 10 -P .

mkdir link-discovery
gospider -S ../live-subdomain.txt --depth 3 --no-redirect -t 50 -c 3 --json -o gospider
find gospider -type f -name "*" -exec jq -r '.output' {} \; | tee gospider-js.txt
cat ../live-subdomain.txt | hakrawler -w -json -subs | tee hakrawler.json
katana -list ../live-subdomain.txt -ps -o katana-urls.txt
cat ../live-subdomain.txt | xargs -I {} waymore -i {} -oU <waymore-urls.txt>
cat waymore-urls.txt | gf xss > xss_urls.txt

dalfox file xss_urls.txt -o xss_poc.txt --custom-alert-value calfcrusher --waf-evasion -F

Command Buatan:

Setelah mendapatkan live-domains.txt, ubah agar tidak ada protocol dengan
cat live-domains.txt | cut -f 3 -d/ | tee live-domains-without-protocol.txt

lalu cari domain yang memiliki domain dengan massdns
massdns -r resolvers.txt -t A -o S -w massdns.out live-domains-without-protocol.txt

dilanjutkan mencari list IP yang aktif dari dns
cat massdns.out|awk '{print $3}'| sort -u| grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | tee ips-online.txt
cat massdns.out|awk '{print $1}'|sed 's/.$//'|sort -u | tee host-online.txt

mencari port yang terbuka dari semua IP yang aktif
sudo masscan -iL ips-online.txt --rate 10000 -p1-65535 --open -oL masscan.out

Mengubah data dari IP dengan port terbuka dari masscan.out menjadi json dengan
masscan-to-json.py

Lalu melakukan bulk nmap scan dengan
masscan-bulknmap <hasil json> <direktori hasil scan nmap>

Melihat teknologi dari web dengan whatweb
whatweb -a 3 -i <http-live-domains.txt> -U "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" --no-errors | tee hasil-whatweb.txt

Parsing hasil dari whatweb
cat ../hasil-whatweb.txt| cut -d ' ' -f 1 |grep -E "https?://[a-zA-Z0-9.-]*\.(in-scope\.com|in-scope\.io|in-scope\.net)"
domain-inscope.sh
#!/bin/bash

if [ $# -ne 2 ]; then
echo "Usage: $0 <list-domains.txt> <domain-collected.txt>"
else
    grep_pattern=$(awk 'NR==1 {printf ".%s$", $1} NR>1 {printf "\\|.%s$", $1}' $1)

    while read -r line; do
        if echo "$line" | grep -i -q "$grep_pattern"; then
            echo "$line"
        fi
    done < $2

fi

masscan-to-json.py

#!/usr/bin/env python3
import json, os

os.chdir(os.getcwd())

FILE=open('masscan.out').read()
IPS=[]

lines = FILE.split('\n')
for i in range(1, len(lines)-2):
    try:
        IPS.index(lines[i].split(' ')[3])
    except:
        IPS.append(lines[i].split(' ')[3])

IPS_PORTS = {}

for i in range(1, len(lines)-2):
    IP = lines[i].split(' ')[3]
    if IP not in IPS_PORTS.keys():
        IPS_PORTS[IP] = []
    IPS_PORTS[IP].append(lines[i].split(' ')[2])

with open('masscan-jsoned.json', 'w') as outfile:
    json.dump(IPS_PORTS, outfile)

outfile.close()
masscan-bulkmap.sh
#!/bin/bash

if [[$# -ne 2]]; then
echo "Usage: $0 <masscan-json file> <outdir>"
exit 1
fi

OUTDIR=$2

cat "$1" | jq -r 'keys[] as $ip | "\($ip):\(.[ $ip ] | join(","))"' | \
 xargs -I {} echo {} | awk -F ':' '{print $1, $2}'| \
    xargs -n 2 sh -c 'nmap -p $3 -sV -sC $2 | tee $1/bulknmap-"$2".nmap' sh "$OUTDIR"
header-checker.sh
#!/bin/bash

if [ "$#" -ne 2 ]
then
echo "Usage: $0 <list_urls.txt> <output.txt>"
else
    cat $1 | while read -r url; do
      host=$(echo "$url" | awk -F/ '{print $3}')
      echo "Host: $host"
      curl -I "$url"
done > $2
fi

nipejs hasil dari hakrawler

cat hakrawler.json | jq -r '. | .URL' |  grep '\.js$' | grep '\.target.com' | sort -u > js-urls.txt

Setelah itu cari file yang berisikan informasi sensitif menggunakan nipejs dan simpan

nipejs -u js-urls.txt -json > nipejs-results.json


Lihat konfigurasi berdasarkan kategori

cat nipejs-results.json | jq -r '. | .Category' | sort -u

Cari kategori yang menarik seperti google api, ssh public/private key, dll dan lakukan validasi dengan melihat nilai dari Match key-nya.

cat nipejs-results.json | jq -r '. | select(.Category == "Google API Key") | {Category, Url, Regex,Ā Match}'

tools dari pemateri: Tools dari pemateri | | 700x50