Session fixation

From zakirkun/ice-tea · View interactive version

Session fixation is an AI agent skill from the GitHub repository zakirkun/ice-tea. Detects missing session regeneration after login, allowing session fixation attacks.

How to use this skill

Skill file

Session Fixation

Overview

Session fixation occurs when an application does not regenerate the session identifier after a successful login. An attacker can set a known session ID before authentication, and after the victim logs in, the attacker reuses the same session ID to gain authenticated access.

Detection Strategy

Look for authentication flows (login functions) that do not call session regeneration functions before or after setting the authenticated user context.

Key patterns:

Remediation

Always regenerate the session ID after a successful authentication event.

Vulnerable (PHP):

session_start();
if ($valid_login) {
    $_SESSION['user'] = $username; // no session_regenerate_id!
}

Safe (PHP):

session_start();
if ($valid_login) {
    session_regenerate_id(true);
    $_SESSION['user'] = $username;
}

Safe (Express.js):

req.session.regenerate((err) => {
    req.session.user = user;
    res.redirect('/dashboard');
});
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.