Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/spec/support/acceptance/session/php.rb
31424 views
1
require_relative './shared'
2
3
module Acceptance::Session::Php
4
PHP_METERPRETER = {
5
payloads: [
6
{
7
name: "php/meterpreter_reverse_tcp",
8
extension: ".php",
9
platforms: [:osx, :linux, :windows],
10
execute_cmd: ["php", "${payload_path}"],
11
generate_options: {
12
'-f': "raw"
13
},
14
datastore: {
15
global: {},
16
module: {
17
MeterpreterDebugBuild: true
18
}
19
}
20
}
21
],
22
module_tests: [
23
{
24
name: "post/test/services",
25
platforms: [
26
[
27
:linux,
28
{
29
skip: true,
30
reason: "Windows only test"
31
}
32
],
33
[
34
:osx,
35
{
36
skip: true,
37
reason: "Windows only test"
38
}
39
],
40
[
41
:windows,
42
{
43
skip: [
44
:meterpreter_runtime_version,
45
:==,
46
"php5.3"
47
],
48
reason: "Skip PHP 5.3 as the tests timeout - due to cmd_exec taking 15 seconds for each call. Caused by failure to detect feof correctly - https://github.com/rapid7/metasploit-payloads/blame/c7f7bc2fc0b86e17c3bc078149c71745c5e478b3/php/meterpreter/meterpreter.php#L1127-L1145"
49
}
50
]
51
],
52
skipped: false,
53
lines: {
54
linux: {
55
known_failures: []
56
},
57
osx: {
58
known_failures: []
59
},
60
windows: {
61
known_failures: []
62
}
63
}
64
},
65
{
66
name: "post/test/cmd_exec",
67
platforms: [:linux, :osx, :windows],
68
skipped: false,
69
lines: {
70
linux: {
71
known_failures: []
72
},
73
osx: {
74
known_failures: []
75
},
76
windows: {
77
known_failures: [
78
]
79
}
80
}
81
},
82
{
83
name: "post/test/extapi",
84
platforms: [:linux, :osx, :windows],
85
skipped: false,
86
lines: {
87
linux: {
88
known_failures: []
89
},
90
osx: {
91
known_failures: []
92
},
93
windows: {
94
known_failures: []
95
}
96
}
97
},
98
{
99
name: "post/test/file",
100
platforms: [:linux, :osx, :windows],
101
skipped: false,
102
lines: {
103
linux: {
104
known_failures: [
105
"[-] FAILED: should read the binary data we just wrote"
106
]
107
},
108
osx: {
109
known_failures: [
110
"[-] FAILED: should read the binary data we just wrote"
111
]
112
},
113
windows: {
114
known_failures: [
115
"[-] [should delete a symbolic link target] FAILED: should delete a symbolic link target",
116
"[-] [should delete a symbolic link target] Exception: Rex::Post::Meterpreter::RequestError: stdapi_fs_delete_dir: Operation failed: 1",
117
"[-] FAILED: should read the binary data we just wrote"
118
]
119
}
120
}
121
},
122
{
123
name: "post/test/get_env",
124
platforms: [:linux, :osx, :windows],
125
skipped: false,
126
lines: {
127
linux: {
128
known_failures: []
129
},
130
osx: {
131
known_failures: []
132
},
133
windows: {
134
known_failures: []
135
}
136
}
137
},
138
{
139
name: "post/test/meterpreter",
140
platforms: [:linux, :osx, :windows],
141
skipped: false,
142
lines: {
143
linux: {
144
known_failures: []
145
},
146
osx: {
147
known_failures: [
148
"[-] FAILED: should return a list of processes"
149
]
150
},
151
windows: {
152
known_failures: []
153
}
154
}
155
},
156
{
157
name: "post/test/railgun",
158
platforms: [:linux, :osx, :windows],
159
skipped: false,
160
lines: {
161
linux: {
162
known_failures: []
163
},
164
osx: {
165
known_failures: []
166
},
167
windows: {
168
known_failures: []
169
}
170
}
171
},
172
{
173
name: "post/test/railgun_reverse_lookups",
174
platforms: [:linux, :osx, :windows],
175
skipped: false,
176
lines: {
177
linux: {
178
known_failures: []
179
},
180
osx: {
181
known_failures: []
182
},
183
windows: {
184
known_failures: []
185
}
186
}
187
},
188
{
189
name: "post/test/registry",
190
platforms: [
191
[
192
:linux,
193
{
194
skip: true,
195
reason: "Windows only test"
196
}
197
],
198
[
199
:osx,
200
{
201
skip: true,
202
reason: "Windows only test"
203
}
204
],
205
[
206
:windows,
207
{
208
skip: [
209
:meterpreter_runtime_version,
210
:==,
211
"php5.3"
212
],
213
reason: "Skip PHP 5.3 as the tests timeout - due to cmd_exec taking 15 seconds for each call. Caused by failure to detect feof correctly - https://github.com/rapid7/metasploit-payloads/blame/c7f7bc2fc0b86e17c3bc078149c71745c5e478b3/php/meterpreter/meterpreter.php#L1127-L1145"
214
}
215
]
216
],
217
skipped: false,
218
lines: {
219
linux: {
220
known_failures: []
221
},
222
osx: {
223
known_failures: []
224
},
225
windows: {
226
known_failures: []
227
}
228
}
229
},
230
{
231
name: "post/test/search",
232
platforms: [:linux, :osx, :windows],
233
skipped: false,
234
lines: {
235
linux: {
236
known_failures: []
237
},
238
osx: {
239
known_failures: []
240
},
241
windows: {
242
known_failures: []
243
}
244
}
245
},
246
{
247
name: "post/test/socket_channels",
248
platforms: [:linux, :osx, :windows],
249
skipped: false,
250
lines: {
251
linux: {
252
known_failures: [
253
"[-] [[TCP-Server] Allows binding to port 0] FAILED: [TCP-Server] Allows binding to port 0",
254
"[-] [[TCP-Server] Allows binding to port 0] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
255
"[-] [[TCP-Server] Accepts a connection] FAILED: [TCP-Server] Accepts a connection",
256
"[-] [[TCP-Server] Accepts a connection] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
257
"[-] [[TCP-Server] Has the correct peer information] FAILED: [TCP-Server] Has the correct peer information",
258
"[-] [[TCP-Server] Has the correct peer information] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
259
"[-] [[TCP-Server] Receives data from the peer] FAILED: [TCP-Server] Receives data from the peer",
260
"[-] [[TCP-Server] Receives data from the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
261
"[-] [[TCP-Server] Sends data to the peer] FAILED: [TCP-Server] Sends data to the peer",
262
"[-] [[TCP-Server] Sends data to the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
263
"[-] [[TCP-Server] Propagates close events to the server] FAILED: [TCP-Server] Propagates close events to the server",
264
"[-] [[TCP-Server] Propagates close events to the server] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
265
"[-] [[TCP-Server] Propagates close events to the peer] FAILED: [TCP-Server] Propagates close events to the peer",
266
"[-] [[TCP-Server] Propagates close events to the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
267
"[-] [[TCP-Server] Propagates close events from the peer] FAILED: [TCP-Server] Propagates close events from the peer",
268
"[-] [[TCP-Server] Propagates close events from the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
269
"[-] FAILED: [UDP] Has the correct peer information",
270
*Acceptance::Session::Shared::SOCKET_CHANNEL_FLAKES
271
]
272
},
273
osx: {
274
known_failures: [
275
"[-] [[TCP-Server] Allows binding to port 0] FAILED: [TCP-Server] Allows binding to port 0",
276
"[-] [[TCP-Server] Allows binding to port 0] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
277
"[-] [[TCP-Server] Accepts a connection] FAILED: [TCP-Server] Accepts a connection",
278
"[-] [[TCP-Server] Accepts a connection] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
279
"[-] [[TCP-Server] Has the correct peer information] FAILED: [TCP-Server] Has the correct peer information",
280
"[-] [[TCP-Server] Has the correct peer information] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
281
"[-] [[TCP-Server] Receives data from the peer] FAILED: [TCP-Server] Receives data from the peer",
282
"[-] [[TCP-Server] Receives data from the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
283
"[-] [[TCP-Server] Sends data to the peer] FAILED: [TCP-Server] Sends data to the peer",
284
"[-] [[TCP-Server] Sends data to the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
285
"[-] [[TCP-Server] Propagates close events to the server] FAILED: [TCP-Server] Propagates close events to the server",
286
"[-] [[TCP-Server] Propagates close events to the server] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
287
"[-] [[TCP-Server] Propagates close events to the peer] FAILED: [TCP-Server] Propagates close events to the peer",
288
"[-] [[TCP-Server] Propagates close events to the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
289
"[-] [[TCP-Server] Propagates close events from the peer] FAILED: [TCP-Server] Propagates close events from the peer",
290
"[-] [[TCP-Server] Propagates close events from the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
291
"[-] FAILED: [UDP] Has the correct peer information",
292
*Acceptance::Session::Shared::SOCKET_CHANNEL_FLAKES
293
]
294
},
295
windows: {
296
known_failures: [
297
"[-] [[TCP-Server] Allows binding to port 0] FAILED: [TCP-Server] Allows binding to port 0",
298
"[-] [[TCP-Server] Allows binding to port 0] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
299
"[-] [[TCP-Server] Accepts a connection] FAILED: [TCP-Server] Accepts a connection",
300
"[-] [[TCP-Server] Accepts a connection] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
301
"[-] [[TCP-Server] Has the correct peer information] FAILED: [TCP-Server] Has the correct peer information",
302
"[-] [[TCP-Server] Has the correct peer information] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
303
"[-] [[TCP-Server] Receives data from the peer] FAILED: [TCP-Server] Receives data from the peer",
304
"[-] [[TCP-Server] Receives data from the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
305
"[-] [[TCP-Server] Sends data to the peer] FAILED: [TCP-Server] Sends data to the peer",
306
"[-] [[TCP-Server] Sends data to the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
307
"[-] [[TCP-Server] Propagates close events to the server] FAILED: [TCP-Server] Propagates close events to the server",
308
"[-] [[TCP-Server] Propagates close events to the server] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
309
"[-] [[TCP-Server] Propagates close events to the peer] FAILED: [TCP-Server] Propagates close events to the peer",
310
"[-] [[TCP-Server] Propagates close events to the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
311
"[-] [[TCP-Server] Propagates close events from the peer] FAILED: [TCP-Server] Propagates close events from the peer",
312
"[-] [[TCP-Server] Propagates close events from the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1",
313
"[-] FAILED: [UDP] Has the correct peer information",
314
*Acceptance::Session::Shared::SOCKET_CHANNEL_FLAKES
315
]
316
}
317
}
318
},
319
{
320
name: "post/test/unix",
321
platforms: [
322
:linux,
323
:osx,
324
[
325
:windows,
326
{
327
skip: true,
328
reason: "Unix only test"
329
}
330
]
331
],
332
skipped: false,
333
lines: {
334
linux: {
335
known_failures: []
336
},
337
osx: {
338
known_failures: []
339
},
340
windows: {
341
known_failures: []
342
}
343
}
344
}
345
]
346
}
347
end
348
349