refactor(dynamic): enhance framework bindings with SSA receiver type checks, add tests for Laravel, Symfony, Rabbit, Kafka, and Pub/Sub

This commit is contained in:
elipeter 2026-05-23 14:32:48 -05:00
parent aaa1fd7ede
commit 17fa611b63
17 changed files with 1255 additions and 167 deletions

View file

@ -1,8 +1,33 @@
<?php
// Phase 16 — CodeIgniter-style route, benign sanitised payload.
namespace CodeIgniter\Router {
class RouteCollection
{
}
}
namespace {
use CodeIgniter\Router\RouteCollection;
class BaseController
{
}
class NyxRoutes extends RouteCollection
{
public function get(string $path, string $callable)
{
$GLOBALS['__nyx_route'] = function (string $payload) use ($callable) {
[$class, $method] = explode('::', $callable, 2);
$controller = new $class();
return $controller->$method($payload);
};
return $this;
}
}
$routes = new NyxRoutes();
$routes->get('run', 'UserController::run');
class UserController extends BaseController
@ -10,9 +35,10 @@ class UserController extends BaseController
public function run($payload)
{
echo "__NYX_SINK_HIT__\n";
$cmd = "echo hello " . escapeshellarg($payload);
$cmd = "true " . escapeshellarg($payload);
$out = shell_exec($cmd);
echo $out;
return $out;
}
}
}

View file

@ -3,8 +3,33 @@
// `$routes->get('run', 'UserController::run')` references the
// controller method whose body shells out without sanitisation.
namespace CodeIgniter\Router {
class RouteCollection
{
}
}
namespace {
use CodeIgniter\Router\RouteCollection;
class BaseController
{
}
class NyxRoutes extends RouteCollection
{
public function get(string $path, string $callable)
{
$GLOBALS['__nyx_route'] = function (string $payload) use ($callable) {
[$class, $method] = explode('::', $callable, 2);
$controller = new $class();
return $controller->$method($payload);
};
return $this;
}
}
$routes = new NyxRoutes();
$routes->get('run', 'UserController::run');
class UserController extends BaseController
@ -18,3 +43,4 @@ class UserController extends BaseController
return $out;
}
}
}

View file

@ -1,6 +1,27 @@
<?php
// Phase 16 — Laravel-style route, benign sanitised payload.
namespace Illuminate\Support\Facades {
class Route
{
public static function get(string $path, string $callable)
{
$GLOBALS['__nyx_route'] = function (string $payload) use ($callable) {
[$class, $method] = preg_split('/@|::/', $callable);
$controller = new $class();
return $controller->$method($payload);
};
return new class {
public function middleware($value)
{
return $this;
}
};
}
}
}
namespace {
use Illuminate\Support\Facades\Route;
Route::get('/run', 'UserController@run');
@ -10,9 +31,10 @@ class UserController
public function run($payload)
{
echo "__NYX_SINK_HIT__\n";
$cmd = "echo hello " . escapeshellarg($payload);
$cmd = "true " . escapeshellarg($payload);
$out = shell_exec($cmd);
echo $out;
return $out;
}
}
}

View file

@ -3,6 +3,27 @@
// `Route::get('/run', 'UserController@run')` references the
// controller method whose body shells out without sanitisation.
namespace Illuminate\Support\Facades {
class Route
{
public static function get(string $path, string $callable)
{
$GLOBALS['__nyx_route'] = function (string $payload) use ($callable) {
[$class, $method] = preg_split('/@|::/', $callable);
$controller = new $class();
return $controller->$method($payload);
};
return new class {
public function middleware($value)
{
return $this;
}
};
}
}
}
namespace {
use Illuminate\Support\Facades\Route;
Route::get('/run', 'UserController@run');
@ -18,3 +39,4 @@ class UserController
return $out;
}
}
}

View file

@ -2,7 +2,31 @@
// Phase 16 — Symfony-style route via `#[Route]` attribute,
// benign sanitised payload.
namespace App\Controller;
namespace Symfony\Component\HttpFoundation {
class Response
{
public function __construct(private string $content)
{
}
public function __toString(): string
{
return $this->content;
}
}
}
namespace Symfony\Component\Routing\Annotation {
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::TARGET_FUNCTION)]
class Route
{
public function __construct(...$args)
{
}
}
}
namespace App\Controller {
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
@ -13,9 +37,12 @@ class UserController
public function run($payload)
{
echo "__NYX_SINK_HIT__\n";
$cmd = "echo hello " . escapeshellarg($payload);
$cmd = "true " . escapeshellarg($payload);
$out = shell_exec($cmd);
echo $out;
return new Response($out);
}
}
$GLOBALS['__nyx_controller'] = new UserController();
}

View file

@ -2,7 +2,31 @@
// Phase 16 — Symfony-style route via `#[Route]` attribute,
// vulnerable.
namespace App\Controller;
namespace Symfony\Component\HttpFoundation {
class Response
{
public function __construct(private string $content)
{
}
public function __toString(): string
{
return $this->content;
}
}
}
namespace Symfony\Component\Routing\Annotation {
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::TARGET_FUNCTION)]
class Route
{
public function __construct(...$args)
{
}
}
}
namespace App\Controller {
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
@ -19,3 +43,6 @@ class UserController
return new Response($out);
}
}
$GLOBALS['__nyx_controller'] = new UserController();
}