Contents

🌐 Local Authority

A detailed write-up of the Web challenge 'Local Authority' from PicoCTF - 2022

/images/PicoGym/PicoCTF-2022/LocalAuthority/challenge_presentation.png
Challenge Presentation

📊 Challenge Overview

Category Details Additional Info
🏆 Event PicoGym Event Link
🔰 Category Web 🌐
💎 Points Out of 500 total
⭐ Difficulty 🟢 Easy Personal Rating: 0/10
👤 Author LT ‘syreal’ Jones Profile
🎮 Solves 54.440 solve rate
📅 Date 29-01-2025 PicoGym
🦾 Solved By mH4ck3r0n3 Team:

📝 Challenge Information

Can you get the flag?

🎯 Challenge Files & Infrastructure

Provided Files

1
Files: None

🔍 Initial Analysis

First Steps

Initially, the website appears as follows:

/images/PicoGym/PicoCTF-2022/LocalAuthority/site_presentation.png
Site Presentation

Initially, I thought of an SQL Injection, but when I tried to insert special characters, as mentioned above, they were blocked. So, I tried logging in with the credentials admin:admin, but the only screen I received was an error screen:

/images/PicoGym/PicoCTF-2022/LocalAuthority/login_fail.png
Login Fail

So, I decided to inspect the /login.php page, since there was nothing interesting on the page where the actual login was.

/images/PicoGym/PicoCTF-2022/LocalAuthority/login_source.png
Login Page Source

As we can see, there is a JavaScript function that creates a hash. If the login is successful, it sets the hash in the invisible admin_form and sends a POST request to /admin.php (which will verify if the hash is correct). In fact, when I tried to access /admin.php directly, I only received a Not Authorized message since I hadn’t passed a valid hash. In the source, there was also a script included in the page, as we can see secure.js. By clicking on it, I found the source:

/images/PicoGym/PicoCTF-2022/LocalAuthority/secure_js.png
secure.js

As we can see, the validation is done here, and it appears that the password is in plaintext. Let’s move on to the exploit.

🎯 Solution Path

Exploitation Steps

Exploitation

The exploit was simply to access the login page with the credentials admin:strongPassword098765. Once I did that, I was redirected to /admin.php, where the flag was present.

Flag capture

/images/PicoGym/PicoCTF-2022/LocalAuthority/manual_flag.png
Manual Flag

🛠️ Exploitation Process

Approach

The exploit makes a request to the /login.php page and logs in. It then extracts the hash and makes a request to the /admin.php page, passing the correct hash extracted via a regex. The flag was present in the request’s response text, and I extracted it using a regex to then print it.

🚩 Flag Capture

Flag

Proof of Execution

/images/PicoGym/PicoCTF-2022/LocalAuthority/automated_flag.png
Automated Flag
Screenshot of successful exploitation

🔧 Tools Used

Tool Purpose
Python Exploit
ChromeDevTools Web Testing

💡 Key Learnings

Time Optimization

Always inspect the source code of all pages.

Skills Improved

  • Binary Exploitation
  • Reverse Engineering
  • Web Exploitation
  • Cryptography
  • Forensics
  • OSINT
  • Miscellaneous

📊 Final Statistics

Metric Value Notes
Time to Solve 00:02 From start to flag
Global Ranking Challenge ranking
Points Earned Team contribution

Created: 29-01-2025 • Last Modified: 29-01-2025 *Author: mH4ck3r0n3 • Team: *