ByteToFlag
Menu
Stage 1 learning path
  1. Module 1 · Task 1 · Read the Mark
  2. Module 2 · Task 2 · Find the Split
  3. Module 3 · Task 3 · Hear the Words
  4. Module 4 · Task 4 · Find the Gate
  5. Module 4 · Task 5 · Signal Check
  6. Stage 1 checkpoint · The Forged Ledger
Task contents

Signal Check

Task 5 of 5 · Stage 1 · Read files · Next: Stage 1 checkpoint · The Forged Ledger

Bring the earlier skills together. Locate the check, undo its position-dependent byte transformation, then test your recovered input and a near miss.

  • ~60 min
  • 6 checks + final flag
  • Ghidra · Windows x64
Prepare the signal sample → Check your Ghidra setup
You will use this when
a program keeps its secret slightly scrambled and checks your input against it — common in licence checks, malware configuration and capture-the-flag tasks. You find the check, undo the scramble and test your answer on the program itself.
Later in this path
the Stage 1 checkpoint, The Forged Ledger, combines bytes, strings and a check like this one in one file, without hints; Stage 2 (planned) starts from the assembly behind it.
After this task you can
locate a check, undo a position-dependent XOR, and back your answer with an accepted run and a refused near miss.

Keeper: Until now I tore the pages out for you. This one I will not. It is a whole program from the archive, untouched by the Overwrite, and it guards one word behind a check. No one will point at the bytes this time. Find where it decides, undo what it does to the word, and make the program itself agree. Do that, and this region's gate opens to you.

You will learn

  • find the function where a program decides, and read its conditions
  • undo a byte transformation whose key changes with the position
  • test a result on the program: one input accepted, a near miss rejected
You need
Task 1 · Read the Mark, Task 2 · Find the Split (including part B, Unlock the Copper), Task 3 · Hear the Words and Task 4 · Find the Gate. Tasks 3 and 4 have their samples and guided steps available; follow them first if Ghidra or program checks are new to you
Time
~60 minutes, with the Ghidra import
Tools
Windows x64, PowerShell, Ghidra (needs a 64-bit JDK), a notes file

Where this is used

An analyst who holds a program but not its source often needs one answer: what makes it say yes? The routine might be a licence or login check, a test that a malware sample runs before it unpacks, or a loop that unmasks a hidden setting with XOR. The job is the same each time: find the function that decides, write its condition down exactly, and test it on the program. Here the four skills of Stage 1 meet in one file: bytes, XOR, strings and the gate.

House rule: analyse only files you own or may examine; this sample is written by us. Laws on reverse engineering differ by country and licence — this site is not legal advice.

Get ready

Ghidra needs Java. Ghidra has no installer: you extract it and run it, and it needs a 64-bit Java Development Kit (JDK). Ghidra 12.2 asks for JDK 25; check the Getting Started notes of the version you download. Start Ghidra and create an empty project: if that works, you are ready. Every tool step by step: Set up your lab.

Archive program

signal-check.exe

Original Windows x64 console checker. Read it first; run it only in step 3.

SHA-256: b6e7deed0ab31cf6a376228a0bb7a7fa1bf665b1b1f503b80a599f96a58953dc

VirusTotal: 0 / 71 engines reported a detection (scanned 21 November 2026). See the report.

Download challenge

Before you run it, compare its SHA-256 fingerprint and read why Windows may warn you: Downloads and safety. Keep it and your notes in one task folder. The website never receives your input or runs the checker; see Privacy.

Step 1 of 3 · ~10 min

Read the notation

Ghidra's decompiler turns machine instructions back into C-like text. Its names and types are guesses, not the original source; four signs carry the meaning.

  • input[i] — the byte at position i, counted from 0. i is where; input[i] is what is there.
  • ^ — XOR, as in task 2: a bit is 1 where the two inputs differ. Not a power. XOR with the same key twice gives back the start: 0x43 ^ 0x12 = 0x51, 0x51 ^ 0x12 = 0x43.
  • & 0xFF or (byte) — keep only the lowest eight bits, the last two hex digits: 0x1A4 & 0xFF = 0xA4.
  • == compares, = stores, != means “differ”. A branch that returns failure on != tells you what must be equal to go on.
A row of four bytes, values in hex as a hex editor shows them · made up for this page
Index:   0   1   2   3
Value:  10  20  30  40    (hex: 10 means 0x10)
H1 · Direction

Read the top line for the position, the bottom line for what is stored there.

H2 · Method

Index 0 holds 10. Move right one column per index until the top line says 3.

H3 · Check

If you answered 0x30, you counted the first column as 1.

Now a whole check in miniature, the shape step 2 will show you. It is made up for this page.

Practice check · made up for this page
key(i) = (i * 0x60) & 0xFF
accept when  input[i] ^ key(i) == stored[i]   for i = 0..3
stored:  57 21 92 64

