Skip to content

Commit 6fb815c

Browse files
George-HudsonGeorge Hudson
and
George Hudson
authored
ZAP Scan ignores for SQL Injection (#2679)
* Added Active SQL and Hidden File Finder to IGNORE list and updated documentation explaining why and process for reports * added examples of using postman --------- Co-authored-by: George Hudson <[email protected]>
1 parent bc61ab2 commit 6fb815c

File tree

5 files changed

+55
-3
lines changed

5 files changed

+55
-3
lines changed

docs/Technical-Documentation/Zap-Scan-HTML-Report.md

+36
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,39 @@ link to view the running process at CircleCI
2424
4. Click the `owasp_report.html` link to view the report.
2525

2626
![image](images/report.png)
27+
28+
### Configuring Report Output
29+
30+
We use separate files for configuring the ZAP scanner for the front and back end applications
31+
Backend: [tdrs-backend/reports/zap.conf](../../tdrs-backend/reports/zap.conf)
32+
Frontend: [tdrs-frontend/reports/zap.conf](../../tdrs-frontend/reports/zap.conf)
33+
34+
These files have a list of error codes and what to do with them. We have some of these set
35+
to IGNORE because they do not apply to our configuration but were returning false positives
36+
for test failures. For each of these, we should have a comment as to why the test is being
37+
ignored.
38+
39+
Can use Postman to mimic the test parameters before ignoring to verify
40+
The [free version of Postman](https://www.postman.com/downloads/), the app or web version, can be used for this.
41+
examples:
42+
![image](images/postman_example1.png)
43+
![image](images/postman_example2.png)
44+
45+
### Invoking the OWASP Zap Scanner
46+
47+
We build out how we invoke the zap scanner using our [zap-scanner](../../scripts/zap-scanner.sh) script.
48+
49+
As part of that, we pass some additional configuration that includes a list of urls to exclude from the
50+
scan.
51+
`ZAP_CLI_OPTIONS` contains this list.
52+
It is important to note, not to include the frontend or backend endpoint we want to test the scanner out
53+
on.
54+
55+
e.g. do not include something like this in the `-config globalexcludeurl.url_list.url` configuration options:
56+
```
57+
-config globalexcludeurl.url_list.url\(3\).regex='^https?://.*\.hhs.gov\/.*$' \
58+
-config globalexcludeurl.url_list.url\(3\).description='Site - acf.hhs.gov' \
59+
-config globalexcludeurl.url_list.url\(3\).enabled=true \
60+
```
61+
62+
It will not be able to find the endpoint for the tests and the output is confusing as to what is happening.
Loading
Loading

tdrs-backend/reports/zap.conf

+9-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@
7979
40014 FAIL (Cross Site Scripting (Persistent) - Active/release)
8080
40016 FAIL (Cross Site Scripting (Persistent) - Prime - Active/release)
8181
40017 FAIL (Cross Site Scripting (Persistent) - Spider - Active/release)
82-
40018 WARN (SQL Injection - Active/release)
82+
##### IGNORE (SQL Injection - Active/release) as it doesn't apply to us and is giving
83+
##### false positives because it takes us to a default django page notifying us
84+
##### of the 403 forbidden, instead of just a 403 being returned. The test is
85+
##### treating this as though the SQL injection worked, since a page is returned.
86+
40018 IGNORE (SQL Injection - Active/release)
8387
40019 FAIL (SQL Injection - MySQL - Active/beta)
8488
40020 FAIL (SQL Injection - Hypersonic SQL - Active/beta)
8589
40021 FAIL (SQL Injection - Oracle - Active/beta)
@@ -93,7 +97,10 @@
9397
40029 FAIL (Trace.axd Information Leak - Active/beta)
9498
40032 FAIL (.htaccess Information Leak - Active/release)
9599
40034 FAIL (.env Information Leak - Active/beta)
96-
40035 FAIL (Hidden File Finder - Active/beta)
100+
##### IGNORE (Hidden File Finder - Active/beta) due to false failing similar to SQL
101+
##### Injection false positive above. Replicating parameters of the test
102+
##### result in
103+
40035 IGNORE (Hidden File Finder - Active/beta)
97104
41 FAIL (Source Code Disclosure - Git - Active/beta)
98105
42 FAIL (Source Code Disclosure - SVN - Active/beta)
99106
43 FAIL (Source Code Disclosure - File Inclusion - Active/beta)

tdrs-frontend/reports/zap.conf

+10-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@
7979
40014 FAIL (Cross Site Scripting (Persistent) - Active/release)
8080
40016 FAIL (Cross Site Scripting (Persistent) - Prime - Active/release)
8181
40017 FAIL (Cross Site Scripting (Persistent) - Spider - Active/release)
82+
##### IGNORE (SQL Injection - Active/release, MySQL, Hypersonig SQL, Oracle)
83+
##### as they don't apply to us and is giving false positives because
84+
##### it takes us to a default django page notifying us of the 403
85+
##### forbidden, instead of just a 403 being returned. The test is
86+
##### treating this as though the SQL injection worked, since a page
87+
##### is returned.
8288
40018 IGNORE (SQL Injection - Active/release)
8389
40019 IGNORE (SQL Injection - MySQL - Active/beta)
8490
40020 IGNORE (SQL Injection - Hypersonic SQL - Active/beta)
@@ -93,7 +99,10 @@
9399
40029 FAIL (Trace.axd Information Leak - Active/beta)
94100
40032 FAIL (.htaccess Information Leak - Active/release)
95101
40034 FAIL (.env Information Leak - Active/beta)
96-
40035 FAIL (Hidden File Finder - Active/beta)
102+
##### IGNORE (Hidden File Finder - Active/beta) due to false failing similar to SQL
103+
##### Injection false positive above. Replicating parameters of the test
104+
##### result in
105+
40035 IGNORE (Hidden File Finder - Active/beta)
97106
41 FAIL (Source Code Disclosure - Git - Active/beta)
98107
42 FAIL (Source Code Disclosure - SVN - Active/beta)
99108
43 FAIL (Source Code Disclosure - File Inclusion - Active/beta)

0 commit comments

Comments
 (0)