bugku_web_ variable 1 (CTF)

This question is investigated php global variables GLOBALS usage, is also a php audit questions.

Look at the code:

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);");
}
?>

Tip flag in a variable, saw eval function, if two bypass line, as long as get variable has an assignment can be performed args eval, see var_dump function, which is a variable output information in accordance with the formula;

So we can only output the output global variables to obtain flag, variable args = GLOBALS on the line

 

Guess you like

Origin www.cnblogs.com/-chenxs/p/11617381.html