Skip to content

Commit c6c1414

Browse files
committed
docs
1 parent 4736720 commit c6c1414

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

documentation/modules/auxiliary/gather/jenkins_cli_ampersand_arbitrary_file_read.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
## Vulnerable Application
22

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
435

536
Vulnerable versions include:
637

0 commit comments

Comments
 (0)