Contents

🌐 Irish-Name-Repo 3

A detailed write-up of the Web challenge 'Irish-Name-Repo 3' from PicoCTF - 2019

/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/challenge_presentation.png
Challenge Presentation

📊 Challenge Overview

Category Details Additional Info
🏆 Event PicoGym Event Link
🔰 Category Web 🌐
💎 Points 500 Out of 500 total
⭐ Difficulty 🟡 Medium Personal Rating: 2/10
👤 Author Xingyang Pan Profile
🎮 Solves (At the time of flag submission) 11.760 solve rate
📅 Date 23-02-2025 PicoGym
🦾 Solved By mH4ck3r0n3 Team:

📝 Challenge Information

There is a secure website running at https://jupiter.challenges.picoctf.org/problem/40742/ (link) or http://jupiter.challenges.picoctf.org:40742. Try to see if you can login as admin!

🎯 Challenge Files & Infrastructure

Provided Files

1
Files: None

🔍 Initial Analysis

First Steps

Initially, the website appears as follows:

/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/site_presentation.png
Site Presentation

This is the third in the series of Irish-Name-Repo challenges (Irish-Name-Repo 1, Irish-Name-Repo 2). Solving this challenge and inspecting the source of the login.html page:

/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/admin_login.png
Admin Login
/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/page_source.png
Page Source

As we can see, there is a debug parameter that is sent with a default value of 0 in the POST request to login.php. By setting it to 1, I discovered that it was possible to view the executed query:

/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/debug_true.png
Debug True

As we can see in this case, we have the query SELECT * FROM admin where password = '' because I sent the password parameter empty. By trying to send the payload password=' OR 1=1 --, I get:

/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/first_injection.png
First Injection
/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/rot_query1.png
ROT Query

As we can see, in this case, we have the query SELECT * FROM admin where password = '' because I sent the password parameter empty. By trying to send the payload password=' OR 1=1 --, I get:

1
SELECT * FROM admin where password = '' OR 1=1 -- ' 

So, I thought there might be some kind of filter applied, or encryption. Let’s move on to the exploitation phase.

🔬 Vulnerability Analysis

Potential Vulnerabilities

  • SQL Injection

🎯 Solution Path

Exploitation Steps

Initial setup

First of all, we need to understand what kind of encoding is being applied to the text. Searching for cipher identifiers, I found the following: https://www.dcode.fr/cipher-identifier. Trying to input BE 1=1 -- ' (the encoded text since it is the only part that differs from the original query), I couldn’t get anything.

/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/chiper_identifier.png
Cipher Identifier Warning

I received a _Warning_ The text has a **short length**, this can affect the quantity and reliability of the results. So I increased the length of the payload, for example, by sending Hi I'm mH4ck3r0n3 and I'm solving Irish-Name-Repo 3, and I got:

1
SELECT * FROM admin where password = 'Uv V'z zU4px3e0a3 naq V'z fbyivat Vevfu-Anzr-Ercb 3'

So the encrypted text is: Uv V'z zU4px3e0a3 naq V'z fbyivat Vevfu-Anzr-Ercb 3. Trying to analyze this:

/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/chiper_identifier2.png
Cipher Identifier

I get as the first possible algorithm ROT13. So, I try to decode the encrypted text using CyberChef with the ROT13 filter:

/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/cyberchef.png
CyberChef ROT13

As we can see, it has returned to the plain text previously sent as the payload: Hi I'm mH4ck3r0n3 and I'm solving Irish-Name-Repo 3. So it is a ROT13 Encode. Now that we know what type of algorithm is encoding our payload, let’s proceed to the exploitation phase.

Exploitation

The exploitation phase is very simple since by sending the payload ' OR 1=1 --, the result is always True, because the final query becomes:

1
SELECT * FROM admin where password = '' OR 1=1 -- ' 

We will be able to access the admin page where the flag is contained. However, since a ROT13 Encode is applied to the payload, we can directly send a ROT13 Encoded payload, so that the ROT13 text is converted to plain text, resulting in the final query as previously seen. This can be done using CyberChef with the ROT13 filter:

/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/cyberchef_payload.png
CyberChef Payload

As we can see, we need to send the ROT13 payload: ' BE 1=1 -- . By doing so, we will be able to obtain the flag. (Another way to solve it was by directly sending the ' OR 1=1 -- payload in plain text, extracting the encoded text by setting the debug value to 1, copying the encoded text, and sending it as a payload).

Flag capture

/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/manual_flag.png
Manual Flag

🛠️ Exploitation Process

Approach

The automatic exploit uses the codecs library to encode the payload in ROT13, then sends the request and extracts the flag from the response using a regex.

🚩 Flag Capture

Flag

Proof of Execution

/images/PicoGym/PicoCTF-2019/Irish-Name-Repo3/automated_flag.png
Automated Flag
Screenshot of successful exploitation

🔧 Tools Used

Tool Purpose
Python Exploit
CyberChef Encoding
DecodeFr Cipher Identification

💡 Key Learnings

Time Optimization

  • To identify any encrypted text, immediately use https://www.dcode.fr/cipher-identifier.
  • When we have a challenge that encrypts text and the algorithm is “bijective” or “reversible”, we can directly use the encrypted text provided by the challenge without wasting time figuring out which cipher was used for the encoding.

Skills Improved

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

📚 References & Resources

Similar Challenges

Learning Resources


📊 Final Statistics

Metric Value Notes
Time to Solve 00:10 From start to flag
Global Ranking (At the time of flag submission) Challenge ranking
Points Earned 500 Team contribution

Created: 23-02-2025 • Last Modified: 23-02-2025 *Author: mH4ck3r0n3 • Team: *