Javascript-Files
Javascript-Files
Mahmoud M. Awali
@0xAwali
Workflow Of Javascript Files
attacker
Subdomains
Endpoints
Host JS Files
Note
● Tweet
/ Root Directory
. This Location
.. Up A Directory
./ Current Directory
../ Parent Of Current Directory
../../ Two Directories Backwards
My Methodology
attacker
Try To Extract All The Javascript Files From A Set Of Given Urls
By Using Tools e.g. getJS
" -output output.txt " The File Where To Save The Output
My Methodology
attacker
Try To Extract All The Javascript Files From A Set Of Given Urls
By Integration Tools e.g. gau AND subJS
" jau -subs " Fetches URLs From AlienVault's And Wayback Machine Include Subdomains Of Target
attacker
Try To Extract All The Javascript Files From A Set Of Given Urls By Using One-Liner
Command e.g. Integration Tools e.g. gospider , httpx , subJS AND anew
● Tweet
Steps to produce :-
1 - Open Your Terminal
2 - Write This Command
xargs -I@ -a domains.txt -P10 sh -c 'gospider -a -d 4 -t 3 -c 50 -s
@ | tr "[] " "\n" | grep -oE "(/\*([^*]|(\*+[^*/]))*\*+/)|(.*)|(//.*)" | httpx
-silent -threads 200 | subjs -c 100 -t 5 | anew subjsUrls'
My Methodology
attacker
root@mine:~#cat extractEndpoints.sh
#!/bin/bash
for jsFile in `cat out.txt`
do
Python3 linkfinder.py -o cli -i $jsFile | tee -a newEndpoints.txt
done
root@mine:~#chmod +x extractEndpoints.sh && ./extractEndpoints.sh
" -o cli " Print Output to STDOUT " " -i urlJS OR out.txt " Input a Javascript URL OR File
My Methodology
attacker
attacker
Try To Extract All The Endpoints From Any Domain By Using One-Liner
Command e.g. One Of Those Commands
attacker
Try To Extract All The Endpoints From Any Javascript File By Integration
Tools e.g. js-beautify AND CyberChef
● Tweet
Steps to produce :-
attacker
Try To Extract All Subdomains From Any Domain By Using Tools e.g. subscraper
attacker
Try To Extract All The Endpoints And Subdomains From Any Domain
By Using Tools e.g. JSFinder
" -d " Rescan Every URL You Will Find It aka Deep Find
" -ou url.txt " File To Save Paths " -os subdomains.txt " File To Save Subdomains
My Methodology
attacker
attacker
attacker
Try To Analyze Javascript Files From Your Command Line e.g. js-beautify file.js
> pretty.js && grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*" pretty.js | sort -u
● Tweet
Steps to produce :-
attacker
Try To Search For Javascript Manually To Discover New parameters , Endpoints And
Subdomains OR References To More API Calls OR Get Dev Comments OR Tokens
attacker
location
location.host
location.hostname
location.href
location.pathname
location.search
location.protocol
● Tweet location.assign()
location.replace()
open()
domElem.srcdoc
jQuery.ajax()
$.ajax()
XMLHttpRequest.open()
XMLHttpRequest.send()
My Methodology
attacker
Try To Execute Those Functions That Contains Sensitive Keywords e.g. key , API
Key etc In Your Browser's Console To See What They Do
attacker
Steps to produce :-
1 - Open File .bashrc
2 - Write Those
export JSMON_NOTIFY_SLACK=True
export JSMON_SLACK_TOKEN=token
export JSMON_SLACK_CHANNEL_ID=channel
3 - Open Your Terminal
2 - Write This Command
source .bashrc
cd path/to/jsmon/tool
crontab -e && @daily jsmon.sh
echo "https://www.company.com/file.js" >> targets/company.com
python3 jsmon.py
My Methodology
attacker
● Tweet
● Tweet
Thank
You
Mahmoud M. Awali
@0xAwali