Skip to content

Commit 6335473

Browse files
authored
Merge pull request #455 from ricekot/passive-scripts-metadata
Implement `getMetadata` for remaining Passive scripts
2 parents 4344c70 + 027f938 commit 6335473

19 files changed

+342
-518
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4242
- passive/Report non static sites.js
4343
- passive/RPO.js
4444
- passive/s3.js
45+
- passive/Server Header Disclosure.js
46+
- passive/SQL injection detection.js
47+
- passive/Telerik Using Poor Crypto.js
48+
- passive/Upload form discovery.js
49+
- passive/X-Powered-By_header_checker.js
4550
- httpsender/Alert on Unexpected Content Types.js now checks for common content-types (`json`, `xml`, and `yaml`) more consistently.
4651
- targeted/request_to_xml.js no longer uses deprecated method to show the message in the editor dialogue.
4752

passive/CookieHTTPOnly.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,17 @@ function scan(helper, msg, src) {
2727
var cookies = msg.getResponseHeader().getHeaders("Set-Cookie");
2828
if (cookies != null) {
2929
var re_noflag = /([Hh][Tt][Tt][Pp][Oo][Nn][Ll][Yy])/g;
30-
if (!re_noflag.test(cookies)) {
31-
helper.newAlert().setMessage(msg).setEvidence(cookies).raise();
30+
if (!re_noflag.test(cookies.toString())) {
31+
const otherInfo =
32+
cookies.length > 1
33+
? `Other values: ${cookies.slice(1).toString()}`
34+
: "";
35+
helper
36+
.newAlert()
37+
.setMessage(msg)
38+
.setEvidence(cookies[0])
39+
.setOtherInfo(otherInfo)
40+
.raise();
3241
}
3342
}
3443
}

passive/Find Credit Cards.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ function scan(helper, msg, src) {
6565
}
6666
}
6767
if (foundCard.length != 0) {
68+
const otherInfo =
69+
foundCard.length > 1
70+
? `Other instances: ${foundCard.slice(1).toString()}`
71+
: "";
6872
helper
6973
.newAlert()
7074
.setEvidence(foundCard[0])
71-
.setOtherInfo(`Other instances: ${foundCard.slice(1).toString()}`)
75+
.setOtherInfo(otherInfo)
7276
.setMessage(msg)
7377
.raise();
7478
}

passive/Find Emails.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,14 @@ function scan(helper, msg, src) {
6363
foundEmail.push(comm[0]);
6464
}
6565
// woohoo we found an email lets make an alert for it
66+
const otherInfo =
67+
foundEmail.length > 1
68+
? `Other instances: ${foundEmail.slice(1).toString()}`
69+
: "";
6670
helper
6771
.newAlert()
6872
.setEvidence(foundEmail[0])
69-
.setOtherInfo(`Other instances: ${foundEmail.slice(1).toString()}`)
73+
.setOtherInfo(otherInfo)
7074
.setMessage(msg)
7175
.raise();
7276
}

passive/Find HTML Comments.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,14 @@ function scan(helper, msg, src) {
8686
foundComments.push(comm[0]);
8787
}
8888
if (RESULT_PER_URL == true) {
89+
const otherInfo =
90+
foundComments.length > 1
91+
? `Other instances: ${foundComments.slice(1).toString()}`
92+
: "";
8993
helper
9094
.newAlert()
9195
.setEvidence(foundComments[0])
92-
.setOtherInfo(`Other instances: ${foundComments.slice(1).toString()}`)
96+
.setOtherInfo(otherInfo)
9397
.setMessage(msg)
9498
.raise();
9599
}

