Created
September 18, 2023 11:22
-
-
Save ChieftainY2k/e363a09ca5e3eb8518bd6604585a3805 to your computer and use it in GitHub Desktop.
ZED PROXY XSS alert(1) passive scan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Passive scan for XSS JS alert(1) | |
function scan(ps, msg, src) { | |
var alertRisk = 2 | |
var alertConfidence = 3 | |
var alertTitle = 'Successful XSS attack' | |
var alertDesc = 'Successful XSS attack' | |
var alertSolution = 'Investigate Successful XSS attack, remove or mask as required' | |
var cweId = 79 | |
var wascId = 8 | |
var re = /<script>alert\(1\)/i | |
var url = msg.getRequestHeader().getURI().toString() | |
var contentType = msg.getResponseHeader().getHeader("Content-Type") | |
var unwantedFileTypes = ['image/png', 'image/jpeg','image/gif','application/x-shockwave-flash','application/pdf'] | |
if (unwantedFileTypes.indexOf(""+contentType) >= 0) { | |
return | |
} | |
var body = msg.getResponseBody().toString() | |
if (re.test(body)) { | |
ps.raiseAlert(alertRisk, alertConfidence, alertTitle, alertDesc, url, '', '', body, alertSolution, body, cweId, wascId, msg) | |
console.log("Successful XSS attack detected"); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment