shulkwisec
JCOE CTF 2025/CTF Writeups//3 min read

mal_sim (JCOE_CTF) writeup

An analyst found a “malware-like” sample sitting in a compromised lab. It behaves like a beacon stub, but the operator hid the real beacon host inside it. The binary guards its own payload with three puzzle-locks, and each lock answers to one specific input. Get all three right and it prints the hostname. Get one wrong and it says nothing useful.

The flag is the hostname, so the whole challenge reduces to one question: what is this binary actually asking for?

What we are working with

file mal_sim
# mal_sim: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
# statically linked, BuildID[sha1]=d0d0cff0e8c3871fe65ff605eaa66b268b4825d3,
# with debug_info, not stripped

Two lines in that output matter. not stripped means symbol names survived the build, so function boundaries are readable. with debug_info means the DWARF tables are still attached, which means a decompiler will show variable names and line numbers instead of a wall of guesses. Neither of those is a luxury when the goal is to understand a program that has been deliberately obfuscated.

Statically linked, so there is no dynamic loader to help us. No libc calls to intercept, no LD_PRELOAD trick to watch what it does. The program is self-contained, which also means we can run it anywhere without a matching runtime.

Reading the prompts with strings

The binary is small and the strings are legible, so the first move is the cheap one:

strings mal_sim | grep -E 'Puzzle|JCOE|obfuscated'
JCOE_CTF{%s}
[Puzzle 1] Numeric riddle: product of primes strictly between 5 and 12.
[Puzzle 2] Caesar-like: shift the word 'delta' by +4 (lowercase).
[Puzzle 3] Small ASCII sum: sum of ASCII codes of 'CTF' uppercase.
This sample contains an obfuscated 'C2-like' string embedded in the binary.
Solve the puzzles to reconstruct the key and decode the hidden value.

That is the entire puzzle in four lines. The challenge did not hide the questions, it hid the answer key. Everything the program needs from us is printed in plain text, and it even tells us the flag format, which is worth noting before you start: a format check at the end means a wrong hostname fails for a reason that has nothing to do with the hostname.

Three locks, three inputs, one hostname. No dynamic analysis needed yet.

Solving the locks

Puzzle 1: product of primes strictly between 5 and 12

“Strictly between” matters here. The primes in that window are 7 and 11. The product is 77.

77

Watch out for the obvious wrong turn: including 5 or 12 changes the answer, and “strictly” is there precisely to exclude both. The prime below 5 is 3, the prime above 12 is 13, and neither belongs in the product.

Puzzle 2: Caesar-like shift on “delta”

Shift every letter by +4, wrapping the alphabet. d becomes h, e becomes i, l becomes p, t becomes x, a becomes e.

hipxe

This one looks like it wants to spell a real word. It does not, and that is fine: the program is not checking whether your answer is meaningful, it is checking whether your answer matches the string it derived. Chasing a dictionary word here is a waste of time, the Caesar shift is mechanical and the output is what it is.

Puzzle 3: ASCII sum of ‘CTF’

Uppercase, which pins every code point:

C = 67
T = 84
F = 70
67 + 84 + 70 = 221

Running it

The program takes each answer on its own line:

./mal_sim
=== MAL_SIM: analysis-only sample (safe) ===
This sample contains an obfuscated 'C2-like' string embedded in the binary.
Solve the puzzles to reconstruct the key and decode the hidden value.

[Puzzle 1] Numeric riddle: product of primes strictly between 5 and 12.
Answer: OK
[Puzzle 2] Caesar-like: shift the word 'delta' by +4 (lowercase).
Answer: OK
[Puzzle 3] Small ASCII sum: sum of ASCII codes of 'CTF' uppercase.
Answer: OK

=== DECODED RESULT ===
JCOE_CTF{dark-lighthouse.com}

Each answer is confirmed with Answer: OK as it is accepted, so a mistake is visible immediately and you can re-run with one input changed rather than restarting the analysis.

What to take from this one

The shape of the challenge is common in CTF malware-simulations: the “malware” part is theatre, and the actual work is reading a program that is telling you what it wants. strings is usually enough, because a program that prompts a human for a secret cannot hide that prompt from a strings dump, no matter how the payload itself is obfuscated.

Three habits carried over from this solve:

  1. Read the prompts before touching the code. The questions are the specification.
  2. Solve the locks on paper first. Every one of these three was arithmetic or a single character shift, and doing them by hand took less time than setting up a debugger.
  3. Keep the exact literal in mind. “Strictly between”, “lowercase”, “uppercase”: each word in a riddle is a constraint, and the constraint that gets skipped is the one that fails.

The flag:

JCOE_CTF{dark-lighthouse.com}