passive/Find Hashes.js

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,16 @@ function scan(helper, msg, src) {
6969
while ((comm = wordpress.exec(body))) {
7070
foundwordpress.push(comm[0]);
7171
}
72+
const otherInfo =
73+
foundwordpress.length > 1
74+
? `Other instances: ${foundwordpress.slice(1).toString()}`
75+
: "";
7276
helper
7377
.newAlert()
7478
.setName(alertTitle[0])
7579
.setDescription(alertDesc[0])
7680
.setEvidence(foundwordpress[0])
77-
.setOtherInfo(`Other instances: ${foundwordpress.slice(1).toString()}`)
81+
.setOtherInfo(otherInfo)
7882
.setMessage(msg)
7983
.raise();
8084
}
@@ -85,12 +89,16 @@ function scan(helper, msg, src) {
8589
while ((comm = sha512.exec(body))) {
8690
foundsha512.push(comm[0]);
8791
}
92+
const otherInfo =
93+
foundsha512.length > 1
94+
? `Other instances: ${foundsha512.slice(1).toString()}`
95+
: "";
8896
helper
8997
.newAlert()
9098
.setName(alertTitle[1])
9199
.setDescription(alertDesc[1])
92100
.setEvidence(foundsha512[0])
93-
.setOtherInfo(`Other instances: ${foundsha512.slice(1).toString()}`)
101+
.setOtherInfo(otherInfo)
94102
.setMessage(msg)
95103
.raise();
96104
}
@@ -100,12 +108,16 @@ function scan(helper, msg, src) {
100108
while ((comm = phpbb3.exec(body))) {
101109
foundphpbb3.push(comm[0]);
102110
}
111+
const otherInfo =
112+
foundphpbb3.length > 1
113+
? `Other instances: ${foundphpbb3.slice(1).toString()}`
114+
: "";
103115
helper
104116
.newAlert()
105117
.setName(alertTitle[2])
106118
.setDescription(alertDesc[2])
107119
.setEvidence(foundphpbb3[0])
108-
.setOtherInfo(`Other instances: ${foundphpbb3.slice(1).toString()}`)
120+
.setOtherInfo(otherInfo)
109121
.setMessage(msg)
110122
.raise();
111123
}
@@ -116,12 +128,16 @@ function scan(helper, msg, src) {
116128
while ((comm = mysqlold.exec(body))) {
117129
foundmysqlold.push(comm[0]);
118130
}
131+
const otherInfo =
132+
foundmysqlold.length > 1
133+
? `Other instances: ${foundmysqlold.slice(1).toString()}`
134+
: "";
119135
helper
120136
.newAlert()
121137
.setName(alertTitle[3])
122138
.setDescription(alertDesc[3])
123139
.setEvidence(foundmysqlold[0])
124-
.setOtherInfo(`Other instances: ${foundmysqlold.slice(1).toString()}`)
140+
.setOtherInfo(otherInfo)
125141
.setMessage(msg)
126142
.raise();
127143
}
@@ -132,12 +148,16 @@ function scan(helper, msg, src) {
132148
while ((comm = joomla.exec(body))) {
133149
foundjoomla.push(comm[0]);
134150
}
151+
const otherInfo =
152+
foundjoomla.length > 1
153+
? `Other instances: ${foundjoomla.slice(1).toString()}`
154+
: "";
135155
helper
136156
.newAlert()
137157
.setName(alertTitle[4])
138158
.setDescription(alertDesc[4])
139159
.setEvidence(foundjoomla[0])
140-
.setOtherInfo(`Other instances: ${foundjoomla.slice(1).toString()}`)
160+
.setOtherInfo(otherInfo)
141161
.setMessage(msg)
142162
.raise();
143163
}
@@ -147,12 +167,16 @@ function scan(helper, msg, src) {
147167
while ((comm = drupal.exec(body))) {
148168
founddrupal.push(comm[0]);
149169
}
170+
const otherInfo =
171+
founddrupal.length > 1
172+
? `Other instances: ${founddrupal.slice(1).toString()}`
173+
: "";
150174
helper
151175
.newAlert()
152176
.setName(alertTitle[5])
153177
.setDescription(alertDesc[5])
154178
.setEvidence(founddrupal[0])
155-
.setOtherInfo(`Other instances: ${founddrupal.slice(1).toString()}`)
179+
.setOtherInfo(otherInfo)
156180
.setMessage(msg)
157181
.raise();
158182
}
@@ -163,12 +187,16 @@ function scan(helper, msg, src) {
163187
while ((comm = blowfish.exec(body))) {
164188
foundblowfish.push(comm[0]);
165189
}
190+
const otherInfo =
191+
foundblowfish.length > 1
192+
? `Other instances: ${foundblowfish.slice(1).toString()}`
193+
: "";
166194
helper
167195
.newAlert()
168196
.setName(alertTitle[6])
169197
.setDescription(alertDesc[6])
170198
.setEvidence(foundblowfish[0])
171-
.setOtherInfo(`Other instances: ${foundblowfish.slice(1).toString()}`)
199+
.setOtherInfo(otherInfo)
172200
.setMessage(msg)
173201
.raise();
174202
}
@@ -179,12 +207,16 @@ function scan(helper, msg, src) {
179207
while ((comm = vbull.exec(body))) {
180208
foundvbull.push(comm[0]);
181209
}
210+
const otherInfo =
211+
foundvbull.length > 1
212+
? `Other instances: ${foundvbull.slice(1).toString()}`
213+
: "";
182214
helper
183215
.newAlert()
184216
.setName(alertTitle[7])
185217
.setDescription(alertDesc[7])
186218
.setEvidence(foundvbull[0])
187-
.setOtherInfo(`Other instances: ${foundvbull.slice(1).toString()}`)
219+
.setOtherInfo(otherInfo)
188220
.setMessage(msg)
189221
.raise();
190222
}
@@ -195,13 +227,17 @@ function scan(helper, msg, src) {
195227
while ((comm = md45.exec(body))) {
196228
foundmd45.push(comm[0]);
197229
}
230+
const otherInfo =
231+
foundmd45.length > 1
232+
? `Other instances: ${foundmd45.slice(1).toString()}`
233+
: "";
198234
helper
199235
.newAlert()
200236
.setName(alertTitle[8])
201237
.setDescription(alertDesc[8])
202238
.setConfidence(1)
203239
.setEvidence(foundmd45[0])
204-
.setOtherInfo(`Other instances: ${foundmd45.slice(1).toString()}`)
240+
.setOtherInfo(otherInfo)
205241
.setMessage(msg)
206242
.raise();
207243
}