To recover a byte, undo the XOR with the same key: input[i] = stored[i] ^ key(i). Worked row, i = 1: key = 0x60; 0x21 ^ 0x60 = 0x41, which is A. Keep a table: index · key · stored · result · letter, and read each result with an ASCII table for the printable range 0x20–0x7E (task 1 covered A–Z; here you also need _ = 0x5F, { = 0x7B and } = 0x7D). Watch index 3: 3 × 0x60 = 0x120 has three hex digits, and & 0xFF keeps only the last two, so the key is 0x20. Compute every row; do not finish a word because it looks familiar.

Fill in your notes: one row per index. Row 1 is worked for you.
ikey(i) = (i × 0x60) & 0xFFstored[i]stored ^ keyletter
00x0057……
10x60210x41A
2…92……
3… (cut to 8 bits)64……
H1 · Direction

Work one index at a time, 0 to 3. Each index has its own key.

H2 · Method

Keys: 0 × 0x60, 1 × 0x60, 2 × 0x60, 3 × 0x60, each cut to eight bits. XOR each key with the stored byte at the same index, then read the result with the printable ASCII table (0x20–0x7E).

H3 · Check

3 × 0x60 = 0x120: three hex digits, so keep 0x20. Every result lies in 0x41–0x5A, the capitals.

Step 2 of 3 · ~25 min

Find the check

In task 4 you found a gate by its exported name. This program names its check too: check_flag. The name only shows you where to look; the conditions inside are the evidence.

  1. Import. In Ghidra: File → New Project → Non-Shared Project, then File → Import File and choose signal-check.exe. Accept the detected Portable Executable format for x86-64, open the program and let the analysis run to the end.
  2. Open the check. In Symbol Tree → Exports, select check_flag. If a pane is missing, open it from the Window menu.
  3. Read the first real condition. Record the required input length and note whether Ghidra shows it in hex. The program removes the newline you type before it checks.
  4. Follow one loop pass. Find the input byte, the index, the helper that computes the key, the operator, the stored byte and the branch on a mismatch. Double-click the helper to read what it returns for i; double-click the data label to see the stored bytes.
The shape you are looking for · names, constants and the operation removed
if (input == NULL) return 1;1len = strlen(input);if (len != 0x??) return 1;2for (i = 0; i < 0x??; i++) {3    k = FUN_????????(i);4    if (op(input[i], k) != DAT_????????[i])5        return 1;}return 0;
  1. 1A guard. It rejects a missing input and says nothing about the answer.
  2. 2The first real condition: the length.
  3. 3One pass per input byte. The bound should agree with 2.
  4. 4The helper. What it computes from i is the key for that position.
  5. 5The real operator and the stored bytes, behind a data label.
Ghidra Decompiler showing check_flag. The length condition is outlined and marked 1, the loop header marked 2, the helper call marked 3, and the comparison with the data label marked 4. The constants and the helper's name are covered by solid bars.
Figure 5.1 — The four lines of check_flag that decide.
H1 · Direction

Skip the guard against a missing input. The next if that returns 1 compares the length with a constant.

H2 · Method

If the constant starts with 0x, convert it as in task 1: left digit × 16 + right digit. Right-click the constant in the Decompiler to see it in other bases.

H3 · Check

The loop bound in callout 3 must be the same number. If they differ, you are reading two different variables.

H1 · Direction

Double-click the helper's name in the Decompiler. Its return line is an expression in its one parameter.

H2 · Method

Write the expression in your notes, put 0 where the parameter is, and work it out as in the practice check.

H3 · Check

A key is one byte: at most two hex digits. If you get more, keep the eight bits the helper keeps.

Ghidra Listing after double-clicking the data label in check_flag. The label is marked 1; the first stored byte, index 0, is marked 2; the byte values are covered by a solid bar.
Figure 5.2 — The stored bytes behind the data label.
H1 · Direction

The comparison in callout 5 reads from a data label. Double-click it.

H2 · Method

The Listing jumps to the label. The first byte after it is index 0; the next are 1, 2, 3 in address order.

H3 · Check

Count the bytes until the next label: there should be as many as the length you recorded.

Step 3 of 3 · ~30 min, more if every XOR is by hand · the flag

Recover and test

  1. Derive the inverse. Write the formula that gives one input byte from its stored byte and index, using exactly the operations and widths in your listing. If the operation is XOR, it is the formula from the practice check.
  2. Fill the table. One row per index: index · key · stored · result · character. Do not replace a byte you have not derived with a letter that “looks right”.
  3. Before you run: write why your candidate should pass every condition. Then change one character, keep the length, and write where that one should fail.
  4. Run both. Open PowerShell in your task folder, run the program, type a candidate at its prompt, press Enter, then read the exit code: 0 accepted, 1 rejected, 2 no input read.
