Skip to content

Independent cybersecurity briefing

Latest

RSS
Breaches, bounties, zero-days, and AI.

Bug Bounty Write Ups

ChatGPT Account Takeover: The Cache Rule That Kept Tokens

*AI-assisted: drafted with AI help from public sources, then reviewed and edited. This is an analytical case study of a public disclosure, not my own discovery.*

Adam Hale, ZeroDay Times editorBy Adam Hale3 min read

Still life for “ChatGPT Account Takeover: The Cache Rule That Kept Tokens”: a magnifier and a sealed envelope, warm paper, OpenAI mark, signal CASE. [ BUG BOUNTY ] badge.

AI-generated illustration

OpenAI fixed one web cache deception bug in 2023. A year later, an encoded path made its CDN cache session tokens again, for a $6,500 bounty

AI-assisted: drafted with AI help from public sources, then reviewed and edited. This is an analytical case study of a public disclosure, not my own discovery.

One click on a link that looked like a shared chat could leave your ChatGPT session token sitting in a public cache. The attacker opened the same link and became you: chat history and billing details. This ChatGPT account takeover came back twice, because the first fix blocked one path instead of the whole bug class.

Disclaimer: * Educational and defensive use only. Both issues were fixed by OpenAI. Exact URLs and payloads are intentionally omitted.*

Vulnerability Overview

  • Type: Web cache deception caused by a URL parsing mismatch between the CDN and the origin server
  • CWE (analytical mapping): CWE-524 (Use of Cache Containing Sensitive Information), CWE-436 (Interpretation Conflict)
  • CVE / CVSS: Not reported
  • Bounty: $6,500 for the 2024 variant. The 2023 report received a “Kudos” from OpenAI, with no bounty reported

Round One: Caching by File Extension (2023)

In March 2023, Nagli noticed that ChatGPT’s session endpoint returned the logged-in user’s email, name, image and access token as JSON. Cloudflare, sitting in front, cached by file extension and ignored the content type.

The application still served that same session JSON when an extra path segment ending in a static extension was added. So a crafted link made the CDN treat a victim’s token response as a cacheable stylesheet. OpenAI shipped a production fix in under two hours: a cache exclusion rule for the session endpoint.

Round Two: How the ChatGPT Account Takeover Returned (2024)

In February 2024, researcher Harel (nokline) saw that shared-chat links never updated. The cache headers showed hits on paths with no static extension at all. The rule was location-based: anything under the share path was cached.

That is fine only if both servers agree on what the path is. They did not:

  1. The CDN did not decode an encoded slash, so it saw a share path and cached the response.
  2. The origin did decode and normalize it, so a “../” step walked out of the share folder to the session endpoint.
  3. The origin answered with the victim’s token. The CDN stored it under the share-looking URL.

My read: the 2023 exclusion matched the session URL as the CDN saw it, and here the CDN never saw it.

Business Impact

A bearer token in a cache means silent account takeover with no password, no 2FA prompt and nothing for the victim to notice. For an AI assistant, that exposes everything people paste into it: code, contracts, health questions.

Fixing ChatGPT Account Takeover-Style Cache Bugs (my own analysis)

1. Let the origin decide what is cacheable. Credential responses should send Cache-Control: no-store, private, and the CDN should honour it over any path rule.

2. Normalize once, at the edge. Reject encoded slashes and dot segments before cache rules run.

3. Make sensitive endpoints strict. Return the session JSON only for the exact path, never for extra segments.

# Pseudocode: the origin marks secrets uncacheable, the edge refuses ambiguous paths
def edge_handle(raw_path, request):
    lowered = raw_path.lower()
    if "%2f" in lowered or "%5c" in lowered or "/../" in raw_path + "/":
        return reject(400)                              # no second interpretation
    response = origin.fetch(raw_path, request)
    if "no-store" in response.headers.get("Cache-Control", ""):
        return response                                 # never cached, whatever the rule
    if cache_rules.match(raw_path):
        cache.store(raw_path, response)
    return response
def session_endpoint(path, user):
    if path != "/api/auth/session":
        return not_found()                              # exact match only
    return json(user.session(), headers={"Cache-Control": "no-store, private"})
# Test: share path with encoded traversal -> 400; nothing stored in cache

Key Takeaways

  • Two parsers, one URL: any disagreement is a security boundary.
  • Patch the class. An exclusion for one path leaves every other route to the same response open.
  • Path-based “cache everything here” rules need the origin’s no-store to win.

Credit & Sources

2023 report by Nagli (@galnagli): original thread, 24 March 2023. 2024 variant by Harel (nokline): ChatGPT Account Takeover — Wildcard Web Cache Deception, 4 February 2024. Facts come from those sources; analysis and code are original.

Next breakdown: the $100,500 Apple webcam hack that started with an iCloud share. Follow @masimshahzad for daily bug bounty breakdowns.

First published by Adam Hale on Medium.

Sources

Share

Corrections and tips:[email protected]