PicoCTF 2025 Web Exploitation—Apriti Sesamo Writeup
Welcome back to another one of my writeups! In this post, we’ll dive into an exciting web exploitation challenge from PicoCTF called Apriti Sesamo. We’ll walk through the problem step-by-step, explore the techniques used to uncover vulnerabilities, and ultimately crack the challenge wide open. Whether you're a beginner trying to learn or just here to see how it's done, this writeup is for you. Let’s get started!
Let's take a look at the hints provided
Hint 1: Backup files
Hint 2: Rumor has it, the lead developer is a militant emacs user
Now let's analyze the web interface.

I attempted logging in using commonly used credentials to observe how the login form responds.

Next step we took is to check the source code of the login page

Nothing useful. So, what’s next? Time to revisit the hints. The first one mentions Backup files, which implies that there might be a backup version of the site or a file available. The question is: how do we go about discovering it?
This where the hint 2 comes into play, based on the hint, it seems like our goal is to retrieve an Emacs backup of the login page. These types of backup files usually have a tilde (~) appended to the end of the original filename. For instance, if the original file is login.php, the backup would be named login.php~. With that in mind, let’s try accessing impossibleLogin.php~ and see what we find.
At the very bottom this obfuscated PHP code appears
This is the deobfuscated version of the code (You can deobfuscate this PHP code manually)
Looking at the code logic, it first checks if the username is exactly the same as the password. If that condition is true, the program immediately exits without revealing the flag. However, if the username and password are different, it proceeds to compare their SHA1 hashes. If the hashes match, the flag is returned. Initially, I thought about using type juggling to bypass the first condition, but that approach didn’t yield any results. Instead, I leveraged the SHAttered vulnerability (https://shattered.io/), which demonstrates a real-world SHA1 collision using two different PDF files that generate the same hash. By submitting the raw bytes of these colliding files as the username and password to impossibleLogin.php, I was able to trigger the condition and successfully retrieve the flag.
Here's my exploit to retrieve the flag
Run and it should give us the flag!!

Last updated