Skip to content

Commit e22191f

Browse files
authored
Wavsep in SQLi Time rule + generate totals (#253)
Signed-off-by: Simon Bennetts <psiinon@gmail.com>
1 parent f949dc6 commit e22191f

File tree

2 files changed

+41
-17
lines changed

2 files changed

+41
-17
lines changed

scans/wavsep/wavsep-score.js

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ if (!Array.prototype.includes) {
2121
});
2222
}
2323

24-
var totalUrls;
25-
var totalAlerts;
24+
var totalUrls = 0;
25+
var totalAlerts = 0;
26+
var sectionUrls;
27+
var sectionAlerts;
2628

2729
var FileWriter = Java.type('java.io.FileWriter');
2830
var PrintWriter = Java.type('java.io.PrintWriter');
@@ -56,12 +58,12 @@ function listChildren(pw, node, type, rules) {
5658
continue;
5759
}
5860
if (! IGNORE_PATHS.includes(path)) {
59-
totalUrls++;
61+
sectionUrls++;
6062
pw.println('- path: ' + path);
6163
var pluginId = nodeHasAlert(child, rules);
6264
// Following test is JS equiv of XOR
6365
if (path.indexOf("FalsePositives") > 0 ? !pluginId : pluginId) {
64-
totalAlerts++;
66+
sectionAlerts++;
6567
pw.println(' result: Pass');
6668
pw.println(' rule: ' + pluginId);
6769
} else {
@@ -84,12 +86,28 @@ function scoreChildren(file, name, type, rules) {
8486
pw.println('url: ' + type);
8587
pw.println('details:');
8688

87-
totalUrls = 0;
88-
totalAlerts = 0;
89+
sectionUrls = 0;
90+
sectionAlerts = 0;
8991

9092

9193
listChildren(pw, root, type, rules);
9294

95+
pw.println('tests: ' + sectionUrls);
96+
pw.println('passes: ' + sectionAlerts);
97+
pw.println('fails: ' + (sectionUrls - sectionAlerts));
98+
pw.println('score: ' + Math.round(sectionAlerts * 100 / sectionUrls) + '%');
99+
100+
totalUrls += sectionUrls;
101+
totalAlerts += sectionAlerts;
102+
103+
pw.close();
104+
}
105+
106+
function scoreTotal() {
107+
var YAML_FILE = DIR + "/totals.yml";
108+
var fw = new FileWriter(YAML_FILE);
109+
var pw = new PrintWriter(fw);
110+
93111
pw.println('tests: ' + totalUrls);
94112
pw.println('passes: ' + totalAlerts);
95113
pw.println('fails: ' + (totalUrls - totalAlerts));
@@ -135,22 +153,24 @@ scoreChildren("rxss-post", "Reflected XSS POST", "/RXSS-Detection-Evaluation-POS
135153
scoreChildren("rxss-post-exp", "Reflected XSS POST Experimental", "/RXSS-Detection-Evaluation-POST-Experimental/", [40012]);
136154
scoreChildren("rxss-fps", "Reflected XSS GET False Positives", "/RXSS-FalsePositives-GET/", [40012]);
137155

138-
scoreChildren("sqli-get-200-err", "SQL Injection GET 200 Error", "/SInjection-Detection-Evaluation-GET-200Error/", [40018]);
139-
scoreChildren("sqli-get-200-err-exp", "SQL Injection GET 200 Error Experimental", "/SInjection-Detection-Evaluation-GET-200Error-Experimental/", [40018]);
140-
scoreChildren("sqli-get-200-id", "SQL Injection GET 200 Identical", "/SInjection-Detection-Evaluation-GET-200Identical/", [40018]);
141-
scoreChildren("sqli-get-200-valid", "SQL Injection GET 200 Valid", "/SInjection-Detection-Evaluation-GET-200Valid/", [40018]);
142-
scoreChildren("sqli-get-500-err", "SQL Injection GET 500 Error", "/SInjection-Detection-Evaluation-GET-500Error/", [40018]);
143-
scoreChildren("sqli-post-200-err", "SQL Injection POST 200 Error", "/SInjection-Detection-Evaluation-POST-200Error/", [40018]);
144-
scoreChildren("sqli-post-200-err-exp", "SQL Injection POST 200 Error Experimental", "/SInjection-Detection-Evaluation-POST-200Error-Experimental/", [40018]);
145-
scoreChildren("sqli-post-200-id", "SQL Injection POST 200 Identical", "/SInjection-Detection-Evaluation-POST-200Identical/", [40018]);
146-
scoreChildren("sqli-post-200-valid", "SQL Injection POST 200 Valid", "/SInjection-Detection-Evaluation-POST-200Valid/", [40018]);
147-
scoreChildren("sqli-post-500-err", "SQL Injection POST 500 Error", "/SInjection-Detection-Evaluation-POST-500Error/", [40018]);
148-
scoreChildren("sqli-get-fp", "SQL Injection GET False Positives", "/SInjection-FalsePositives-GET/", [40018]);
156+
scoreChildren("sqli-get-200-err", "SQL Injection GET 200 Error", "/SInjection-Detection-Evaluation-GET-200Error/", [40018,40019]);
157+
scoreChildren("sqli-get-200-err-exp", "SQL Injection GET 200 Error Experimental", "/SInjection-Detection-Evaluation-GET-200Error-Experimental/", [40018,40019]);
158+
scoreChildren("sqli-get-200-id", "SQL Injection GET 200 Identical", "/SInjection-Detection-Evaluation-GET-200Identical/", [40018,40019]);
159+
scoreChildren("sqli-get-200-valid", "SQL Injection GET 200 Valid", "/SInjection-Detection-Evaluation-GET-200Valid/", [40018,40019]);
160+
scoreChildren("sqli-get-500-err", "SQL Injection GET 500 Error", "/SInjection-Detection-Evaluation-GET-500Error/", [40018,40019]);
161+
scoreChildren("sqli-post-200-err", "SQL Injection POST 200 Error", "/SInjection-Detection-Evaluation-POST-200Error/", [40018,40019]);
162+
scoreChildren("sqli-post-200-err-exp", "SQL Injection POST 200 Error Experimental", "/SInjection-Detection-Evaluation-POST-200Error-Experimental/", [40018,40019]);
163+
scoreChildren("sqli-post-200-id", "SQL Injection POST 200 Identical", "/SInjection-Detection-Evaluation-POST-200Identical/", [40018,40019]);
164+
scoreChildren("sqli-post-200-valid", "SQL Injection POST 200 Valid", "/SInjection-Detection-Evaluation-POST-200Valid/", [40018,40019]);
165+
scoreChildren("sqli-post-500-err", "SQL Injection POST 500 Error", "/SInjection-Detection-Evaluation-POST-500Error/", [40018,40019]);
166+
scoreChildren("sqli-get-fp", "SQL Injection GET False Positives", "/SInjection-FalsePositives-GET/", [40018,40019]);
149167

150168
scoreChildren("redir-get-302", "Unvalidated Redirect GET 200", "/Redirect-Detection-Evaluation-GET-302Redirect/", [20019]);
151169
scoreChildren("redir-post-302", "Unvalidated Redirect POST 302", "/Redirect-Detection-Evaluation-POST-302Redirect/", [20019]);
152170
scoreChildren("redir-get-fp", "Unvalidated Redirect GET False Positives", "/Redirect-FalsePositives-GET/", [20019]);
153171
scoreChildren("redir-get-200-valid", "Unvalidated Redirect GET 200 Valid", "/Redirect-JavaScript-Detection-Evaluation-GET-200Valid/", [20019]);
154172
scoreChildren("redir-post-200-valid", "Unvalidated Redirect POST 200 Valid", "/Redirect-JavaScript-Detection-Evaluation-POST-200Valid/", [20019]);
155173

174+
scoreTotal();
175+
156176
print('Done');

scans/wavsep/wavsep.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ jobs:
139139
id: 40018
140140
threshold: medium
141141
strength: high
142+
- name: SQL Injection - MySQL (Time Based)
143+
id: 40019
144+
threshold: medium
145+
strength: high
142146
- name: activeScan Redirect
143147
type: activeScan
144148
parameters:

0 commit comments

Comments
 (0)