Skip to content

Commit 55b3cf1

Browse files
authored
Merge pull request kaakaww#28 from kaakaww/readme-updates
Readme updates
2 parents 71f8f42 + 61bd14f commit 55b3cf1

File tree

9 files changed

+67
-39
lines changed

9 files changed

+67
-39
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.gradle/
22
.idea/
33
build/
4-
db/
4+
db
55
bin/
66
.classpath
77
.project

README.md

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ docker-compose up -d
2323

2424
### Run
2525
```shell script
26-
java -Djava.security.egd=file:/dev/./urandom -jar build/libs/java-spring-vuly-0.1.0.jar
26+
./gradlew --no-daemon bootRun
2727
```
2828

2929
## Using the Application
@@ -49,7 +49,7 @@ You can log in to the application with the following credentials:
4949
| https://localhost:9000/openapi.yaml | The OpenAPI spec in YAML format |
5050
| https://localhost:9000/swagger-ui.html | The Swagger doc for the OpenAPI spec |
5151

52-
## Scanning
52+
### Security Bugs
5353

5454
A [ZAP](https://www.zaproxy.org/) or [StackHawk](https://www.stackhawk.com/login) scan should uncover these bugs:
5555

@@ -58,58 +58,86 @@ A [ZAP](https://www.zaproxy.org/) or [StackHawk](https://www.stackhawk.com/login
5858
| SQL Injection via search box | `a%'; insert into item values (999, 'bad bad description', 'hacker item name'); select * from item where name like '%banan` |
5959
| Cross Site Scripting via search box | `<script>alert('hey guy');</script>` |
6060

61-
### StackHawk Scan
61+
## Scanning
6262

63-
The following examples will run HawkScan against the JavaSpringVulny app running on localhost and port 9000, which is the default setup. The StackHawk configuration files are already present in this repository.
63+
The following examples will run HawkScan against the JavaSpringVulny app running on localhost and port 9000, which is the default setup. The StackHawk configuration files are already present in this repository in the `stackhawk.d` directory.
6464

6565
You should create a new application in the [StackHawk app](https://app.stackhawk.com/applications) to collect data from these scans. The following environment variables are required for these scans to work:
6666

67-
* `API_KEY`: Your StackHawk API key
68-
* `APP_ID`: The application ID from the [StackHawk app](https://app.stackhawk.com/applications).
67+
* `API_KEY`: Your StackHawk [API key](https://app.stackhawk.com/settings/apikeys)
68+
* `APP_ID`: Your StackHawk [application ID](https://app.stackhawk.com/applications)
69+
70+
For example:
71+
72+
```shell
73+
export API_KEY=<your-StackHawk-API-key>
74+
export APP_ID=<your-StackHawk-App-ID>
75+
```
6976

7077
You can optionally include the following variables to customize the scan.
7178

7279
* `APP_HOST`: The host to scan. Default: https://localhost:9000
73-
* `APP_ENV`: The application environment. Default: Development
80+
* `APP_ENV`: The application environment name.
7481

7582
Baseline scan without authentication:
7683
```shell
84+
# With the CLI
85+
hawk scan stackhawk.d/stackhawk.yml
86+
87+
# With Docker
7788
docker run --tty --rm --network host --volume $(pwd):/hawk \
7889
--env API_KEY \
7990
--env APP_ID \
80-
stackhawk/hawkscan
91+
stackhawk/hawkscan stackhawk.d/stackhawk.yml
8192
```
8293

83-
Scan using web form authentication with a session cookie. [See the docs](https://docs.stackhawk.com/hawkscan/configuration/authenticated-scanning.html#example-usernamepassword-authentication--cookie-authorization) for more information.
94+
Scan using web form authentication with a session cookie. [See the docs](https://docs.stackhawk.com/hawkscan/authenticated-scanning/form-based-authentication.html#example-form-with-http-parameters-with-cookie-authorization) for more information.
8495
```shell
96+
# With the CLI
97+
hawk scan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-form-cookie.yml
98+
99+
# With Docker
85100
docker run --tty --rm --network host --volume $(pwd):/hawk \
86101
--env API_KEY \
87102
--env APP_ID \
88-
stackhawk/hawkscan stackhawk.yml stackhawk.d/stackhawk-auth-form-cookie.yml
103+
stackhawk/hawkscan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-form-cookie.yml
89104
```
90105

91-
Scan using an authorization token retrieved by POSTing credentials to an API endpoint. [See the docs](https://docs.stackhawk.com/hawkscan/configuration/authenticated-scanning.html#usernamepassword-authentication--bearer-token-authorization) for more information.
106+
Scan using an authorization token retrieved by POSTing credentials to an API endpoint. [See the docs](https://docs.stackhawk.com/hawkscan/authenticated-scanning/form-based-authentication.html#example-form-with-api-call--json-payload-with-token-authorization) for more information.
92107
```shell
108+
# With the CLI
109+
hawk scan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-json-token.yml
110+
111+
# With Docker
93112
docker run --tty --rm --network host --volume $(pwd):/hawk \
94113
--env API_KEY \
95114
--env APP_ID \
96-
stackhawk/hawkscan stackhawk.yml stackhawk.d/stackhawk-auth-json-token.yml
115+
stackhawk/hawkscan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-json-token.yml
97116
```
98117

99-
Scan using an authorization token extracted by an external script. This method can be useful for third-party authentication systems. [See the docs](https://docs.stackhawk.com/hawkscan/configuration/authenticated-scanning.html#example-external-token-authentication--custom-token-authorization) for more information.
118+
Scan using an authorization token extracted by an external script. This method can be useful for third-party authentication systems. [See the docs](https://docs.stackhawk.com/hawkscan/authenticated-scanning/inject-cookies-and-tokens.html#injecting-a-token) for more information.
100119
```shell
120+
# With the CLI
121+
hawk scan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-external-token.yml
122+
123+
# With Docker
101124
docker run --tty --rm --network host --volume $(pwd):/hawk \
102125
--env API_KEY \
103126
--env APP_ID \
104-
stackhawk/hawkscan stackhawk.yml stackhawk.d/stackhawk-auth-external-token.yml
127+
stackhawk/hawkscan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-external-token.yml
105128
```
106129

107-
Scan using basic authentication, using an external script to derive the correct authorization token. This legacy method is an insecure form of bearer token authentication. [See the docs](https://docs.stackhawk.com/hawkscan/configuration/authenticated-scanning.html#example-external-token-authentication--custom-token-authorization) for more information.
130+
Scan using basic authentication, using an external script to derive the correct authorization token. This legacy method is an insecure form of bearer token authentication. [See the docs](https://docs.stackhawk.com/hawkscan/authenticated-scanning/inject-cookies-and-tokens.html#injecting-a-token) for more information.
108131
```shell
132+
# With the CLI
133+
export AUTH_TOKEN=$(./scripts/basic-auth.sh)
134+
hawk scan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-basic.yml
135+
136+
# With Docker
109137
export AUTH_TOKEN=$(./scripts/basic-auth.sh)
110138
docker run --tty --rm --network host --volume $(pwd):/hawk \
111139
--env API_KEY \
112140
--env APP_ID \
113141
--env AUTH_TOKEN \
114-
stackhawk/hawkscan stackhawk.yml stackhawk.d/stackhawk-auth-basic.yml
142+
stackhawk/hawkscan stackhawk.d/stackhawk.yml stackhawk.d/stackhawk-auth-basic.yml
115143
```

db/vulny.mv.db

-20 KB
Binary file not shown.

stackhawk.d/stackhawk-auth-basic.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
app:
2+
env: ${APP_ENV:Basic Web Auth}
23
authentication:
34
external:
45
type: TOKEN
@@ -11,5 +12,3 @@ app:
1112
path: /api/basic/items/search/1
1213
success: ".*200.*"
1314
requestMethod: GET
14-
loggedInIndicator: "Sign Out"
15-
loggedOutIndicator: "wubba lubba dub dub"

stackhawk.d/stackhawk-auth-external-jwt.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
app:
2-
env: External Token
3-
api: /openapi
2+
env: ${APP_ENV:JWT Bearer Token}
3+
openApiConf:
4+
path: /openapi
45
authentication:
56
external:
67
type: TOKEN
@@ -12,8 +13,6 @@ app:
1213
testPath:
1314
path: /api/jwt/items/search/
1415
success: ".*200.*"
15-
loggedInIndicator: "Sign Out"
16-
loggedOutIndicator: "wubba lubba dub dub"
1716

1817
hawk:
1918
spider:

stackhawk.d/stackhawk-auth-external-token.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
app:
2-
env: External Token
3-
api: /openapi
2+
env: ${APP_ENV:External Token}
3+
openApiConf:
4+
path: /openapi
45
authentication:
56
external:
67
type: TOKEN
@@ -11,8 +12,6 @@ app:
1112
testPath:
1213
path: /api/token/items/search/1
1314
success: ".*200.*"
14-
loggedInIndicator: "Sign Out"
15-
loggedOutIndicator: "wubba lubba dub dub"
1615

1716
hawk:
1817
spider:

stackhawk.d/stackhawk-auth-form-cookie.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
app:
2-
env: Form Cookie
2+
env: ${APP_ENV:Form Cookie}
33
excludePaths:
44
- "/logout"
55
antiCsrfParam: "_csrf"
@@ -18,5 +18,5 @@ app:
1818
testPath:
1919
path: /search
2020
success: ".*200.*"
21-
loggedInIndicator: "Sign Out"
22-
loggedOutIndicator: "wubba lubba dub dub"
21+
loggedInIndicator: "\\QSign Out\\E"
22+
loggedOutIndicator: ".*Location:.*/login.*"
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
app:
2-
env: JSON Token
3-
api: /openapi
2+
env: ${APP_ENV:JSON Token}
3+
excludePaths:
4+
- "/logout"
5+
openApiConf:
6+
path: /openapi
47
authentication:
58
usernamePassword:
69
type: JSON
@@ -17,11 +20,7 @@ app:
1720
value: Authorization
1821
tokenType: Bearer
1922
testPath:
20-
path: /api/jwt/items/search/
23+
path: /api/jwt/items/search/i
2124
success: ".*200.*"
22-
loggedInIndicator: "Sign Out"
23-
loggedOutIndicator: "wubba lubba dub dub"
24-
25-
hawk:
26-
spider:
27-
base: false
25+
loggedInIndicator: "\\QSign Out\\E"
26+
loggedOutIndicator: ".*Location:.*/login.*"

stackhawk.d/stackhawk.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
app:
2+
applicationId: ${APP_ID:dacc7d3e-babc-47d2-b040-ab117ab04526}
3+
env: ${APP_ENV:dev}
4+
host: ${APP_HOST:https://localhost:9000}

0 commit comments

Comments
 (0)