Sessions for Someone Else

Easy

· Backend

Incident

SEV-1

BUG-EQEQ

Priority: Critical (auth) · reported by security review

Time to fix: 10 min

Failing checks on the shipped build

  • equal content from different objects matches

    same content must match: expected condition to hold

How to work this incident

  1. Read the report: write down the expected behaviour and the actual one in a sentence each.
  2. Reproduce it: run the visible tests and find the failing check that matches the report.
  3. Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
  4. Follow the request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
  5. Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.

Inspired by

Java == lore

Inspired by the session-mixup incidents that follow Java's most classic beginner-to-production bug: comparing strings with ==. It works in unit tests (interned literals!), then fails in production the moment tokens arrive off the wire as fresh objects.

SessionStore.java decides whether a request's token matches the session owner.

Code map

class SessionStore {
    static boolean isOwner(String sessionToken, String requestToken) {
        return sessionToken == requestToken;
    }
}

Sign in to edit the file, run the tests and submit a fix

A free account — no card, no trial clock. You come straight back here.

Sessions for Someone Else — Java Bug Hunt

Inspired by the session-mixup incidents that follow Java's most classic beginner-to-production bug: comparing strings with ==.

  • Language: Java
  • Layer: Backend
  • Difficulty: Easy
  • Concepts: Strings, Equality
  • Modelled on: Java == lore
  • Visible tests: equal content from different objects matches; different tokens never match
  • Reward: 50 XP for a complete fix

Incident

  • Severity: SEV-1 (priority: Critical (auth))
  • Ticket: BUG-EQEQ
  • Reported by: security review
  • Time to fix: 10 minutes, the target for an easy incident

Failing checks on the shipped build

  • equal content from different objects matches — same content must match: expected condition to hold

How to work this incident

  1. Read the report: write down the expected behaviour and the actual one in a sentence each.
  2. Reproduce it: run the visible tests and find the failing check that matches the report.
  3. Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
  4. Follow the request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
  5. Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.

Briefing

Inspired by the session-mixup incidents that follow Java's most classic beginner-to-production bug: comparing strings with ==. It works in unit tests (interned literals!), then fails in production the moment tokens arrive off the wire as fresh objects.

SessionStore.java decides whether a request's token matches the session owner.

Bug report

BUG-EQEQ · Priority: Critical (auth) · Reported by: security review

isOwner(sessionToken, requestToken):

  • equal CONTENT means owner — regardless of object identity
  • null request tokens are never the owner (and must not throw)

Observed: valid tokens read from the network are rejected (== compares references), so a "helpful" fallback upstream started letting requests through unchecked.

Logs

[auth] token match failed for identical strings; fallback path engaged (!!)

The code as shipped

SessionStore.java (editable)

class SessionStore {
    static boolean isOwner(String sessionToken, String requestToken) {
        return sessionToken == requestToken;
    }
}

Open the hunt to start the incident clock, edit the files, run the visible tests and submit against the hidden ones, then write the root cause down. More Java bug hunts.