Analysis of the First Web Question of the 360 cup information security technology competition

Source: Internet
Author: User

The original question is as follows, prompting that it is a bad habit for programmers.

Add. Bak after the current URL as prompted to obtain the source code

<?phperror_reporting(0); function auth($password, $hidden_password){    $res=0;    if (isset($password) && $password!=""){                if ( $password == $hidden_password ){                        $res=1;                }    }    $_SESSION["logged"]=$res;    return $res;} function display($res){    $aff= "          

After research, we found the variable coverage vulnerability:
The auth function is used to determine whether the password submitted by the user is the same as the hidden_password [360] In the program. If the password is the same, set $ _ session ["logged"] = 1, as hidden_password [360] can be overwritten, the following link is constructed:

Http: // localhost: 8080/1. php? Hidden_password [360] = 1

After the page is opened, the submit password is 1

if (( isset ($password) && $password!="" && auth($password,$hidden_password[360])==1) || (is_array($_SESSION) && $_SESSION["logged"]==1 ) )

The condition for this statement is "the password submitted by the user is not blank and the password is the same as hidden_password [360]" or "$ _ session [" logged "] = 1"
After accessing the above link, hidden_password [360] is overwritten as 1 and the submitted password is also 1. In the auth function, $ _ session ["logged"] will be set, access http: // localhost: 8080/1 again based on the if conditions. PHP to get the original value of $ hidden_password [360 ].

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.