Skip to content

Instantly share code, notes, and snippets.

@yehgdotnet
Created March 5, 2018 08:30
Show Gist options
  • Save yehgdotnet/67002a58ba06e0ab0a6974457ffa792f to your computer and use it in GitHub Desktop.
Save yehgdotnet/67002a58ba06e0ab0a6974457ffa792f to your computer and use it in GitHub Desktop.
PHP: Arbitrary Function call example
<?php
class hacker{
private function secret() {
echo "<h2 style='color:red'>Executed secret or privilaged operations.</h2>";
}
public function test($arg){
${"func"} = $arg;
$this->${"func"}();
}
public function nonsecret(){
echo "<h2 style='color:green'>Executed non-secret or non-privileged operation.</h2>";
}
}
$payload = isset($_GET["func"])?$_GET["func"]:"nonsecret";
$h = new hacker();
$h->test($payload);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment