You know one of those lonely nights when a sudden rush of inspiration hits at 1am. You're not just going to let it slip away and go to sleep — like you should. So you follow the rabbit hole and stay up until 4am. Since your brain is on fire, falling asleep isn't even an option. Feels like trying to cool your room by opening a window in July. Next thing you know it's 5:30am, and there goes the next day. Weird thing.
Google says it might be ADHD or something related. So to all my fellow ADHDers, I have one thing to say.
Wait, did you watch the latest Avatar?... Anyway, I like ice cream.
Just kidding, just kidding. I don't know why I'm even writing an intro.
This isn't going to be one of those "mind-blowing" writeups that turns out to be an IDOR. But it won't be rocket science either. Just a 1am rabbit hole, a bit of wrong-content-right-extension energy, and a server with the survival instincts of a golden retriever.
The Finding
The app had a file upload feature. When a PDF was uploaded, there was a preview functionality that rendered the file inline (basically, shows you the uploaded PDF in the browser). Simple, clean, boring on the surface. The kind of feature most people glance at and think "yeah, whatever" before moving on. But I followed the rabbit hole.
After a few unsuccessful tricks, I tried uploading HTML content with a .pdf extension.
<s>test</s>
That resulted in a blank PDF preview. I honestly have no idea why I kept digging after that — but I did, and that's when things got interesting.
Turns out it wanted proper HTML. Full doctype, correct structure, the whole formal ceremony:
<!DOCTYPE html>
<html>
<body>
<s>test</s>
</body>
</html>
Uploading that HTML content with a .pdf extension rendered a PDF preview with the actual strikethrough text — test.
Once I confirmed HTML was rendering inside the PDF preview, I just sat there for a few seconds due to a panic attack. Because if HTML renders, iframes render. Simply put, an iframe is a webpage inside a webpage — point it at a URL, it shows you the response. So I thought — if iframes render and I can read the response, that's SSRF. And I know exactly where to point it.
Good old 169.254.169.254 - the internal metadata endpoint used by major cloud providers. It's only accessible from within the server itself — not from the internet. If SSRF can reach it, you can potentially extract credentials, instance roles, and other sensitive configuration data.
<!DOCTYPE html>
<html>
<body>
<iframe src="http://169.254.169.254/latest/meta-data/"></iframe>
</body>
</html>
I uploaded the above content as a .pdf file, the preview loaded, and the iframe rendered the response right there on screen. Cloud credentials, instance metadata — the whole thing was accessible.
Critical SSRF confirmed.
Once again I had that moment — am I just lucky, or actually good at it? — and then I remembered: probably both.
Takeaways
→ Wrong content, right extension — always probe file upload features with mismatched content types. Upload HTML as a PDF, SVG as a PNG, etc.
→ Iframes are your friend — Iframes can serve a lot of purposes, from XSS and SSRF to clickjacking chains. Whenever something weird is going on with HTML, iframes should be one of the first things on your mind.
→ 169.254.169.254 is always worth trying when you have any form of SSRF or server-side render.
→ Identify backend technologies — at the time I was too lazy to dig into what was responsible for converting the upload to a PDF. But if you're not: point SSRF at your own server and catch the incoming request. Check the User-Agent header — it often reveals exactly which service made the call. For example, User-Agent might show python-requests/2.x or HeadlessChrome.