# Preliminary Round

Welcome back to my writeup! In this post, I’ll take you step by step through how we approached and solved the challenges from the Trend Micro uCTF preliminaries, held on August 22, 2025. This CTF was intense and fast-paced, giving us only one hour to solve all the challenges, which really tested our problem-solving speed and teamwork. I’ll break down our thought process, the tools we used, and the strategies that helped us tackle each challenge efficiently.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F0lJbVtvyerZgh1QWM1Mf%2Fcute-anime-girl-noela-nya-3jd80r3o05097vdm.gif?alt=media&#x26;token=b3cd4254-a458-4db5-be1a-efab545223c9" alt=""><figcaption></figcaption></figure>

**Attached in the Email**

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F2P5vFrlFvfgZuZqaR4H2%2FEASY_Attached%20in%20the%20Email.png?alt=media&#x26;token=237fab05-d30e-4987-9193-0b376312889b" alt=""><figcaption></figcaption></figure>

In this challenge, we are given a Base64 encoded string, all we need to do is to decode it.

`echo "<base64_encoded_string>" | base64 -d`&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FFmHgld4kKL6R1ojHjdeA%2FScreenshot%20(74).png?alt=media&#x26;token=8be06ec4-97c1-4852-b482-79c5df5f676d" alt=""><figcaption></figcaption></figure>

**Common Password**

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F8xroCWSqht6geU1u3XZw%2FEASY_Common%20Password.png?alt=media&#x26;token=f124372b-ba29-4a6d-8c1c-8dd4c96941b3" alt=""><figcaption></figcaption></figure>

In this challenge, we are given a SHA256 hash, all we need to do is to crack this using **John** or **Hashcat**. In our case, we will use **John**.

`john --format=raw-sha256 --wordlist=/usr/share/wordlists/rockyou.txt hash`&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FsT6MP2UNfe05S9q1k23O%2FScreenshot%20(76).png?alt=media&#x26;token=52e6a250-2ef8-404a-8c12-e7d9f7301799" alt=""><figcaption></figcaption></figure>

Flag: **uCTF{2\_iloveyou}**

**Ancient File**

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FNumqnRrWmrGSrodKU1lM%2FAncient%20File.png?alt=media&#x26;token=e8e09c22-47b7-405b-bb6b-b0245e9aff0d" alt=""><figcaption></figcaption></figure>

For this challenge, we were given a file resembling a wordlist.&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FK5Q4CADHXhvlRButpqB1%2FScreenshot%20(72).png?alt=media&#x26;token=326d46d5-a8fa-4cab-9288-44a86340f3d0" alt=""><figcaption></figcaption></figure>

The description is straightforward, so there’s no need to overthink it—simply use **Ctrl + F** or **grep** to search for the flag format.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FZ16e7yoWEuiBqSZuKVQV%2FScreenshot%20(73).png?alt=media&#x26;token=78d33ab8-df68-40b6-aabd-f561c34447aa" alt=""><figcaption></figcaption></figure>

**Follow the Train**

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F4uJeKHD5LihiEGMLzIjF%2FOSINT.png?alt=media&#x26;token=ad23e14a-26e8-429a-91d7-f29c9e574489" alt=""><figcaption></figcaption></figure>

In this challenge, we are given an image.&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FGiPtKYWBSlz9CEOvGnBU%2Fbabc862d9ff52117d683365245039351.jpg?alt=media&#x26;token=35a8767c-4f24-4faf-8c99-64fa32d85963" alt=""><figcaption></figcaption></figure>

A train, since this is an OSINT challenge, we need to get the small details. If you noticed, The red train has the marking **"VIEUX-LYON FOURVIÈRE"**. This is a funicular railway in **Lyon, France**, that goes up to the **Basilica of Notre-Dame de Fourvière** (a very famous pilgrimage site).

Let’s look up the Basilica’s contact info.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FmryogNn3rAqhxJAOSBvf%2FScreenshot%20(117).png?alt=media&#x26;token=d5595c9e-62bf-4d67-8b49-22cfe13aa2ae" alt=""><figcaption></figcaption></figure>

Flag: **uCTF{14\_33478251301}**

**In The Property**

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FLl2JOLRity5AnxBTaGcr%2FIn%20The%20Property.png?alt=media&#x26;token=9fb604ba-2bb0-4f56-9ef1-12af8380518c" alt=""><figcaption></figcaption></figure>

In this challenge, we are given a PNG file

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FOkWUkDX7Fe728mfENxnV%2Fbd3688e970d227c7045afde973cbe1e0.png?alt=media&#x26;token=81c0f6bd-350a-4ab2-960a-cff82f60b438" alt=""><figcaption></figcaption></figure>

