Skip to content
This repository has been archived by the owner on Mar 2, 2019. It is now read-only.

Session Fixation Vulnerability in /loginc.php #22

Open
viccon opened this issue May 9, 2017 · 0 comments
Open

Session Fixation Vulnerability in /loginc.php #22

viccon opened this issue May 9, 2017 · 0 comments

Comments

@viccon
Copy link

viccon commented May 9, 2017

/loginc.php

if (!session_id()) {
    session_start();
}
...
...
$username = $_POST['name'];
$password = $_POST['password'];
$res = login($username, $password);
switch ($res) {
    case 0:
        echo 1;
    break;

    case 1:
        $_SESSION['login'] = true;
        $_SESSION['username'] = htmlspecialchars($username);
        $_SESSION['password'] = md5_128($password);
        echo 2;
    break;

    default:
        echo 0;
    break;
}

We can see that even after we successfully logged in, the system does not regenerate a new session_id.
Note that this Session Fixation Vulnerability could easily be exploited with the help of any XSS Vulnerability in the same domain, eg. XSS Vulnerability in /readfile.php, as there is no Http-Only flag.

<script>
document.cookie="session_name=session";
document.cookie="session=HACKED";
</script>

Once the victim logged in with the session cookie above, then the attacker could take full control of the victim's account using the same cookie.

s3131212 added a commit that referenced this issue Oct 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant