Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
699e818
Added environment variables to define technical-user for scanner serv…
MartinLang1 Oct 2, 2018
474b09f
Added documentation for zap rate limit configuration
MartinLang1 Oct 23, 2018
73155de
Added authentication to engine up check call
J12934 Oct 24, 2018
c68de0a
Moved auth and tennant processing before engine up check
J12934 Oct 24, 2018
7452e1e
Add Replacer to doc
wurstbrot Nov 14, 2018
d137071
Moving result polling to new api
J12934 Nov 15, 2018
c6093ba
Added result fetching via secureCodeBox api
J12934 Nov 15, 2018
593b31d
Formatted readme to follow markdown conventions
J12934 Nov 15, 2018
6187dec
Added options to configure context and targetName
J12934 Nov 15, 2018
e4dbd89
Added gitignore to ensure that result files wont get accidentally com…
J12934 Nov 15, 2018
0bb6104
Updated uage examples for new cli
J12934 Nov 15, 2018
e97d0aa
Updated cli documentation
J12934 Nov 15, 2018
f381839
adjusted arachni-bodgeit-example fo rate limit documentation
Nov 19, 2018
bbaa44f
Removed .idea files and add them to gitignore
Nov 19, 2018
4e65375
split documentation of arachni-bodgeit-example into test and full config
Nov 19, 2018
1be860c
Merge pull request #60 from secureCodeBox/feature/rate-limit
MartinLang1 Nov 22, 2018
4ad77af
Updated banner and version
J12934 Nov 26, 2018
b9eaa07
Fixed error in backend address config
J12934 Nov 26, 2018
6e507db
Added more catch cases for expected status codes
J12934 Nov 26, 2018
dcd2c2e
Corrected bodgeit scan with sitemap payload to use new api structure
J12934 Nov 26, 2018
f222b0b
Merged develop into feature branch
J12934 Nov 26, 2018
76724f0
Merge pull request #59 from secureCodeBox/feature/cli-1.0
J12934 Nov 27, 2018
368e293
Spelling and formatting fixes
J12934 Nov 27, 2018
5d1d40a
Merge pull request #58 from secureCodeBox/wurstbrot-patch-2
J12934 Nov 27, 2018
11c6c1f
Added notes about automating security tests
J12934 Nov 27, 2018
86d59f1
Correct usage of Zap rule REQ_HEADER
wurstbrot Dec 3, 2018
3cfe6cb
Merge pull request #61 from secureCodeBox/wurstbrot-patch-3
rfelber Dec 3, 2018
c041d2e
Merge pull request #52 from secureCodeBox/feature/add-basic-auth-to-e…
J12934 Dec 11, 2018
130cb5e
Added defectdojo to compose stack
J12934 Dec 12, 2018
4578454
Updated persistence provider docs for changes made for the defectdojo…
J12934 Dec 19, 2018
ca15198
Added json example with defect dojo meta fields
J12934 Dec 19, 2018
ae7eb14
Linked to persistence guide from user guide
J12934 Dec 19, 2018
161d8bf
Added meta field documentation
J12934 Jan 9, 2019
ca41490
Readded elastic searchas a sencond activated persistence provider
J12934 Jan 9, 2019
9488320
addad documentation about common metafields
Jan 16, 2019
88cf869
minor change
Jan 16, 2019
a4581a8
Merge pull request #62 from secureCodeBox/feature/defect-dojo
J12934 Jan 23, 2019
52a5d0e
Corrected image tag and config vars
J12934 Jan 28, 2019
ff7c9e2
Corrected defect dojo env var names
J12934 Jan 28, 2019
4432f27
Removed debug flag from amass container
J12934 Feb 1, 2019
41aef01
Moved defect-dojo image to securecodebox namespace
J12934 Feb 1, 2019
62674e6
Updated scanner service user to follow the camunda 7.10 naming rules
J12934 Feb 1, 2019
903a0f2
Added a bare nginx container to demo compose file
J12934 Feb 1, 2019
da5b27b
Made docker tags and persistence providers configurable via env vars
J12934 Feb 1, 2019
a29bc47
Adds simple api test ensuring all default processes work correctly
J12934 Feb 1, 2019
f24dae5
Fixed node version
J12934 Feb 1, 2019
3451df9
Copy env file instead of moving it
J12934 Feb 1, 2019
40101e3
Added environment file for integration test
J12934 Feb 1, 2019
93fe27b
Install dependencies
J12934 Feb 1, 2019
f26fc99
Removed global setup file
J12934 Feb 1, 2019
2b3b911
Added default admin user
J12934 Feb 1, 2019
2ab8427
Add an additional sleep to test if the wait script works correctly
J12934 Feb 1, 2019
027d637
Added config to specify the admin user in env file
J12934 Feb 1, 2019
06da228
Dowgraded docker-compose file reference to support depends on conditions
J12934 Feb 1, 2019
8574153
Ensured that variables are in the right format for docker-compose
J12934 Feb 1, 2019
b455f72
Removed waiting in travis. This is handled by docker-compose conditions
J12934 Feb 1, 2019
407d5da
Run tests against latest docker tags if build refers to master
J12934 Feb 1, 2019
ec5dc9e
Corrected condition
J12934 Feb 1, 2019
1d589e7
Run tests against both develop and latest tag
J12934 Feb 1, 2019
61c2cc8
Force exit so test dont hang if failed
J12934 Feb 1, 2019
7cc799d
Disable latest tag
J12934 Feb 1, 2019
6b421b7
Removed wait-for-it script from gitignore as it isnt required anymore
J12934 Feb 1, 2019
f73b61b
Log basic docker information after failure to help debugging build fa…
J12934 Feb 1, 2019
aa3ae29
Log all container logs
J12934 Feb 1, 2019
7e453d7
Merge pull request #63 from secureCodeBox/feature/integration-test
J12934 Feb 13, 2019
131d52d
Updated expected TLSv1 severity
J12934 Feb 13, 2019
a5d958e
Updated expected severity assertion
J12934 Feb 13, 2019
0482905
Disabled defectdojo integration by default
J12934 Feb 13, 2019
1999b0c
Set default admin user to false to force user setup screen
J12934 Feb 13, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,25 @@ CAMUNDADB_DATABASE=camundadb
CAMUNDADB_ROOT_PW=root
CAMUNDADB_USER=camunda
CAMUNDADB_PW=secret