Just from the title, it’s clear that something is hidden in the metadata. Let’s take a closer look.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FGe9JQquUqtuprEAwjlt5%2FScreenshot%20(77).png?alt=media&#x26;token=2959e9c7-ce4e-494a-949c-f7d2d43c76bd" alt=""><figcaption></figcaption></figure>

**File in a File**

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FdqWI6iLsQV8w455USYjt%2FFile%20in%20a%20File.png?alt=media&#x26;token=b23d447f-7f8f-446c-a3ef-c6505ed15f8b" alt=""><figcaption></figcaption></figure>

For this challenge, we’re given a file that’s been compressed multiple times. Here’s the sequence of compressions

1. lz4 -d file file.out
2. zstd -d file.out -o file.next
3. unrar x file.next
4. unzip file3
5. bunzip -d file2
6. gzip -d file2.gz
7. tar -xf file2

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FlqdfLVM2syO0CmzhVwBs%2FScreenshot%20(88).png?alt=media&#x26;token=588cbfe1-303e-4920-bcc6-5b0cb01d29d9" alt=""><figcaption></figcaption></figure>

**Hidden in the Bytes**

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F1QTPrav06fZuLrnHpCYU%2FHidden%20in%20the%20Bytes.png?alt=media&#x26;token=41f9d359-e590-4315-ab35-670b2d00031b" alt=""><figcaption></figcaption></figure>

In this challenge, we are given a PNG file

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F1ScyaH8ECNkpa1Efrzqj%2F195375ef78976640c01363f300c2833b.png?alt=media&#x26;token=78a1d58b-4919-4346-b433-eaed8c179448" alt=""><figcaption></figcaption></figure>

Once again, the title hints that LSB is at play here, so let’s examine it using **zsteg**.

`zteg file.png`

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FVEk1uMS2CZdkoA2kj6ee%2FScreenshot%20(98).png?alt=media&#x26;token=a58e5fba-b9a0-417d-aefc-fdb999c83876" alt=""><figcaption></figcaption></figure>

**PWSH Guess**

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FLAEdVlbdDEHIixxdgXI4%2FPWSH%20Guess.png?alt=media&#x26;token=db84da4a-a8bd-4302-b4e0-f0a09e79edc4" alt=""><figcaption></figcaption></figure>

In this challenge, we are given an obfuscated powershell.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F9tB3rJ4COoCw1Sye3IKT%2FScreenshot%20(100).png?alt=media&#x26;token=0546c47a-4fbf-4b34-8360-298e586245f1" alt=""><figcaption></figcaption></figure>

It consists of a Base64 encoded string, when I decode it, this is the result

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2Fgofrc8p0KC4GmXDYpscH%2FScreenshot%20(101).png?alt=media&#x26;token=f793d329-2a26-4c52-870e-c63ae31d1470" alt=""><figcaption></figcaption></figure>

Now the flag is obvious here

```powershell
If ($n -lt (644 % 2)) { Write-Host "$([char]0x75)$([char]0x43)$([char]0x54)$([char]0x46)$([char]0x7B)$([char]0x31)$([char]0x31)$([char]0x5F)$([char]0x56)$([char]0x47)$([char]0x68)$([char]0x70)$([char]0x63)$([char]0x30)$([char]0x6C)$([char]0x7A)$([char]0x51)$([char]0x55)$([char]0x5A)$([char]0x68)$([char]0x61)$([char]0x32)$([char]0x56)$([char]0x47)$([char]0x62)$([char]0x47)$([char]0x46)$([char]0x6E)$([char]0x7D)" }
```

This PowerShell snippet constructs a string (the flag) by converting a sequence of hexadecimal ASCII codes into characters using `$([char]0xXX)`. Each `$([char]0xXX)` represents one character in the flag, and `Write-Host` prints them all together. The `if` condition `$n -lt (644 % 2)` evaluates whether `$n` is less than the remainder of 644 divided by 2 (which is 0), so the block only executes if `$n < 0`—meaning it’s mostly used as a “hidden” or conditional print. In Python, this can be decoded by taking the list of hex codes, converting each to its corresponding character using `chr()`, and joining them into a string, effectively reconstructing the exact flag the PowerShell code would display.

```python
hex_values = [
    0x75, 0x43, 0x54, 0x46, 0x7B, 0x31, 0x31, 0x5F, 0x56, 0x47, 0x68,
    0x70, 0x63, 0x30, 0x6C, 0x7A, 0x51, 0x55, 0x5A, 0x68, 0x61, 0x32,
    0x56, 0x47, 0x62, 0x47, 0x46, 0x6E, 0x7D
]

flag = ''.join(chr(h) for h in hex_values)
print(flag)
```

