-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Passive scan for Java error messages containing sensitive information…
… (CWE-209) (#386) Passive scan for Java error messages containing sensitive information. Signed-off-by: ChieftainY2k <[email protected]>
- Loading branch information
1 parent
da26fe5
commit da850fc
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//Passive scan for Java error messages containing sensitive information (CWE-209) | ||
|
||
function scan(ps, msg, src) { | ||
var alertRisk = 2 | ||
var alertConfidence = 3 | ||
var alertTitle = 'Java stack trace disclosure' | ||
var alertDesc = 'Java stack trace disclosure (or similar) was found' | ||
var alertSolution = 'Investigate Java stack trace disclosures found in the response, remove or mask as required' | ||
var cweId = 209 | ||
var wascId = 0 | ||
|
||
var re = /springframework|\.java|rootBeanClass/i | ||
|
||
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)) { | ||
let url = msg.getRequestHeader().getURI().toString(); | ||
ps.raiseAlert(alertRisk, alertConfidence, alertTitle, alertDesc, url, '', '', body, alertSolution, body, cweId, wascId, msg) | ||
} | ||
|
||
} | ||
|
||
|