Instant PHP eval

Here is the code you get a form with, you can submit php code, it gets evaluated on the server.
SECURITY WARNING: command(s) below will be all executed in PHP’s server context! Deny public acces.

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>PHP evaluator</title>
    </head>
    <body>
        <div>
            <?php
            $function = "eval";
            $arguments = "return true";
            if ($_SERVER['REQUEST_METHOD'] == "POST") {
                $result = null;
                $function = $_POST["function"];
                $arguments = $_POST["arguments"];
                switch ($function) {
                    case "eval":
                        $result = eval($arguments . ";");
                        break;
                    default:
                        $result = $function($arguments);
                }
                echo "<hr/>";
                var_dump($result);
                echo "<hr/>";
                print_r($result);
                echo "<hr/>";
                echo($result);
            }
            ?>
        </div>
        <hr>
        SECURITY WARNING: command(s) below will be all executed in PHP's server context! Deny public acces.
        <form method="POST">
            <textarea name="arguments" style="width: 600px; height:200px"><?php echo $arguments ?></textarea>
            <br/>
            Function: <input type="text" name="function" value="<?php echo $function ?>" />
            <button>EXECUTE</button>
        </form>
    </body>
</html>
Views: 500
Bookmark and Share
This entry was posted in Hacks. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. Posted 2012.02.01. at 14:13 | Permalink
  2. Posted 2012.02.01. at 14:13 | Permalink
  3. Posted 2012.02.01. at 14:14 | Permalink

Post a Comment

Your email is never published nor shared.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>