📝 Overview
This challenge presented a blog web application. The goal was to find and exploit a vulnerability to retrieve the flag.
🔍 Reconnaissance
Upon visiting the web application, we're presented with a simple blog interface:
🐛 Vulnerability Discovery — IDOR
I noticed an IDOR (Insecure Direct Object Reference) vulnerability. Navigating to
/blog/3 revealed a page that had been "deleted." Inspecting the page source code revealed some
interesting HTML comments:
<!-- i had to delete this bc it has my personal info on it :( -->
<!-- for documents in the 'other' folder only people with the API key has access -->
<object data="/attachment?file=resume.pdf&apiKey=9980426e560e3661cff195b21a4493b7"
Key findings from the source code:
- The blog post was deleted because it contained personal information
- There's an attachment endpoint that takes a
fileparameter and anapiKey - The API key is hardcoded:
9980426e560e3661cff195b21a4493b7
🚀 Exploitation
Since the resume.pdf file in /blog/3 also required the API key to access, I assumed
the flag.txt file was accessible through the same endpoint. I crafted the following URL:
34.186.135.240:30000/attachment?file=/flag.txt&apiKey=9980426e560e3661cff195b21a4493b7
And just like that — the flag was returned! 🎉
bkctf{k3ys_in_th3_l0ck5}
💡 Key Takeaways
- Always check page source code for hidden comments and leaked credentials
- IDOR vulnerabilities can expose unintended resources through direct object references
- Hardcoded API keys in HTML are a critical security issue