-
Notifications
You must be signed in to change notification settings - Fork 4
/
fsink
executable file
·57 lines (36 loc) · 2.04 KB
/
fsink
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
CONTEXT=""
while getopts ":C:" opt; do
case $opt in
C) CONTEXT="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
exit 1
;;
esac
case $OPTARG in
-*) echo "Option $opt needs a valid argument"
exit 1
;;
esac
done
if [ -z "$CONTEXT" ]; then CONTEXT="0";fi
OPEN_REDIRECT_SINKS="location|location.host|location.hostname|location.href|location.pathname|location.search|location.protocol|location.assign|location.replace|open|domElem.srcdoc|XMLHttpRequest.open|XMLHttpRequest.send|jQuery.ajax|$.ajax"
COOKIE_SINKS="document.cookie"
JS_SINKS="eval|Function|setTimeout|setInterval|setImmediate|execCommand|execScript|msSetImmediate|range.createContextualFragment|crypto.generateCRMFRequest"
DOCUMENT_DOMAIN_SINKS="document.domain"
WEBSOCKET_SINKS="WebSocket"
LINK_SINKS=".href|.src|.action"
AJAX_REQUEST_SINKS="XMLHttpRequest.setRequestHeader|XMLHttpRequest.open|XMLHttpRequest.send|jQuery.globalEval|$.globalEval"
LOCAL_FILE_PATH_SINKS="FileReader.readAsArrayBuffer|FileReader.readAsBinaryString|FileReader.readAsDataURL|FileReader.readAsText|FileReader.readAsFile|FileReader.root.getFile|FileReader.root.getFile"
SQL_SINKS="executeSql"
HTML5_SINKS="sessionStorage.setItem|localStorage.setItem"
HTML_WRITE="document.write|document.writeln|element.outerHTML|element.insertAdjacentHTML"
XPATH_SINKS=".evaluate"
JSON_SINKS="JSON.parse|jQuery.parseJSON|$.parseJSON"
WEB_MESSAGE_SINKS="postMessage"
DOM_DATA_SINKS=".src|.text|.textContent|.innerText|.innerHTML|.setAttribute|.search|.outerText|.value|\.name|.target|.method|.type|.backgroundImage|.cssText|.codebase|document.title|document.implementation.createHTMLDocument|history.pushState|history.replaceState"
DOS_SINKS="requestFileSystem|RegExp"
##TODO: DOM clobbering
SINKS="$OPEN_REDIRECT_SINKS|$COOKIE_SINKS|$JS_SINKS|$DOCUMENT_DOMAIN_SINKS|$WEBSOCKET_SINKS|$LINK_SINKS|$AJAX_REQUEST_SINKS|$LOCAL_FILE_PATH_SINKS|$SQL_SINKS|$HTML5_SINKS|$HTML_WRITE|$XPATH_SINKS|$JSON_SINKS|$WEB_MESSAGE_SINKS|$DOM_DATA_SINKS|$DOS_SINKS"
grep --color -E $SINKS -C $CONTEXT /dev/stdin