Skip to content

Commit 7143095

Browse files
committed
Land rapid7#6947, add auxiliary/scanner/jenkins/jenkins_udp_broadcast_enum
2 parents 6d094a1 + 312342b commit 7143095

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Jenkins is an open source tool that provides continuous integration services for software
2+
development. This module will attempt to find Jenkins servers by performing a UDP
3+
broadcast.
4+
5+
To use this module, you should be on the same network as the Jenkins server(s).
6+
7+
8+
## Verification Steps
9+
10+
To test this module, you must make sure there is at least one Jenkins server on the same network.
11+
To download Jenkins, please follow this link:
12+
13+
[https://jenkins.io/](https://jenkins.io/)
14+
15+
16+
## Options
17+
18+
Unlike most Metasploit modules, jenkins_udp_broadcast_enum does not have any datastore options
19+
to configure. So all you have to do is load it, and run, like this:
20+
21+
```
22+
msf auxiliary(jenkins_udp_broadcast_enum) > run
23+
24+
[*] Sending Jenkins UDP Broadcast Probe ...
25+
[*] 192.168.1.96 - Found Jenkins Server 1.638 Version
26+
[*] Auxiliary module execution completed
27+
```
28+
Once you have found the Jenkins server, you should be able to browse to the web server.
29+
And by default, that port is 8080.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class MetasploitModule < Msf::Auxiliary
9+
10+
include Msf::Exploit::Remote::Udp
11+
include Msf::Auxiliary::Report
12+
13+
def initialize(info = {})
14+
super(
15+
update_info(
16+
info,
17+
'Name' => 'Jenkins Server Broadcast Enumeration',
18+
'Description' => %q(
19+
This module sends out a udp broadcast packet querying for
20+
any Jenkins servers on the local network.
21+
Be advised that while this module does not identify the
22+
port on which Jenkins is running, the default port for
23+
Jenkins is 8080.
24+
),
25+
'Author' =>
26+
[
27+
'Adam Compton <[email protected]>',
28+
'Matt Schmidt <[email protected]>'
29+
],
30+
'References' =>
31+
[
32+
[ 'URL', 'https://wiki.jenkins-ci.org/display/JENKINS/Auto-discovering+Jenkins+on+the+network' ]
33+
],
34+
'License' => MSF_LICENSE
35+
)
36+
)
37+
deregister_options('RHOST', 'RPORT')
38+
end
39+
40+
def parse_reply(pkt)
41+
# if empty packet, exit
42+
return unless pkt[1]
43+
44+
# strip to just the IPv4 address
45+
if pkt[1] =~ /^::ffff:/
46+
pkt[1] = pkt[1].sub(/^::ffff:/, '')
47+
end
48+
49+
# check for and extract the version string
50+
ver = pkt[0].scan(/version>(.*)<\/version/i).flatten.first
51+
52+
# if a version was identified, then out and store to DB
53+
if ver
54+
print_status("#{pkt[1]} - Found Jenkins Server #{ver} Version")
55+
report_host(
56+
host: pkt[1],
57+
info: "Jenkins v.#{ver} (port typically 8080)"
58+
)
59+
end
60+
end
61+
62+
def run
63+
print_status('Sending Jenkins UDP Broadcast Probe ...')
64+
65+
udp_sock = connect_udp
66+
67+
udp_sock.sendto('\n', '255.255.255.255', 33848, 0)
68+
69+
# loop a few times to account for multiple or slow responders
70+
iter = 0
71+
while (r = udp_sock.recvfrom(65535, 0.1)) && (iter < 20)
72+
parse_reply(r)
73+
iter += 1
74+
end
75+
end
76+
end

0 commit comments

Comments
 (0)