A security researcher mapped the OAuth flow on Google’s developer sites and noticed an unusually large Flask session cookie. Decoding it revealed a zlib-compressed, base64-encoded payload that contained a pickle-serialized oauth2client OAuth2WebServerFlow object holding a live client_id and client_secret. That same client_secret was effectively being used to validate Flask session signatures: the itsdangerous cookie-session key derivation (HMAC with "cookie-session") produced a derived key that matched the cookie signature byte-for-byte. With the secret exposed inside the signed cookie, session integrity was broken and arbitrary session keys could be forged.
The callback code base64-decodes and pickle.loads that flow object, so a forged, validly-signed cookie lets an attacker supply any pickle payload and trigger remote code execution via Python’s REDUCE semantics. The researcher proved execution non-destructively by unpickling a payload that invoked time.sleep and observing matching response delays. The flaw affected the shared DevSite platform across multiple Google developer domains. Recommended fixes were to rotate exposed OAuth secrets, give each deployment a server-side high-entropy SECRET_KEY, keep OAuth flow state on the server (use opaque references), and stop using pickle across client boundaries. The issue was reported Aug 6, triaged and accepted Aug 7, rewarded with $90,000 Aug 27, and fixed Oct 7.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.