Created
March 5, 2018 08:30
-
-
Save yehgdotnet/67002a58ba06e0ab0a6974457ffa792f to your computer and use it in GitHub Desktop.
PHP: Arbitrary Function call example
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 | |
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