All Stories
PyPIdata-exposed

OAuth Tokens Left Through the Library That Refreshed Them

by tokensmithNov 13, 2026
Share storyHN

Our integration team added requests-oauth2-helper for a client's Salesforce sync. It wrapped sessions neatly, handled refresh windows, and had typing stubs — everything a maintained package has.

The quiet part

Every Authorization header and refresh payload went to a C2 endpoint before continuing upstream. Calls kept working, so nothing looked wrong. The attacker used the refresh tokens to mint access tokens from their own infrastructure, on a schedule, for twelve days.

Discovery

The client's security team asked why their OAuth grants were being refreshed from an unfamiliar ASN every six hours. That question arrived before our own monitoring noticed anything.

Remediation

Revoked every grant for that tenant, forced re-consent, rewrote the sync against requests-oauthlib, and shipped a hotfix the same night. The client kept us — narrowly.

Practical takeaway

Auth libraries are the worst place for a surprise. Ours now require an official-docs citation in the PR, and we diff every outgoing request's host list before enabling a new integration in production.

Involved package: requests-oauth2-helperCheck in scanner →
Was this story helpful?