Written by: Mio Kanzaki(Security Analyst (AI))Reviewed by: 千葉圭介Updated
Session hijacking takes over an active login session to impersonate the account holder. IPA explains that when session management has weaknesses, an attacker can obtain a logged-in user's session ID and use it to act as that person. Session ID is the identifier the site uses to track who is logged in.
How does session hijacking work?
When a user logs in, the site issues a numbered token — similar to a visitor badge — and checks that token on every subsequent request. If the token falls into the wrong hands, anyone holding it can enter without credentials. That token is the session ID.
According to OWASP, an attacker either steals the session token or guesses it. The main paths for token leakage are tokens that are easy to predict, interception of network traffic, attacks against the user's browser such as XSS, and man-in-the-middle attacks. The full range of session management weaknesses is covered on the session management page.
Why does session hijacking matter?
IPA explains that a successful attack lets the attacker perform any action the legitimate user is permitted to take. That includes unauthorized money transfers, unintended purchases, account cancellation, unauthorized changes to settings, and viewing private personal information. IPA states that any site with a login function needs attention, regardless of the type of organization or the nature of the site.
IPA lists four root fixes:
- Use a session ID that is hard to guess.
- Never include the session ID in a URL parameter.
- Add the
secureattribute to cookies that are transmitted over HTTPS. - Start a new session when login succeeds.
IPA also lists supplementary measures: not using a fixed value as the session ID, and monitoring the expiry of cookies. CAPEC recommends invalidating the session ID after logout, setting an expiry, and encrypting communications.
The free URL check shows what your login-area configuration looks like from outside. To review your member-site implementation, contact us.
Related terms
- Session fixation: an attack that plants a session ID before login so the attacker already holds the token when the user authenticates.
- Cross-site scripting (XSS): a technique that runs unauthorized code in the visitor's browser.
- Cross-site request forgery (CSRF): a technique that makes a logged-in user perform an action without their knowledge.
- Replay attack: an attack that retransmits captured traffic to impersonate the original sender.
- Man-in-the-middle attack: an attack that intercepts communication to read or alter the content.
Frequently asked questions
What is the difference between session hijacking and session fixation?
OWASP explains that session fixation starts before login. Session hijacking, by contrast, steals a session that has already been established after login.
What should a site operator address first?
IPA lists four root fixes: use a session ID that is hard to guess, never put the session ID in a URL parameter, add the secure attribute to cookies used over HTTPS, and start a fresh session on successful login.
Next step
The full range of session management weaknesses is covered on the session management page. The free URL check shows what your login-area configuration looks like from outside. To review your member-site implementation, contact us.
Frequently asked questions
What is the difference between session hijacking and session fixation?
OWASP explains that session fixation starts before login. Session hijacking, by contrast, steals a session that has already been established after login.
What should a site operator address first?
IPA lists four root fixes: use a session ID that is hard to guess, never put the session ID in a URL parameter, add the secure attribute to cookies used over HTTPS, and start a fresh session on successful login.