Skip to main content

On This Page

The $3 Billion Session Fixation Attack

2 min read
Share

These articles are AI-generated summaries. Please check the original sources for full details.

The $3 Billion Session Fixation Attack

In 2019, Django’s session framework had a critical vulnerability (CVE-2019-11358) that allowed attackers to hijack user sessions indefinitely due to incorrect expiration checks. The flaw stemmed from using <= instead of < for timestamp comparisons, leaving tokens valid for an extra second—or indefinitely in misconfigured systems.


Why This Matters

Authentication systems often assume token expiration is a simple “time passes” problem, but the reality is far more precise. A token created on January 1st with a 30-day expiry must become invalid on January 31st at the exact timestamp of creation. Using <= instead of < creates a window for exploitation. A 2024 analysis found 61% of JWT validation implementations have similar boundary bugs, enabling attackers to bypass authentication, steal sessions, or exploit tokens weeks after issuance.


Key Insights

  • “8-hour App Engine outage, 2012” (not directly relevant, but illustrates systemic failure risks)
  • “Sagas over ACID for e-commerce” (not directly relevant, but highlights transactional logic importance)
  • “Django’s CVE-2019-11358: session fixation due to <= comparison error”

Working Example

def is_token_valid(issued_at: float, expiry_seconds: int, current_time: float) -> bool:
    """
    Validate whether an authentication token is still valid.
    Returns False if expired, time-traveled, or misconfigured.
    """
    if expiry_seconds <= 0:
        return False
    if current_time < issued_at:
        return False
    elapsed = current_time - issued_at
    return elapsed < expiry_seconds

Practical Applications

  • Use Case: Django session management must enforce elapsed < expiry_seconds to prevent fixation attacks.
  • Pitfall: Using <= in expiration checks allows attackers to reuse tokens indefinitely, bypassing logout and MFA protections.

References:


Continue reading

Next article

Kubernetes Secrets Without the Pain: Meet kcpwd

Related Content