
顎
網站|文檔|設置|爬行者|快速開始碼頭(示例)
基於ESPRIMA解析器的JavaScript的屬性圖的開源,原型實現以及Estree spidermonkey規範。 JAW可用於分析Web應用程序和基於JavaScript的程序的客戶端。
該項目已根據GNU AFFERO GENERAL PUBLIC LICENSE V3.0許可。請參閱此處以獲取更多信息。
Jaw在https://soheilkhodayari.github.io/jaw/上提供了一個GitHub頁面網站。
發行說明:
JAW-V2分支。JAW-V1分支。下頜的結構如下所示。

下巴可以以兩種不同的方式使用:
任意JavaScript分析:通過指定程序的文件系統path來建模和分析任何JavaScript程序。
Web應用程序分析:通過提供單個種子URL來分析Web應用程序。
使用收集的Web資源創建混合程序圖(HPG),該圖將導入到NEO4J數據庫中。
可選地,為HPG構造模塊提供語義類型的映射到自定義JavaScript語言令牌,從而根據其目的促進JavaScript函數的分類(例如,HTTP請求函數)。
查詢構建的Neo4j圖數據庫以進行各種分析。 JAW為數據流分析,控制流分析,可及性分析和模式匹配提供實用程序遍歷。這些遍歷可用於開發自定義安全分析。
下巴還包括用於檢測客戶端CSRF的內置遍歷,DOM CLOBBERing和請求劫持漏洞。
輸出將存儲在與輸入的文件夾中。
安裝腳本依賴以下先決條件:
npm package manager (節點JS)的最新版本python 3.xpip軟件包經理之後,通過以下方式安裝必要的依賴項
$ ./install.sh有關detailed安裝說明,請參閱此處。
您可以通過以下方式在背景屏幕中運行管道的實例:
$ python3 -m run_pipeline --conf=config.yamlCLI提供以下選項:
$ python3 -m run_pipeline -h
usage: run_pipeline.py [-h] [--conf FILE] [--site SITE] [--list LIST] [--from FROM] [--to TO]
This script runs the tool pipeline.
optional arguments:
-h, --help show this help message and exit
--conf FILE, -C FILE pipeline configuration file. (default: config.yaml)
--site SITE, -S SITE website to test; overrides config file (default: None)
--list LIST, -L LIST site list to test; overrides config file (default: None)
--from FROM, -F FROM the first entry to consider when a site list is provided; overrides config file (default: -1)
--to TO, -T TO the last entry to consider when a site list is provided; overrides config file (default: -1)
輸入配置: JAW期望.yaml配置文件作為輸入。有關示例,請參見Config.yaml。
暗示。配置文件指定不同的通行證(例如,爬網,靜態分析等),可以為每個漏洞類啟用或禁用。這樣可以單獨或以不同的順序運行工具構建塊(例如,首先爬網,然後進行安全分析)。
要運行一個快速示例,演示如何構建屬性圖並在其上運行Cypher查詢,請執行:
$ python3 -m analyses.example.example_analysis --input= $( pwd ) /data/test_program/test.js該模塊收集測試所需的數據(即,網頁的javascript代碼和狀態值)。如果要測試文件系統上已經有的特定Javascipt文件,則可以跳過此步驟。
Jaw具有基於硒(JAW-V1),Puppeteer(JAW-V2,V3)和劇作家(JAW-V3)的爬蟲。對於大多數最新功能,建議使用uppeteer或基於劇作的版本。
該網絡爬行者採用Foxhound(Firefox的樂器版本),在通過網頁導航時執行動態污點跟踪。要啟動爬行者,請做:
$ cd crawler
$ node crawler-taint.js --seedurl=https://google.com --maxurls=100 --headless=true --foxhoundpath= < optional-foxhound-executable-path > foxhoundpath默認設置為以下目錄: crawler/foxhound/firefox包含一個名為firefox的二進製文件。
注意:您需要使用此版本的Foxhound構建。 JAW-V3版本中包含Ubuntu構建。
要啟動爬行者,請做:
$ cd crawler
$ node crawler.js --seedurl=https://google.com --maxurls=100 --browser=chrome --headless=true請參閱此處以獲取更多信息。
要啟動爬行者,請做:
$ cd crawler/hpg_crawler
$ vim docker-compose.yaml # set the websites you want to crawl here and save
$ docker-compose build
$ docker-compose up -d有關更多信息,請在此處參考hpg_crawler的文檔。
要為給定(一組)JavaScript文件生成HPG,請執行:
$ node engine/cli.js --lang=js --graphid=graph1 --input=/in/file1.js --input=/in/file2.js --output=$(pwd)/data/out/ --mode=csv
optional arguments:
--lang: language of the input program
--graphid: an identifier for the generated HPG
--input: path of the input program(s)
--output: path of the output HPG, must be i
--mode: determines the output format (csv or graphML)
要在Neo4J圖形數據庫(Docker實例)內導入HPG,請執行:
$ python3 -m hpg_neo4j.hpg_import --rpath=<path-to-the-folder-of-the-csv-files> --id=<xyz> --nodes=<nodes.csv> --edges=<rels.csv>
$ python3 -m hpg_neo4j.hpg_import -h
usage: hpg_import.py [-h] [--rpath P] [--id I] [--nodes N] [--edges E]
This script imports a CSV of a property graph into a neo4j docker database.
optional arguments:
-h, --help show this help message and exit
--rpath P relative path to the folder containing the graph CSV files inside the `data` directory
--id I an identifier for the graph or docker container
--nodes N the name of the nodes csv file (default: nodes.csv)
--edges E the name of the relations csv file (default: rels.csv)
為了為hpg_crawler的輸出創建一個混合屬性圖並在本地NEO4J實例中導入它,您也可以做:
$ python3 -m engine.api < path > --js= < program.js > --import= < bool > --hybrid= < bool > --reqs= < requests.out > --evts= < events.out > --cookies= < cookies.pkl > --html= < html_snapshot.html >參數規範:
<path> :通往包含程序文件的文件夾的絕對路徑(必須在engine/outputs文件夾下方)。--js=<program.js> :用於分析的JavaScript程序的名稱(默認: js_program.js )。--import=<bool> :是否應將構造的屬性圖導入到活動的Neo4J數據庫(默認值:true)。--hybrid=bool :是否啟用了混合模式(默認值: false )。這意味著測試儀希望通過輸入任何HTML快照,射擊事件,HTTP請求和cookie的文件來豐富屬性圖。--reqs=<requests.out> :僅對於混合模式,包含obsevered網絡請求序列的文件的名稱,將字符串false傳遞以排除(default: request_logs_short.out )。--evts=<events.out> :僅對於混合模式,包含射擊事件序列的文件的名稱,將字符串false傳遞到排除(默認: events.out )。--cookies=<cookies.pkl> :僅對於混合模式,包含cookie的文件的名稱,將字符串false傳遞到排除(默認: cookies.pkl )。--html=<html_snapshot.html> :僅對於混合模式,包含DOM樹快照的文件的名稱,將字符串false傳遞以排除(默認: html_rendered.html )。有關更多信息,您可以使用圖形構造API提供的幫助CLI:
$ python3 -m engine.api -h然後可以使用Cypher或NeoModel ORM查詢構造的HPG。
您應該在analyses/<ANALYSIS_NAME>中放置並運行查詢。
您可以使用NeoModel ORM查詢HPG。寫查詢:
example_query_orm.py在analyses/example文件夾中。 $ python3 -m analyses.example.example_query_orm 有關更多信息,請參閱此處。
您可以使用Cypher編寫自定義查詢。為了這:
example_query_cypher.py在analyses/example文件夾中。 $ python3 -m analyses.example.example_query_cypher有關更多信息,請參閱此處。
本節介紹瞭如何配置和使用JAW進行漏洞檢測以及如何解釋輸出。下頜包含用於檢測客戶端CSRF和DOM CLOBBERING的獨立查詢
步驟1。在輸入config.yaml文件中啟用漏洞類的分析組件:
request_hijacking :
enabled : true
# [...]
open_redirect :
enabled : false
# [...]
domclobbering :
enabled : false
# [...]
cs_csrf :
enabled : false
# [...]步驟2。使用以下方式運行管道的實例:
$ python3 -m run_pipeline --conf=config.yaml暗示。您可以在不同screen s下運行多個管道的實例:
$ screen -dmS s1 bash -c ' python3 -m run_pipeline --conf=conf1.yaml; exec sh '
$ screen -dmS s2 bash -c ' python3 -m run_pipeline --conf=conf2.yaml; exec sh '
$ # [...]要自動生成並行配置文件,您可以使用generate_config.py腳本。
輸出將存儲在稱為sink.flows.out的文件中,以與輸入的文件夾中。例如,對於客戶端的CSRF,對於每個檢測到的HTTP請求,下頜輸出標記與構建請求(即,程序切片)元素關聯的語義類型集(又稱語義標籤或標籤)集的條目。例如,通過window.location Point可以原諒具有語義類型['WIN.LOC']的HTTP請求。但是,標記為['NON-REACH']的請求是不可原諒的。
示例輸出條目如下:
[*] Tags: ['WIN.LOC']
[*] NodeId: {'TopExpression': '86', 'CallExpression': '87', 'Argument': '94'}
[*] Location: 29
[*] Function: ajax
[*] Template: ajaxloc + "/bearer1234/"
[*] Top Expression: $.ajax({ xhrFields: { withCredentials: "true" }, url: ajaxloc + "/bearer1234/" })
1:['WIN.LOC'] variable=ajaxloc
0 (loc:6)- var ajaxloc = window.location.href
此條目顯示,在第29行上,有一個$.ajax呼叫表達式,並且此呼叫表達式觸發了ajaxloc + "/bearer1234/的URL模板值的ajax請求,其中參數ajaxloc是一個程序slice slice slice slice slice slice在第6行中讀取['WIN.LOC']在window.location.href中的讀取其值。
為了簡化JAW的測試過程並確保您的設置準確,我們提供了一個簡單的node.js Web應用程序,您可以使用該應用程序測試下JAW。
首先,通過以下方式安裝依賴項:
$ cd tests/test-webapp
$ npm install然後,在新屏幕中運行應用程序:
$ screen -dmS jawwebapp bash -c ' PORT=6789 npm run devstart; exec sh '有關更多信息,請訪問我們的Wiki頁面。以下是用於快速訪問的目錄。
拉力請求總是受到歡迎。該項目旨在是一個安全,熱情的空間,預計貢獻者將遵守《行為守則》。
如果您使用下巴進行學術研究,我們鼓勵您引用以下論文:
@inproceedings{JAW,
title = {JAW: Studying Client-side CSRF with Hybrid Property Graphs and Declarative Traversals},
author= {Soheil Khodayari and Giancarlo Pellegrino},
booktitle = {30th {USENIX} Security Symposium ({USENIX} Security 21)},
year = {2021},
address = {Vancouver, B.C.},
publisher = {{USENIX} Association},
}
下巴已經走了很長一段路,我們想在這裡給貢獻者一個當之無愧的喊叫!
@tmbrbr, @c01gide,@jndre和sepehr mirzaei。