php> = 4.2.0, the default value for php.ini's register_globals option is set to Off. When register_globals is set to On, the program can receive various environment variables from the server, including form submitted variables, and because PHP You do not have to initialize the value of the variable in advance, which leads to a great potential safety hazard.
example 1:
// check_admin () is used to check the current user permissions, if admin is set $ is_admin variable is true, and then determine whether this variable is true, and then perform some operations management
//ex1.php
if (check_admin ())
{
$ is_admin = true;
}
if ($ is_admin)
{
do_something ();
}
?>
This section of code does not initialize $ is_admin to Flase in advance. If register_globals is On, we can bypass check_admin () by submitting http://www.sectop.com/ex1.php?is_admin=true directly
Example 2:
//ex2.php
if (isset ($ _ SESSION ["username"]))
{
do_something ();
}
else
{
echo "You are not logged in!";
}
?>
//ex1.php
$ dir = $ _GET ["dir"];
if (isset ($ dir))
{
echo "
";
system ("ls -al". $ dir);
echo "
";
}
?>
mixed eval (string code_str) // eval injection generally occurs when the attacker can control the input string
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.