Session Tokens
Last updated
Was this helpful?
Last updated
Was this helpful?
This can lead to unauthorized access to user accounts, data theft, or impersonation, as attackers can hijack or impersonate legitimate user sessions.
Use secure session management practices, such as generating random and unique session tokens, implementing HTTPS to protect tokens in transit, and using (e.g., HttpOnly, Secure). Regularly regenerate session tokens and implement proper session expiration and invalidation mechanisms.
The example below is based on PostSwigger's lab.
When logged in as wiener
we get two cookies: stay-logged-in
and session
(Figure 1). The former seems static, i.e., does not change with a new request, whereas the latter is dynamic.
When analyzing the cookie's pattern using Sequencer (Figure 2), it indeed validates that this is a static cookie (Figure 3).
The decoded value of the stay-logged-in
cookie seems to have the format username:hash
. We can find out the type of hash and try to crack it.
The cookie's pattern is username:md5(password)
. We also notice that if we remove the session
cookie, we can still access the current account's profile as normal (Figure 4).
As a result, we can try brute-forcing carlos
cookie using Intruder by rebuilding the cookie's hashing and encoding patterns (Figure 5).
stay-logged-in
is indeed a static cookie.session
cookie does not affect the application's behaviour.carlos
's cookie.