Here's the output

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FlC6V9R3hSz1vZ3BFKdUj%2FScreenshot%20(102).png?alt=media&#x26;token=e3fd2dd3-1691-4430-8f55-5703911f8db7" alt=""><figcaption></figcaption></figure>

**Double Blind**

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F7oHgpRocNn8RftxM1XN9%2FMEDIUM_Double%20Blind.png?alt=media&#x26;token=ae0c6366-0d6f-41ba-92f0-a77979191c6d" alt=""><figcaption></figcaption></figure>

In this challenge, we are provided with an encrypted string.

`a2hhaGloemxuaHN2eWwuanZ0`&#x20;

As mentioned in the challenge, it's **encrypted + encoded.** The initial string looks like a Base64, let's try

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2Fj0UziiN4WoPNrFAIePhP%2FScreenshot%20(119).png?alt=media&#x26;token=9f4d3a7c-4935-44b8-9b0b-a5f9ae5ccdd5" alt=""><figcaption></figcaption></figure>

Looks like ROT13, let's check

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FKKYypC2tF1c6PRD7tuIR%2FScreenshot%20(120).png?alt=media&#x26;token=3f2bc7df-9496-4eda-b6a4-3219ce177995" alt=""><figcaption></figcaption></figure>

There it is, that's the DNS, now we will encode it to Base64 and we will use that as the flag.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FTtk5OlVF9JCA60SyR422%2FScreenshot%20(121).png?alt=media&#x26;token=aa0bded1-9aca-4bb2-aa6b-0fb653f6005f" alt=""><figcaption></figcaption></figure>

Flag: **uCTF{3\_ZGF0YWJhc2VnYWxvcmUuY29t}**

**Need The Debugger**

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FYez1vgeDF6QW1IQiTHkj%2FNeed%20The%20Debugger.png?alt=media&#x26;token=984e14dd-52b4-4e51-8e23-873929281ffe" alt=""><figcaption></figcaption></figure>

For this challenge, we are provided with a binary file. The title hints that a debugger will be required, but before using one, let's first analyze the file in **Ghidra**.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FiawTKUKQowAXN2Jgxwr4%2FScreenshot%20(108).png?alt=media&#x26;token=8884f299-8ad5-4f7d-8107-56900439f30b" alt=""><figcaption></figcaption></figure>

This is the main function, now let's check the `do_guess` function.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F68yplwDq7l6Lvs0hxWI2%2FScreenshot%20(109).png?alt=media&#x26;token=a5d5dc5d-efcb-4826-9bf5-1dd2d588bb0e" alt=""><figcaption></figcaption></figure>

You see the Juicy part here?&#x20;

```c
if (numberofguess == 1) {
    builtin_memcpy(pp,"_i~lQ\x13uank\tlekkL|II^\x1bD\x12W",0x19);
    sVar4 = strlen((char *)pp);
    memfrob(pp,(long)(int)sVar4);
    puts((char *)pp);
}
```

This code snippet executes when the player correctly guesses the number on their very first attempt. It first copies an obfuscated string into the buffer `pp` using `builtin_memcpy`. The length of the string is calculated with `strlen`, and then `memfrob` is applied to the buffer, which is a simple reversible XOR-based transformation used to obscure data. Finally, the transformed string is printed with `puts`, effectively revealing a hidden message or flag that is only accessible if the player guesses the number correctly on their first try.

What is `memfrob`?

* `memfrob()` is a glibc function that **XORs each byte with 42 (`0x2A`)**.
* So the hidden string is simply the above bytes **XOR’d with 0x2A**.

#### That means the **flag is `_i~lQ...` XOR 0x2A**.

```python
data = b"_i~lQ\x13uank\tlekkL|II^\x1bD\x12W"
decoded = bytes([b ^ 0x2A for b in data])
print(decoded.decode(errors="ignore"))
```

Here's the output

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2Fsku41v1rv3qyFGDJ934p%2FScreenshot%20(112).png?alt=media&#x26;token=2969d34b-9301-41c1-a235-9d5feea4ec09" alt=""><figcaption></figcaption></figure>

That’s a fantastic milestone!&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FFBH0gQIrkDL62J65XLjv%2F535021698_749191964584529_788351706980913778_n.png?alt=media&#x26;token=70d21d86-6965-4e18-8e55-9337715ddb7e" alt=""><figcaption></figcaption></figure>

Out of 199 competing teams, we proudly secured 2nd place, demonstrating our skills and teamwork. Now, with the finals ahead, we’re more motivated than ever to push our limits, sharpen our strategies, and aim for the top spot. This achievement not only reflects our hard work but also sets the stage for an even greater challenge in the upcoming competition.
