DEV Community

Cover image for 🧩 The Web Cache "Whack-a-Mole" at PortSwigger Academy 🧩
NekoSec
NekoSec

Posted on

🧩 The Web Cache "Whack-a-Mole" at PortSwigger Academy 🧩

I spent my morning playing a high-stakes game of Whack-a-Mole, but instead of plastic moles, I was chasing X-Cache Headers and 302 Redirects. If you’ve ever tried to pull off a Web Cache Deception (WCD) attack, you know the struggle. It’s a psychological thriller where you have to trick two different "brains" at the same time:

The Cache: A simple-minded gatekeeper that sees .css and thinks, "Ooh, a public asset! I'll save a copy for everyone!" πŸ“

The Server: A smart but oblivious origin that sees /my-account and thinks, "Here is your private, sensitive profile data." πŸ”

The Puzzle

  • I kept hitting "Send," but the Cache kept laughing at me.
  • Miss.
  • Miss.
  • Redirect (302). <-- The mole just went back in the hole.
  • Miss.

I was getting dizzy analyzing the TTL (Time to Live), extension rules, and why the "hit" wouldn't stick. Was it the cookie? Was it the path delimiter? Was it just my Burp Suite acting up?

The Twist
I stopped chasing the moles in Burp Community and switched my vantage point to Caido. Sometimes a change of scenery is all you need to see the logic clearly.

The Muscle Memory 🧠
This lab isn't just about a tool; it's about building the Muscle Memory for the "Double-Tap":

  1. The Prime: Get a 200 OK and X-Cache: hit with your own session.
  2. The Poison: Deliver that exact URL to the victim.

The Harvest: Request the URL without cookies within that 30-second window to grab the victim's cached data.

The Result
One perfectly timed "Double-Tap," a fresh filename, and... HIT. 🎯 The cache finally coughed up the "public" CSS file, but inside the HTML was the prize: the victim's API Key.

My advice: If you’re stuck in a 302 loop, stop overthinking the headers and start thinking about the timing. The cache only stays "poisoned" for a few seconds. If you aren't fast enough, the mole wins.****

πŸš€ Lab Solved:Exploiting path mapping for web cache deception πŸš€

Top comments (0)