🌐 Bookmarklet
A detailed write-up of the Web challenge 'Bookmarklet' from PicoCTF - 2024
📊 Challenge Overview
Category Details Additional Info 🏆 Event PicoGym Event Link 🔰 Category Web 🌐 💎 Points Out of 500 total ⭐ Difficulty 🟢 Easy Personal Rating: 0/10 👤 Author Jeffery John Profile 🎮 Solves 35.621 solve rate 📅 Date 28-01-2025 PicoGym 🦾 Solved By mH4ck3r0n3 Team:
📝 Challenge Information
Why search for the flag when I can make a bookmarklet to print it for me?
🎯 Challenge Files & Infrastructure
Provided Files
1
Files: None
🔍 Initial Analysis
First Steps
Initially, the website appears as follows:
As we can see, there is a
textarea
in the center containing some JavaScript code. The first thing I thought of doing was copying it and trying to execute it in theChromeDevTools
console.
🎯 Solution Path
Exploitation Steps
Exploitation
The exploit is very simple: by clicking on the textarea, the code is copied to the clipboard. Then, pasting it into the ChromeDevTools console and pressing enter to execute it, I obtained the flag in an alert, as the code decrypted and displayed it.
Flag capture
🛠️ Exploitation Process
Approach
The automatic exploit is a bit unusual (I had fun with the
PyExecJs
library). First, you need to installNode.js
and the `ExecJS library:
1 2
sudo apt install nodejs pip install PyExecJs
I used
requests
andbs4
to extract the JavaScript from the page inside the textarea, and then executed it withexecjs
to extract the flag.
🚩 Flag Capture
Flag
Proof of Execution
🔧 Tools Used
Tool Purpose Python Exploit ChromeDevTools Web Testing
💡 Key Learnings
New Knowledge
I learned how to use Python’s execjs to execute JavaScript in Python.
Skills Improved
- Binary Exploitation
- Reverse Engineering
- Web Exploitation
- Cryptography
- Forensics
- OSINT
- Miscellaneous
📊 Final Statistics
Metric | Value | Notes |
---|---|---|
Time to Solve | 00:00 | From start to flag |
Global Ranking | Challenge ranking | |
Points Earned | Team contribution |
Created: 28-01-2025 • Last Modified: 28-01-2025 *Author: mH4ck3r0n3 • Team: *