passive/Find IBANs.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,14 @@ function scan(helper, msg, src) {
5555
foundIBAN.push(comm[0]);
5656
}
5757
// woohoo we found an IBAN lets make an alert for it
58+
const otherInfo =
59+
foundIBAN.length > 1
60+
? `Other instances: ${foundIBAN.slice(1).toString()}`
61+
: "";
5862
helper
5963
.newAlert()
6064
.setEvidence(foundIBAN[0])
61-
.setOtherInfo(`Other instances: ${foundIBAN.slice(1).toString()}`)
65+
.setOtherInfo(otherInfo)
6266
.setMessage(msg)
6367
.raise();
6468
}

passive/Find Internal IPs.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,14 @@ function scan(helper, msg, src) {
5555
while ((comm = re.exec(body))) {
5656
foundIP.push(comm[0]);
5757
}
58+
const otherInfo =
59+
foundIP.length > 1
60+
? `Other instances: ${foundIP.slice(1).toString()}`
61+
: "";
5862
helper
5963
.newAlert()
6064
.setEvidence(foundIP[0])
61-
.setOtherInfo(`Other instances: ${foundIP.slice(1).toString()}`)
65+
.setOtherInfo(otherInfo)
6266
.setMessage(msg)
6367
.raise();
6468
}

passive/RPO.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ function scan(helper, msg, src) {
5656
while ((comm = re.exec(body))) {
5757
foundRPO.push(comm[0]);
5858
}
59+
const otherInfo =
60+
foundRPO.length > 1
61+
? `Other instances: ${foundRPO.slice(1).toString()}`
62+
: "";
5963
helper
6064
.newAlert()
6165
.setEvidence(foundRPO[0])
62-
.setOtherInfo(`Other instances: ${foundRPO.slice(1).toString()}`)
66+
.setOtherInfo(otherInfo)
6367
.setMessage(msg)
6468
.raise();
6569
}

0 commit comments

Comments
 (0)