Session Tokens

Session token attacks occur when an attacker steals, manipulates, or exploits session tokens to gain unauthorized access to a user's session or account.

The example below is based on PostSwigger's Brute-forcing a stay-logged-in cookie 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.

Figure 1: Inspecting cookies' behavior.

When analyzing the cookie's pattern using Sequencer (Figure 2), it indeed validates that this is a static cookie (Figure 3).

Figure 2: Configuring cookie's position and sequencer's settings.
Figure 3: Reviewing Sequencer's results & confirming that the stay-logged-in is indeed a static cookie.

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).

Figure 4: Removing the session cookie does not affect the application's behaviour.

As a result, we can try brute-forcing carlos cookie using Intruder by rebuilding the cookie's hashing and encoding patterns (Figure 5).

Figure 5: Performing a BFA on carlos's cookie.

Last updated

Was this helpful?