Skip to content

Commit da850fc

Browse files
authored
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]>
1 parent da26fe5 commit da850fc

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
77
### Added
88
- extender/arpSyndicateSubdomainDiscovery.js - uses the API of [ARPSyndicate's Subdomain Center](https://www.subdomain.center/)
99
to find and add subdomains to the Sites Tree.
10+
- passive/JavaDisclosure.js - Passive scan for Java error messages leaks
1011

1112
## [18] - 2024-01-29
1213
### Added

passive/JavaDisclosure.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//Passive scan for Java error messages containing sensitive information (CWE-209)
2+
3+
function scan(ps, msg, src) {
4+
var alertRisk = 2
5+
var alertConfidence = 3
6+
var alertTitle = 'Java stack trace disclosure'
7+
var alertDesc = 'Java stack trace disclosure (or similar) was found'
8+
var alertSolution = 'Investigate Java stack trace disclosures found in the response, remove or mask as required'
9+
var cweId = 209
10+
var wascId = 0
11+
12+
var re = /springframework|\.java|rootBeanClass/i
13+
14+
var contentType = msg.getResponseHeader().getHeader("Content-Type")
15+
var unwantedFileTypes = ['image/png', 'image/jpeg', 'image/gif', 'application/x-shockwave-flash', 'application/pdf']
16+
17+
if (unwantedFileTypes.indexOf("" + contentType) >= 0) {
18+
return
19+
}
20+
21+
var body = msg.getResponseBody().toString()
22+
if (re.test(body)) {
23+
let url = msg.getRequestHeader().getURI().toString();
24+
ps.raiseAlert(alertRisk, alertConfidence, alertTitle, alertDesc, url, '', '', body, alertSolution, body, cweId, wascId, msg)
25+
}
26+
27+
}
28+
29+

0 commit comments

Comments
 (0)