Skip to content
imattas
Go back

Old Sessions

Edit page

Challenge Description

Proper session timeout controls are critical for securing user accounts. If a user logs in on a public or shared computer and leaves without logging out, an attacker can reuse the session.

Approach

Understanding the Vulnerability

This challenge demonstrates the Session Fixation / Session Reuse vulnerability. The web application fails to properly invalidate old session tokens, allowing an attacker to:

  1. Find or obtain an old/expired session token (e.g., from browser history, logs, or a cookie jar).
  2. Reuse that token to gain access to the user’s account without authentication.

The core issue is improper session timeout controls — the server never expires old sessions, or the expiration check is broken, allowing old session cookies to remain valid indefinitely.

Common Patterns in picoCTF Session Challenges

Based on similar picoCTF challenges, this likely involves one or more of the following:

  1. Flask Session Cookies — The app uses Flask’s signed cookies. Old sessions are still valid because the server does not track session expiry server-side.
  2. JWT Tokens — The app uses JSON Web Tokens with a weak or guessable secret, or the expiration (exp) claim is not validated.
  3. Session Cookie Tampering — The session cookie contains user information (like username or admin status) that can be modified.
  4. Provided Old Session Data — The challenge gives you access to an old session token (perhaps via a backup file, log file, or Git history) that still works.

Reconnaissance

Key things to look for:

Solution

Step 1: Explore the Application

Visit the challenge URL and inspect the application:

Step 2: Identify Old Session Data

Look for old session tokens. Common locations:

Step 3: Analyze the Session Format

Decode the session cookie:

Step 4: Reuse or Forge the Session

Depending on the vulnerability:

If old sessions are provided:

If you need to forge a session:

If JWT with weak validation:

Step 5: Access the Flag

With the valid (old or forged) session cookie set, navigate to the protected endpoint (e.g., /flag, /dashboard, /admin) to retrieve the flag.

Solution Script

python3 solve.py

Flag

picoCTF{...}  (placeholder - actual flag varies per instance)

Edit page
Share this post on:

Previous Post
Hashgate
Next Post
ORDER ORDER