Skip to content

Commit 4fc0eb0

Browse files
committed
New resource script to check for development-related vulns.
1 parent a293093 commit 4fc0eb0

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed

scripts/resource/dev_checks.rc

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<ruby>
2+
3+
#
4+
# This resource script will check for vulnerabilities related to
5+
# programs and services used by developers, including the following:
6+
#
7+
# * NodeJS debug (multi/misc/nodejs_v8_debugger)
8+
# * distcc (unix/misc/distcc_exe)
9+
# * Jenkins (linux/misc/jenkins_java_deserialize)
10+
# * GitHub Enterprise (linux/http/github_enterprise_secret)
11+
#
12+
# It is worth noting that ONLY CHECKS are performed, no active exploiting.
13+
# This makes it safe to run in many environments.
14+
#
15+
# Author:
16+
# pbarry-r7
17+
#
18+
19+
@job_ids = []
20+
21+
def wait_until_jobs_done
22+
while true
23+
@job_ids.each do |job_id|
24+
current_job_ids = framework.jobs.keys.map { |e| e.to_i }
25+
sleep 1 if current_job_ids.include?(job_id)
26+
end
27+
28+
return
29+
end
30+
end
31+
32+
def check_exploit(host:, mod_name:, vuln_check_ret_val:)
33+
begin
34+
mod = framework.exploits.create(mod_name)
35+
mod.datastore['RHOST'] = host.address
36+
print_line("Looking for #{mod.name}...")
37+
result = mod.check_simple({'RunAsJob': true, 'LocalOutput': self.output})
38+
@job_ids << mod.job_id if mod.job_id
39+
if vuln_check_ret_val.index(result)
40+
print_line("HOST #{host.address} APPEARS VULNERABLE TO #{mod.name}")
41+
framework.db.report_vuln(
42+
workspace: mod.workspace,
43+
host: mod.rhost,
44+
name: mod.name,
45+
info: "This was flagged as likely vulnerable by the explicit check of #{mod.fullname}.",
46+
refs: mod.references
47+
)
48+
end
49+
rescue ::Exception => e
50+
print_error(e.message)
51+
end
52+
end
53+
54+
def setup
55+
# Test and see if we have a database connected
56+
begin
57+
framework.db.hosts
58+
rescue ::ActiveRecord::ConnectionNotEstablished
59+
print_error("Database connection isn't established")
60+
return false
61+
end
62+
63+
run_single("setg verbose true")
64+
65+
true
66+
end
67+
68+
def main
69+
framework.db.workspace.hosts.each do |host|
70+
print_line("Checking IP: #{host.address}, OS: #{host.os_name}...")
71+
72+
check_exploit(host: host,
73+
mod_name: 'multi/misc/nodejs_v8_debugger',
74+
vuln_check_ret_val: [ Exploit::CheckCode::Appears ])
75+
76+
check_exploit(host: host,
77+
mod_name: 'unix/misc/distcc_exec',
78+
vuln_check_ret_val: [ Exploit::CheckCode::Vulnerable ])
79+
80+
check_exploit(host: host,
81+
mod_name: 'unix/misc/qnx_qconn_exec',
82+
vuln_check_ret_val: [ Exploit::CheckCode::Vulnerable ])
83+
84+
check_exploit(host: host,
85+
mod_name: 'linux/misc/jenkins_java_deserialize',
86+
vuln_check_ret_val: [ Exploit::CheckCode::Vulnerable ])
87+
88+
check_exploit(host: host,
89+
mod_name: 'linux/http/github_enterprise_secret',
90+
vuln_check_ret_val: [ Exploit::CheckCode::Vulnerable ])
91+
92+
check_exploit(host: host,
93+
mod_name: 'multi/http/traq_plugin_exec',
94+
vuln_check_ret_val: [ Exploit::CheckCode::Appears ])
95+
96+
check_exploit(host: host,
97+
mod_name: 'multi/http/builderengine_upload_exec',
98+
vuln_check_ret_val: [ Exploit::CheckCode::Appears ])
99+
100+
check_exploit(host: host,
101+
mod_name: 'multi/http/mantisbt_php_exec',
102+
vuln_check_ret_val: [ Exploit::CheckCode::Appears ])
103+
104+
check_exploit(host: host,
105+
mod_name: 'multi/http/vbulletin_unserialize',
106+
vuln_check_ret_val: [ Exploit::CheckCode::Appears ])
107+
108+
check_exploit(host: host,
109+
mod_name: 'unix/webapp/vbulletin_vote_sqli_exec',
110+
vuln_check_ret_val: [ Exploit::CheckCode::Appears ])
111+
end
112+
wait_until_jobs_done
113+
end
114+
115+
abort("Error during setup, exiting.") unless setup
116+
main
117+
118+
</ruby>

0 commit comments

Comments
 (0)