Reconnaissance
Reconnaissance
Reconnaissance v1.0
Mahmoud M. Awali
@0xAwali
Reconnaissance Workflow
attacker
Subdomains Enumeration
attacker
CIDRs Enumeration
Full AND Top PORTs Scanning SAN From Certificates Third Level Domains
My Methodology
attacker
- Registrant Organization
- Registrant Email
Hack3rScr0lls ● Tweet #BugBounty #BugBountyTip
My Methodology
attacker
attacker
" -r resovers.txt " Input File Of IPs DNS Resolver " -ptr " Query PTR Record
" -silent " Silent Mode To Show Only Results " -resp-only " Display Only Response Data
My Methodology
attacker
" prips I.P.v.4/cidr " Print All Of The IP Addresses " -r 1.1.1.1 " IP Of The DNS Resolver
My Methodology
attacker
" -iL input.txt " Reading Input File " --source-port 53 " Use A Custom Source Port
" --http-user-agent "Mozilla" " Custom User Agent " -oL httpservice443alive.txt " Output File
My Methodology
attacker
attacker
#!/usr/bin/env python3
import os
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument( "-f","--file",help="file that contains list of subdomains" )
parser.parse_args()
args = parser.parse_args()
if args.file:
if os.path.isfile(args.file):
list_of_subdomains = open( args.file, 'r' )
file_of_subdomains = list_of_subdomains.read().split('\n')
list_of_subdomains.close()
● Mine else:
parser.error( '%s file not found' % args.file )
for subdomain in file_of_subdomains :
try :
if subdomain.count(".") == 2 :
print(subdomain)
else :
third_level_domain = subdomain.split(".")[-3] + '.' + subdomain.split(".")[-2] + '.' + subdomain.split(".")[-1]
print(third_level_domain)
except :
sys.exit()
Steps to produce :-
attacker
root@mine:~#nmap -sP -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 --source-port 53 -T4 -iL ips.txt
" -sP " Skip Port Scan " -PE " Send An ICMP echo Request
" -PP " Send Timestamp And Address Mask " --source-port 53 " Use A Custom Source Port
" -PSport -PAanotherport " Sends An Empty TCP Packet With The SYN OR TCP ACK Flag Set
" -iL file.txt " Reading The Input From file.txt " -T4 " Aggressive Mode Speeds Scans
My Methodology
attacker
" -sSV --version-intensity 9 " SYN Scan AND Services Detection Scan
" --min-parallelism 64 " 64 Parallel Tasks " --max-retries 3 " Number Of Retry Probing Port
" --min-hostgroup 16 --max-hostgroup 64 " Scan Minimum 16 AND Maximum 64 Hosts At One Time
" --mtu 24 " Specific MTU To The Packet " --data-length 25 " Append Random Data
My Methodology
attacker
" -sSV --version-intensity 9 " SYN Scan AND Services Detection Scan
" --min-parallelism 1000 " 1000 Parallel Tasks " --max-retries 3 " Number Of Retry Probing Port
" --mtu 24 " Specific MTU To The Packet " --data-length 25 " Append Random Data
My Methodology
attacker
" --min-rate 175 --max-rate 300 " Nmap will Send Rate Above 175 AND Less 300 packets In Second
" -Pn " Treat All Hosts Are Up " -n " Never Do DNS Resolution
" --script-args http.useragent="Mozilla/5.0" " Change Default User Agent Header To Mozilla/5.0
" --max-scan-delay 10 " Time Between Probes " -oA output " Output Files nmap , xml And gnmap
Subdomains Enumeration
attacker
Validation And Filter Wildcard
assetfinder
crtsh
Github Subdomains
My Methodology
attacker
● Tweet
Steps to produce :-
attacker
● Blog
Steps to produce :-
attacker
" -dL list-of-thirdlevel.txt " List Of Third Level Subdomains e.g. corp.company.com
" -config config.yaml " Configuration File " -all " Use All Sources For Enumeration
" -silent " Show Only Subdomains In Output " -o out " File To Write Output
My Methodology
attacker
" --config file.ini --ua list.txt " Configuration File And File Containing User Agents Values
" --quiet " Show Only Subdomains In Output " -o output.txt " File To Write Output
My Methodology
attacker
" -config file.ini " Configuration File " -timeout 90 " Wait 90 Second Before Timing Out
" -df list-of-thirdlevel.txt " List Of Third Level Subdomains e.g. corp.company.com
" -silent " Show Only Subdomains In Output " -o output.txt " File To Write Output
My Methodology
attacker
attacker
" -o " Display Only Subdomains " -q " Specific Third Level Domain To Search
My Methodology
attacker
root@mine:~#cat github-fourthlevel-enumeration.sh
#!/usr/bin/env bash
for i in `cat analysis-output.txt`
do
python3 github-subdomains.py -d $i | tee -a subdomains.txt
done
root@mine:~#./github-fourthlevel-enumeration.sh
attacker
Generate Wordlist
Turbo Intruder FFUF
attacker
root@mine:~#cat list-of-subdomains.txt
api.corp.company.com
api.test.company.com
dev.api.company.com
test.api.company.com
● Mine ini.api.company.com
Steps to produce :-
attacker
#!/usr/bin/env python3
import os
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument( "-f","--file",help="file that contains list of subdomains" )
parser.parse_args()
args = parser.parse_args()
if args.file:
if os.path.isfile(args.file):
list_of_subdomains = open( args.file, 'r' )
file_of_subdomains = list_of_subdomains.read().split('\n')
list_of_subdomains.close()
● Mine else:
parser.error( '%s file not found' % args.file )
for subdomain in file_of_subdomains :
try :
if subdomain.count(".") == 2 :
print(subdomain)
else :
third_level_domain = subdomain.split(".")[-3] + '.' + subdomain.split(".")[-2] + '.' + subdomain.split(".")[-1]
print(third_level_domain)
except :
sys.exit()
Steps to produce :-
attacker
● Tweet
Steps to produce :-
attacker
● Blog
Steps to produce :-
attacker
● Tweet
Generate Wordlist Of Subdomains To Resolve Based On Analysis Output
attacker
root@mine:~#cat genearet-wordlist.sh
#!/usr/bin/env bash
for i in `cat analysis-output..txt`
do
for j in `cat words.txt`
do
echo "$i" | sed "s/FUZZ/$j/g" | tee -a $i.txt
● Mine done
done
root@mine:~#./genearet-wordlist.sh
Steps to produce :-
attacker
root@mine:~#cat genearet-wordlist.sh
#!/usr/bin/env bash
for i in `cat thirdlevel-subdomains-list.txt`
do
for j in `cat words.txt`
do
echo "$j.$i" | tee -a $i.txt
● Mine done
done
root@mine:~#./genearet-wordlist.sh
Steps to produce :-
attacker
" -d "api.company.com" " Name Of Third Level Subdomains To Generate Similar Pattern
My Methodology
attacker
" -r resolvers.txt " List Of DNS Servers IPs " -o S -w output.txt " Normal Output Into Text File
My Methodology
attacker
" -d words.txt " Common Words To Permute etc " --dns-retries 5 " Try 5 Times In Failed Queries
" --dns-errorLimit 50 " 50 Errors To Disable DNS " --dns-timeout 3000 " Wait 3 Second To Time Out
My Methodology
attacker
attacker
● Slides
GET / HTTP/1.1
● Tweet
Host: FUZZ.company.com
User-Agent: Mozilla/5.0
Referer: https://previous.com/path
Origin: https://www.company.com
My Methodology
attacker
" -H "Host: FUZZ.company.com" " Fuzz Host Header To Get Subdomains Under company.com
" -w wordlist.txt " Path To The Wordlist " -c " Colorize Output
" -mc 200 " Match 200 OK HTTP status code " -fr "Regex" " Filter This Pattern
" -timeout 30 " Wait 30 Second Before Timing Out " -s " Silent Mode
" -replay-proxy http://localhost:8080 " Send Only Unfiltered Requests Through A Replay Proxy
FUZZ Host Header By Using Turbo Intruder
attacker
root@mine:~#cat file-of-turbo-intruder.py
def queueRequests(target, wordlists):
engine = RequestEngine(endpoint=target.endpoint,
concurrentConnections=100,
requestsPerConnection=100,
pipeline=True
)
for word in open('/path/wordlist'):
● Mine engine.queue(target.req, word.rstrip())
def handleResponse(req, interesting):
if 'HTTP' in req.response:
table.add(req)
Steps to produce :-
attacker
crtsh
assetfinder
My Methodology
attacker
● Tweet
● Tweet
My Methodology
attacker
Google
site:acquiredby.co company
attacker
attacker
Google
"© 2020 company" "© company 2020"
attacker
attacker
attacker
Use crtsh To
Enumerate Subdomains
root@mine:~#cat crtsh-subdomains-enumeration.sh
#!/usr/bin/env bash
for i in `cat related-domains-output.txt`
do
crtsh -o -q $i | tee -a related-subdomains.txt
done
root@mine:~#./crtsh-subdomains-enumeration.sh
" -o " Display Only Subdomains " -q " Specific Related Domain To Search
Extract Third Level Domains From List Of Subdomains
attacker
#!/usr/bin/env python3
import os
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument( "-f","--file",help="file that contains list of subdomains" )
parser.parse_args()
args = parser.parse_args()
if args.file:
if os.path.isfile(args.file):
list_of_subdomains = open( args.file, 'r' )
file_of_subdomains = list_of_subdomains.read().split('\n')
list_of_subdomains.close()
● Mine else:
parser.error( '%s file not found' % args.file )
for subdomain in file_of_subdomains :
try :
if subdomain.count(".") == 2 :
print(subdomain)
else :
third_level_domain = subdomain.split(".")[-3] + '.' + subdomain.split(".")[-2] + '.' + subdomain.split(".")[-1]
print(third_level_domain)
except :
sys.exit()
Steps to produce :-
attacker