第一步是收集可能的几个javascript文件(更多的文件=更多的路径,参数->更多的vulns)。
要想获得更多的js文件,这个要看目标,一个在大目标中很注重的人,这也要看你使用的工具。
tools:
gau - 通常用它来搜索尽可能多的javascript文件,很多公司都把他们的文件托管在第三方,这个东西对于一个bugunter来说非常重要,因为这样就可以真正的罗列出很多js文件!这个工具可以让你在搜索的过程中找到更多的javascript文件。
https://github.com/lc/gau
Example: paypal.com host their files on paypalobjects.com $ gau paypalobjects.com |grep -iE '\.js'|grep -ivE '\.json'|sort -u >> paypalJS.txt $ gau paypal.com |grep -iE '\.js'|grep -ivE '\.json'|sort -u >> paypalJS.txt don't worry if where the files are hosted is out-of-scope, our intent is to enumerate js files to get more parameters,paths,tokens,apikey,..
linkfinder - 通常用它来搜索路径、链接,结合availableForPurchase.py和collector.py
https://github.com/GerbenJavado/LinkFinder
Example:
$ cat paypalJS.txt|xargs -n2 -I@ bash -c "echo -e '\n[URL]: @\n'; python3 linkfinder.py -i @ -o cli" >> paypalJSPathsWithUrl.txt $ cat paypalJSPathsWithUrl.txt|grep -iv '[URL]:'||sort -u > paypalJSPathsNoUrl.txt$ cat paypalJSPathsNoUrl.txt | python3 collector.py output
getSrc - 提取脚本链接的工具,这个工具的好处是可以制作出绝对的url!
https://github.com/m4ll0k/Bug-Bounty-Toolz/blob/master/getsrc.py
Example:
$ python3 getSrc.py https://www.paypal.com/
https://www.paypalobjects.com/digitalassets/c/website/js/react-16_6_3-bundle.js https://www.paypalobjects.com/tagmgmt/bs-chunk.js
SecretFinder - 用于发现敏感数据的工具,如js文件中的apikeys、accesstoken、authorizations、jwt等。
https://github.com/m4ll0k/SecretFinder
Example:
$ cat paypalJS.txt|xargs -n2 -I @ bash -c 'echo -e "\n[URL] @\n";python3 linkfinder.py -i @ -o cli' >> paypalJsSecrets.txt
antiburl/antiburl.py - 在 stdin 上获取 URL,如果返回 200 OK,则将其打印到 stdout。antiburl.py 是一个高级版本。
https://github.com/tomnomnom/hacks/tree/master/anti-burl
https://github.com/m4ll0k/Bug-Bounty-Toolz/blob/master/antiburl.py
Example:
$ cat paypalJS.txt|antiburl > paypalJSAlive.txt$ cat paypalJS.txt | python3 antiburl.py -A -X 404 -H 'header:value' 'header2:value2' -N -C "mycookies=10" -T 50
ffuf - 模糊化工具,用它来模糊化js文件。
https://github.com/ffuf/ffuf
Example:
$ ffuf -u https://www.paypalobjects.com/js/ -w jsWordlist.txt -t 200
Note: top wordlists - https://wordlists.assetnote.io/
allJsToJson.py - 它向传递给它的urls发出请求,并检索所有的js文件,并将它们保存在一个json文件中。
$ cat myPaypalUrls.txt | python3 allJsToJson.py output.json$ cat output.json
{"url_1": { "root": "www.paypal.com", "path": "/us/home", "url": "https://www.paypa.com/us/home", "count_js": "4", "results": { "script_1": "https://www.paypalobjects.com/web/res/dc9/99e63da7c23f04e84d0e82bce06b5/js/config.js", "content": "function()/**/" }},"url_2": {}}
gitHubLinks.py - 在GitHub上寻找新的链接,在本例中,只有javascript链接。
https://github.com/m4ll0k/Bug-Bounty-Toolz/blob/master/getjswords.py
Example:
$ python3 gitHubLinks.py www.paypalobjects.com|grep -iE '\.js'
availableForPurchase.py - 这个工具可以搜索一个域名是否可以被购买,这个工具结合linkfinder和collector真的很强大。很多时候开发者为了分心写域名而犯错,也许是域名导入了一个外部javascript文件等等。
Example:
$ cat paypalJS.txt|xargs -I @ bash -c 'python3 linkfinder.py -i @ -o cli' | python3 collector.py output$ cat output/urls.txt | python3 availableForPurchase.py[NO] www.googleapis.com [YES] www.gooogleapis.com
BurpSuite - 提取脚本标签之间的内容,使用getScriptTagContent.py
之后保存内容并使用linkfinder
$ python3 linkfinder.py -i burpscriptscontent.txt -o cli
jsbeautify.py - Javascript Beautify
https://github.com/m4ll0k/Bug-Bounty-Toolz/blob/master/jsbeautify.py
Example:
$ python3 jsbeautify https://www.paypalobject.com/test.js paypal/manualAnalyzis.js
collector.py - 将 linkfinder 的 stdout 分为 jsfile、urls、params等
https://github.com/m4ll0k/Bug-Bounty-Toolz/blob/master/collector.py
$ python3 linkfinder.py -i https://www.test.com/a.js -o cli | python3 collector.py output$ ls output
files.txt js.txt params.txt paths.txt urls.txt
jsAlert.py -发现任何有趣的关键字,postMessage,onmessage,innerHTML等
Example:
$ cat myjslist.txt | python3 jsAlert.py
[URL] https://..../test.js
line:16 - innerHTML
[URL] https://.../test1.js
line:3223 - onmessage
getScriptTagContent.py - 在脚本标签之间获取内容
Example:
$ cat "https://www.google.com/"|python3 getScriptTagContent.py
function()/**/...
getJSWords.py - 获取所有javascript文件中的单词,不包括javascript关键字
Example:
$ python3 getjswords.py https://www.google.com/test.js
wordword1
如上所述,每当有很多请求时,我们需要做很多事情,用allJsToJson解决了这个问题,它保留了所有js文件的内容,显然这个工具是为了一次只处理5个urls而制作的,因为文件的大小,每次处理5个urls都会保存输出output1.json, output2.json等