ENGINE_SCANNERSERVICES_USER=defaultScanner
ENGINE_SCANNERSERVICES_PASSWORD=scan

DEFECT_DOJO_API_KEY=your-defect-dojo-api-key-here

# Default Image Tag. Latest will always be the most recent stable release.
DEFAULT_TAG=latest

# Enabling the Persistence Providers inside then Engine Container
# Even when they are disabled here they might still be started (depending on the way you start your compose stack)
# This flag just changes if the engine writes results into the providers
ENABLE_ELASTICSEARCH=true
# DefectDojo integration is currently disabled by default
# This is planned to change with release 1.1
ENABLE_DEFECT_DOJO=false

# Admin User Configuration
# By default you will be asked to set the admin password on first login.
# It can be set automatically by filling the following env vars.
CAMUNDA_BPM_ADMIN_USER_ID=false
CAMUNDA_BPM_ADMIN_USER_PASSWORD=
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
**.iml
.DS_Store
.DS_Store
.idea
37 changes: 37 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
language: node_js
node_js:
- '10'
services:
- docker
env:
# - DEFAULT_TAG=latest
- DEFAULT_TAG=develop
script:
- cp test/.env.test .env
- docker-compose -f docker-compose.yml -f docker-compose.demo.yml up -d engine camundadb bodgeit juice-shop nginx scanner-infrastructure-nmap scanner-webapplication-arachni scanner-webapplication-zap scanner-infrastructure-amass scanner-webapplication-sslyze scanner-webserver-nikto
- cd test
- npm ci
- npm test -- --verbose --forceExit
after_failure:
- docker ps -a
- echo -en "travis_fold:start:EngineLogs\r"
- docker logs securecodebox_engine_1
- echo -en "travis_fold:end:EngineLogs\r"
- echo -en "travis_fold:start:ZapLogs\r"
- docker logs securecodebox_scanner-webapplication-zap_1
- echo -en "travis_fold:end:ZapLogs\r"
- echo -en "travis_fold:start:ArachniLogs\r"
- docker logs securecodebox_scanner-webapplication-arachni_1
- echo -en "travis_fold:end:ArachniLogs\r"
- echo -en "travis_fold:start:AmassLogs\r"
- docker logs securecodebox_scanner-infrastructure-amass_1
- echo -en "travis_fold:end:AmassLogs\r"
- echo -en "travis_fold:start:NmapLogs\r"
- docker logs securecodebox_scanner-infrastructure-nmap_1
- echo -en "travis_fold:end:NmapLogs\r"
- echo -en "travis_fold:start:SSLyzeLogs\r"
- docker logs securecodebox_scanner-webapplication-sslyze_1
- echo -en "travis_fold:end:SSLyzeLogs\r"
- echo -en "travis_fold:start:NiktoLogs\r"
- docker logs securecodebox_scanner-webserver-nikto_1
- echo -en "travis_fold:end:NiktoLogs\r"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Running `docker-compose up` uses the default credentials specified in the [`.env
* `CAMUNDADB_ROOT_PW` MySQL root password
* `CAMUNDADB_USER` MySQL username used by the Camunda Engine
* `CAMUNDADB_PW` MySQL password also used by the Camunda Engine
* `ENGINE_SCANNERSERVICES_USER` Technical user for the scanner services to access the engines API
* `ENGINE_SCANNERSERVICES_PASSWORD` Technical users password for the scanner services to access the engines API

### Run your first security scan
There are several ways to start a security scan with the secureCodeBox. One way is to use the WebUI of the engine and start the scan manually.
Expand Down
5 changes: 5 additions & 0 deletions cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!*.template.json
!README.html
!run_scanner.sh
!.gitignore
72 changes: 43 additions & 29 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,74 @@
This directory contains tools for executing SCB functions inside a Bash shell.

## run_scanner.sh

Syntax: `./run_scanner.sh [options] scanner target`
Runs a scanner and stores findings on disk. Helpful for use in combination with Continuous integration software like Jenkins, Bamboo, etc. The following scanners (`scanner` parameter) and variants are currently supported:
* Arachni (`arachni`)
* Nikto (`nikto`)
* NMAP (`nmap`)
* NMAP, raw results (`nmap-raw`)
* Combined NMAP, Nikto (`nmap-nikto`)
* SSLyze (`sslyze`)
* Zed Attack Proxy (`zap`)

- Arachni (`arachni`)
- Nikto (`nikto`)
- NMAP (`nmap`)
- Combined NMAP, Nikto (`nmap-nikto`)
- SSLyze (`sslyze`)
- Zed Attack Proxy (`zap`)

### Simple example

A simple call looks like this:
`./run_scanner.sh sslyze example.com:443`

This call queries the local SCB instance (expected to run on `http://localhost:8080`) to start the SSLyze scanner for the host `example.com` on port `443`. Afterwards it repeatedly queries the local Elasticsearch engine (expected to run on `http://localhost:9200`) until scan results (findings) have been received and their number has been verified. It performs a maximum of `30` queries to Elasticsearch where it waits for `60` seconds between each query operation.
This call queries the local SCB instance (expected to run on `http://localhost:8080`) to start the SSLyze securityTest for the host `example.com` on port `443`. Afterwards it repeatedly polls the status of the started securityTest via the secureCodeBox Engine API untill the securityTest is finished. It performs a maximum of `180` api calls where it waits for `5` seconds between each call.

### Complex example

A more elaborate call could look like this:
`./run_scanner.sh --backend http://scb_engine:8080 http://es_engine:9200 --auth a2VybWl0OmE= --max_iter 10 --wait 20 --tenant mytenant zap http://www.example.com/shop`
`./run_scanner.sh --backend http://scb_engine:8080 --auth kermit:myPassword --max_iter 10 --wait 20 --context feature-team-3 zap http://www.example.com/shop`

This call executes the remote SCB instance on `http://scb_engine:8080` to start the OWASP Zed Attack Proxy for the URL `http://www.example.com/shop`. An HTTP Basic authentication is performed with header value `a2VybWl0OmE=`. Afterwards it queries the Elasticsearch engine on `http://es_engine:9200` for findings. It performs a maximum of `10` queries to Elasticsearch and waits for `20` seconds between each query operation. All operations are performed on the `mytenant` tenant.
This call executes the remote SCB instance on `http://scb_engine:8080` to start the OWASP Zed Attack Proxy for the URL `http://www.example.com/shop`. For all with the secureCodeBox Engine the HTTP Basic authentication credentials "kermit:myPassword" are used. It performs a maximum of `10` api calls and waits for `20` seconds between each call. Depending on the configured persistence provider of the secureCodeBox Engine instance the context will be used to isolate the results so that they are only accessible by members of `feature-team-3`.

### Mandatory parameters

`./run_scanner.sh scanner target`
The script expects to receive at least two arguments `scanner` and `target`,
* `scanner`: SCB scan engine to run the test on
* `target`: Target hostname / IP address / URI to scan

- `scanner`: SCB scan engine to run the test on
- `target`: Target hostname / IP address / URI to scan

While some scanners require the scan target to have a specific format (URI, hostname, hostname and port, etc.) the `run_scanner.sh` script is able to automatically transform the given argument to match the required format. Thus, it is safe to always pass a target URI, like for example `http://www.example:8080/some/path`, regardless of the scanner to use.

### Optional parameters

The following optional parameters may be passed:
* `--help`: Displays a help page
* `--auth`: HTTP Basic authentication string
* `--max-iter`: Maximum number of Elasticsearch queries to perform
* `--tenant`: SCB/Elasticsearch tenant to address
* `--wait`: Number of seconds to wait between Elasticsearch queries

- `--help`: Displays a help page
- `--auth`: HTTP Basic authentication string
- `--max-iter`: Maximum number of api call to perform while polling
- `--wait`: Number of seconds to wait between api calls
- `--context`: SCB context to use
- `--name`: Target name, to identify the target later. This can be helpfull when the url is temporary and cant later be traced to a specific service / team.

### In Depth Configuration of securityTests

More involved security Tests require tweaking of the target attributes to configure the security scanner correctly. To give you full controll over the securityTest configuration you can use the `--payload` argument to provide a link to a custom json payload. For examples check out the [usage examples in out user-guide](https://github.com/secureCodeBox/secureCodeBox/blob/master/docs/user-guide/README.md#in-depth-scan-examples).

### Data files

During execution the script generates some files that are all stored in the working directory. When called it renames old data files from the previous run that facilitated the same tenant and scanner: The file extension `.last` is appended to each filename. The script then creates the following data files:
* `job_[TENANT]_[SCANNER]_payload.json` is the JSON payload which is sent to the SCB engine in order to start the scan.
* `job_[TENANT]_[SCANNER]_result.json` contains JSON data of all findings returned by Elasticsearch.
* `job_[TENANT]_[SCANNER]_result.readable` contains all findings returned by Elasticsearch. The contents are said to be somewhat more readable than their JSON counterpart.
* `job_[TENANT]_[SCANNER].log` contains the console output of the script

- `job_[SCANNER]_payload.json` is the JSON payload which is sent to the SCB engine in order to start the scan.
- `job_[SCANNER]_result.json` contains JSON data of all findings returned by Elasticsearch.
- `job_[SCANNER].log` contains the console output of the script

Filenames consist of the following dynamic parts:
* `[TENANT]` corresponds to the value passed to the `--tenant` parameter and
* `[SCANNER]` corresponds to the scanner used.

- `[SCANNER]` corresponds to the scanner used.

### Template files
The file `job_[TENANT]_[SCANNER]_payload.json` is generated by replacing the following variables in the corresponding the template file `[SCANNER].template.json`:
* `%TENANT%`: Tenant, as given; e.g. `mytenant`
* `%TARGET%`: Scan target, as given; e.g. `http://www.example.com:8080/shop`
* `%HOST_PORT%` Scan target, hostname and port number; e.g. `www.example.com:8080`
* `%HOST%`: Scan target, hostname; e.g. `www.example.com`
* `%PORT%`: Scan target, port number: e.g. `8080`

The file `job_[SCANNER]_payload.json` is generated by replacing the following variables in the corresponding the template file `[SCANNER].template.json`:

- `%TENANT%`: Tenant, as given; e.g. `mytenant`
- `%TARGET%`: Scan target, as given; e.g. `http://www.example.com:8080/shop`
- `%HOST_PORT%` Scan target, hostname and port number; e.g. `www.example.com:8080`
- `%HOST%`: Scan target, hostname; e.g. `www.example.com`
- `%PORT%`: Scan target, port number: e.g. `8080`
13 changes: 8 additions & 5 deletions cli/arachni.template.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[
{
"name" : "Target",
"location" : "%TARGET%"
}
{
"context": "%CONTEXT%",
"name": "arachni",
"target": {
"location": "%HOST%",
"name": "%TARGET_NAME%"
}
}
]

16 changes: 8 additions & 8 deletions cli/nikto.template.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[
{
"name" : "Target",
"location" : "%HOST%",
"attributes" : {
"NIKTO_PORTS" : "%PORT%"
}
}
{
"context": "%CONTEXT%",
"name": "nikto",
"target": {
"location": "%HOST%",
"name": "%TARGET_NAME%"
}
}
]

13 changes: 8 additions & 5 deletions cli/nmap-nikto.template.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[
{
"name" : "Target",
"location" : "%HOST%"
}
{
"context": "%CONTEXT%",
"name": "nmap-nikto",
"target": {
"location": "%HOST%",
"name": "%TARGET_NAME%"
}
}
]

7 changes: 0 additions & 7 deletions cli/nmap-raw.template.json

This file was deleted.

13 changes: 8 additions & 5 deletions cli/nmap.template.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[
{
"name" : "Target",
"location" : "%HOST%"
}
{
"context": "%CONTEXT%",
"name": "nmap",
"target": {
"location": "%HOST%",
"name": "%TARGET_NAME%"
}
}
]

Loading