Bugku Variable 1

Source: Internet
Author: User

Topic links

This is a code audit.

Flag in the variable! <?php

error_reporting (0);
Include "flag1.php";
Highlight_file (file);
if (isset ($_get[' args ')) {
$args = $_get[' args '];
if (!preg_match ("/^\w+$/", $args)) {
Die ("args error!");
}
Eval ("Var_dump ($ $args);");
}
?>

Catch two places, one is the regular expression match, does not match the direct die, the regular expression should be match is a string of letters. Then the most critical is the last $ $args, which is the meaning of the mutable variable, such as the value of $args is the variable name of the other variable. Then $ $args represents another variable. So we give args a variable name, then PHP's nine global variables, one for a try.

    • $_post [Data for receiving POST submissions]
    • $_get [parameter data to get URL address bar]
    • $_files [processing img for file handling is the most common]
    • $_cookie [used to get the name value in Setcookie ()]
    • $_session [for storing the value of the session or getting the value in session]
    • $_request [with get,post function, but slower]
    • Server[is one of the predefined server variables, all server[are one of the predefined server variables, and all _server [are one of the predefined server variables, all at the beginning of the _server
    • $GLOBALS [a globally combined array containing all the variables]
    • $_env [is an array that contains server-side environment variables. It is a super global variable in PHP, and we can access it directly from anywhere in the PHP program]

When Args=globals, flag appears.

Array (7) {["GLOBALS"]=> recursion ["_post"]=> Array (0) {} ["_get"]=> Array (1) {["args"]=> string (7 "GLOBALS"} ["_cookie"]=> Array (0) {} ["_files"]=> Array (0) {} ["ZFkwe3"]=> string] "Flag{92853051ab894a64 F7865CF3C2128B34} "[" Args "]=> string (7)" GLOBALS "}

Bugku Variable 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.