Guest User

Untitled

a guest
Dec 20th, 2024
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | Source Code | 0 0
  1. <?php
  2.  
  3. function filterStr($hex) {
  4.     $str = "?php\n";
  5.     $str .= hex2bin($hex); // decode hex payload
  6.     return $str . "?";
  7. }
  8.  
  9. function randomGifFile() {
  10.     return sys_get_temp_dir() . "/" . "secret-php-gif-script"; // found and created file destination in temp directory
  11. }
  12.  
  13. // Exits if no parameters sent
  14. //if (!isset($_GET["id"]) || !isset($_POST["ftp"])) {
  15. //    die; // if neither paramter found, exit
  16. //}
  17.  
  18. $a = array(1 => "userName");
  19. $b =& $a[1];
  20. $c = $a; // how does $c change $a?
  21. $c["1"] = "6563686f282764656f6266757363617465642729"; // safe mimic payload, just echoes 'deobfuscated'
  22.  
  23.  
  24. $fileName = randomGifFile() . ".gif";
  25. file_put_contents($fileName, "" . "<" . filterStr($a[1]) . ">");
  26.  
  27. if (file_exists($fileName)) {
  28.     require_once $fileName; // executes decoded payload if file found
  29. }
  30.  
  31. @unlink($fileName); // delete payload
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment