|
1 | 1 | ## Vulnerable Application
|
2 | 2 |
|
3 |
| -Exploitation by hand can be done by downloading the CLI from the target: `wget http://<host>:8080/jnlpJars/jenkins-cli.jar` |
| 3 | +This module utilizes the Jenkins cli protocol to run the `help` command. |
| 4 | +The cli is accessible with read-only permissions by default, which are |
| 5 | +all thats required. |
| 6 | + |
| 7 | +Jenkins cli utilizes `args4j's` `parseArgument`, which calls `expandAtFiles` to |
| 8 | +replace any `@<filename>` with the contents of a file. We are then able to retrieve |
| 9 | +the error message to read up to the first two lines of a file. |
| 10 | + |
| 11 | +Exploitation by hand can be done with the cli, see markdown documents for additional |
| 12 | +instructions. |
| 13 | + |
| 14 | +There are a few exploitation oddities: |
| 15 | +1. The injection point for the `help` command requires 2 input arguments. |
| 16 | +When the `expandAtFiles` is called, each line of the `FILE_PATH` becomes an input argument. |
| 17 | +If a file only contains one line, it will throw an error: `ERROR: You must authenticate to access this Jenkins.` |
| 18 | +However, we can pad out the content by supplying a first argument. |
| 19 | +2. There is a strange timing requirement where the `download` (or first) request must get |
| 20 | +to the server first, but the `upload` (or second) request must be very close behind it. |
| 21 | +From testing against the docker image, it was found values between `.01` and `1.9` were |
| 22 | +viable. Due to the round trip time of the first request and response happening before |
| 23 | +request 2 would be received, it is necessary to use threading to ensure the requests |
| 24 | +happen within rapid succession. |
| 25 | + |
| 26 | +Files of value: |
| 27 | + |
| 28 | + * /var/jenkins_home/secret.key |
| 29 | + * /var/jenkins_home/secrets/master.key |
| 30 | + * /var/jenkins_home/secrets/initialAdminPassword |
| 31 | + * /etc/passwd |
| 32 | + * /etc/shadow |
| 33 | + * Project secrets and credentials |
| 34 | + * Source code, build artifacts |
4 | 35 |
|
5 | 36 | Vulnerable versions include:
|
6 | 37 |
|
|
0 commit comments