I Handed A Reverse Proxy My Gmail Access Token

The video explains a sophisticated phishing attack where attackers use a reverse proxy to intercept OAuth authentication tokens by presenting victims with fake login pages that relay credentials and two-factor authentication in real-time, granting attackers full access to email accounts. It emphasizes the difficulty of defending against such attacks, the importance of verifying URLs before entering credentials, and warns about the severe consequences of compromised email accounts, including further phishing and privacy breaches.

About a year ago, the creator’s acquaintance had their email compromised through a sophisticated phishing attack that was particularly deceptive because the malicious emails were sent from the victim’s legitimate email account. This tactic bypassed the common first line of defense—checking the sender’s email address—since the emails appeared to come from a trusted source. The phishing email urged the recipient to click a link to access supposedly important documents via an “Adobe secure upload,” creating a sense of urgency and trust by using familiar branding and language emphasizing security.

Clicking the link led victims to a legitimate Adobe login page, which then redirected them to a fake domain controlled by the attacker. On this domain, victims encountered authentic-looking OAuth login forms for providers like Google or Outlook. When users entered their credentials and completed two-factor authentication, the attacker’s reverse proxy intercepted the authentication process. Acting as a man-in-the-middle, the proxy relayed requests and responses between the victim and the real OAuth provider, capturing the access tokens or cookies that granted full account access without raising suspicion.

The video then delves into a high-level explanation of how such a reverse proxy can be implemented in code. The proxy forwards all incoming requests to the legitimate OAuth provider, copying headers and request bodies exactly, and then relays the responses back to the victim. It can also modify responses, injecting scripts or altering forms to maintain control over the authentication flow. This setup allows attackers to harvest authentication tokens seamlessly, which they can then use to access the victim’s email and other sensitive data as if they were the legitimate user.

The creator highlights the difficulty in defending against such attacks because the stolen tokens and credentials appear legitimate to the service providers. Some advanced defenses like device-bound session credentials exist, which tie tokens to specific devices, but these are not universally implemented. Attackers can also evade IP-based protections by frequently changing their IP addresses. The key takeaway is the importance of verifying the URL and domain before entering sensitive credentials, as attackers can obfuscate URLs to appear trustworthy, and once credentials are entered on a malicious domain, the attacker gains full access.

Finally, the video warns viewers about the broader implications of such compromises. Attackers can set up email forwarding rules to intercept all incoming messages, allowing them to conduct further phishing campaigns from the victim’s account and harvest even more credentials. This can lead to significant financial and privacy damage. The creator also notes the challenges faced when researching this topic using AI tools, which often resist providing detailed explanations of such attack methods, underscoring the importance of understanding these threats independently to better protect oneself.

Useful Links