PowerShell · run, type your candidate, then read the exit code
.\signal-check.exe
$LASTEXITCODE
PowerShell window with two runs of signal-check.exe. First run: the typed candidate is hidden; the program accepts it and the exit code is 0. Second run: the same candidate with one character changed, also hidden; the program rejects it and the exit code is 1.
Figure 5.3 — Accepted and rejected, side by side.
H1 · Direction

Read $LASTEXITCODE right after the second run, before you run anything else.

H2 · Method

The meaning of each code is in item 4 above.

H3 · Check

If you got 0, the character you changed is not checked — or you changed it back. If you got 2, nothing was typed.

Now the flag: the candidate the program accepted, exactly as you typed it, in the format B2F{…}.

H1 · Direction

Everything is inside check_flag: one condition on the whole input, one repeated per byte. Your table from step 2 already holds row 0.

H2 · Method

For each index: key from the helper, stored byte from the data label, undo the operation, read the character. If the operation is XOR, the same key undoes it.

H3 · Check

Your first four characters must be B2F{ and the last }. If byte 0 is wrong, recompute the key for i = 0 and check the eight-bit cut. Type the flag exactly: case counts.

Walkthrough

Stuck after the hints? Show the walkthrough — it shows the method and the page's own answers
  1. Step 1, the row. Index 3 is the fourth column: 0x40.
  2. Step 1, the practice check. Keys: 0x00, 0x60, 0xC0, and 0x120 cut to 0x20. 0x57 ^ 0x00 = 0x57 W; 0x21 ^ 0x60 = 0x41 A; 0x92 ^ 0xC0 = 0x52 R; 0x64 ^ 0x20 = 0x44 D: WARD.
  3. Step 2. The length is the constant in the first if after the guard, converted to decimal. The key for i = 0 is the helper's return expression with 0 put in, cut to eight bits. The stored byte at index 0 is the first byte after the data label. These three come from your own listing; this page does not print them.
  4. Step 3. input[i] = stored[i] ^ key(i), eight bits, for every index. The one-character change exits with 1. The flag is not printed anywhere on this site: it is the one answer this task asks you to derive, and the program is the judge.

Bonus

Explain your result in five lines

In your notes, one line each: where the candidate is checked (function and address); which conditions it must meet; how you undid one byte and extended it to all; what the runs showed, accepted and rejected; and what you have not checked.

I have written my note — show the model note
Location
The exported function check_flag, at the address on its first Listing line. The decision is its length condition and the comparison inside its loop.
Conditions
The input must have the exact length in the first condition, and for every index the transformed input byte must equal the stored byte at the same index.
Derivation
The key for each index comes from the helper, cut to eight bits. The operation is XOR, so input[i] = stored[i] ^ key(i). Row 0 gave B; the same rule gave every other row.
Validation
The recovered candidate exits with 0. The same candidate with one character changed exits with 1.
Boundary
I read only check_flag and its helper. I did not check how the program reads input beyond removing the newline, or anything else in the file.

Check yours: an address beside the location, the length as a number, the formula written out, both exit codes, and one thing you did not check. Each “no” is what to add.

This is guided practice. Next, use the Stage 1 checkpoint, The Forged Ledger, to test your work without hints. A separate no-hints version of this task is planned.

What you did

  • Found where a real program decides: an exported function, its length rule and its per-byte comparison.
  • Undid a position-dependent XOR byte by byte, keeping eight bits, from a table you built.
  • Tested it on the program itself: your candidate accepted with exit code 0, a near miss rejected with 1.

Read further

  • Ghidra on GitHub — the official project page: install guide, Getting Started notes and the built-in help.
  • Microsoft — PE Format — the official layout of Windows programs, including the export table that lists check_flag.
  • FLARE FLOSS — recovers strings a program hides with XOR and similar tricks; compare its output with what you did by hand.
  • Wikipedia — XOR cipher — background on the operation the checker uses, and why a repeated key is weak.

Outside sites, not ByteToFlag. Links checked on 21 November 2026.

From guided practice to the checkpoint

Before you move on

  • Can you locate the check and explain its length and per-byte conditions?
  • Can you derive each key with the correct eight-bit width, then recover every input byte without guessing?
  • Can you document an accepted input, a refused near miss and the limits of what you tested?

If one is unclear, revisit that step or compare your five-line explanation with the model note. The final flag records guided practice. It does not award the stage title.

This is the last guided task of Stage 1 · Read files. Next is The Forged Ledger, the separate unaided Stage 1 checkpoint. Passing it earns Reader of Marks. Module 05, Just Enough Assembly, begins Stage 2 · Trace code; that stage is planned.

Updated 27 November 2026: task availability and the separate Stage 1 checkpoint are clarified. A guided flag does not award the stage title.

View The Forged Ledger requirements → Review all five guided tasks Back to Module 4