|
1 | 1 | # Vulnerable Java application
|
2 | 2 |
|
3 |
| -This repository contains a sample application, the "Websites Tester Service", that's vulnerable to a [Command Injection](https://owasp.org/www-community/attacks/Command_Injection) and [Server-Side Request Forgery (SSRF)](https://owasp.org/Top10/A10_2021-Server-Side_Request_Forgery_%28SSRF%29/) vulnerability. |
| 3 | +This repository contains a sample application, the "Websites Tester Service", that's vulnerable to a [Command Injection](https://owasp.org/www-community/attacks/Command_Injection) vulnerability. |
4 | 4 |
|
5 | 5 | > **Warning!**
|
6 | 6 | > This application is purposely vulnerable and can trivially be hacked. Don't expose it to the Internet, and don't run it in a production environment.
|
7 | 7 | > Instead, you can run it locally on your machine, or in a cloud environment on a private VPC.
|
8 | 8 |
|
9 | 9 | ## Running locally
|
10 | 10 |
|
11 |
| -1. Build the image locally, or use `ghcr.io/datadog/vulnerable-java-application`: |
| 11 | +1. Build the image locally: |
| 12 | + ``` |
| 13 | + docker build -t vulnerable-java-application:latest . |
| 14 | + ``` |
12 | 15 | 2. Run:
|
13 | 16 | ```
|
14 |
| - docker run --rm -p 8000:8000 ghcr.io/datadog/vulnerable-java-application |
| 17 | + docker run --rm -p 8000:8000 vulnerable-java-application:latest |
15 | 18 | ```
|
16 | 19 | 3. You can then access the web application at <http://127.0.0.1:8000>
|
17 | 20 |
|
18 |
| -## Running on Kubernetes |
19 |
| -
|
20 |
| -``` |
21 |
| -kubectl run vulnerable-application --port=8000 --expose=true --image ghcr.io/datadog/vulnerable-java-application |
22 |
| -kubectl port-forward pod/vulnerable-application 8000 |
23 |
| -``` |
24 |
| -
|
25 |
| -You can then access the web application at <http://127.0.0.1:8000> |
26 |
| -
|
27 | 21 | ## Exploitation
|
28 | 22 |
|
29 |
| -### Server-side request vulnerability |
30 |
| -
|
31 |
| -1. Browse to <http://127.0.0.1:8000/website.html> |
32 |
| -2. Note how the input allows you to specify arbitrary URLs such as `http://google.com`, but also any internal IP such as `http://169.254.169.254/latest/meta-data/` |
33 |
| -3. When the applications is running in AWS, Azure or GCP, this can often be exploited to retrieve instance metadata credentials |
34 |
| -
|
35 |
| -### Command injection vulnerability |
36 |
| -
|
37 | 23 | 1. Browse to <http://127.0.0.1:8000/index.html>
|
38 | 24 | 2. Note how the input allows you to specify domain names such as `google.com` and ping them
|
39 | 25 | 3. Note that there is some level of input validation - entering `$(whoami)` returns `Invalid domain name: $(whoami) - don't try to hack us!`
|
|
0 commit comments