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

Read the Mark

Task 1 of 5 · Stage 1 · Read files · Next: Task 2 · Find the Split

An unnamed file. Sixteen bytes. Work out what kind of file it could be, and explain which bytes support your finding.

  • ~20 min
  • 3 checked steps
  • Nothing to install
Begin with the bytes → Read the Keeper's brief

Already read hex and know the MZ mark? Skip to Task 4 · Find the Gate; it needs the lab tools first.

You will use this when
a file arrives with a name you cannot trust — an e-mail attachment called invoice.pdf, a file left on a server — and you need to know what it really is before anyone opens it. Its first bytes usually tell you.
Later in this path
task 2 reads whole rows of bytes by position; task 3 checks that a download really is a Windows program; the Stage 1 checkpoint asks you to find a changed byte in a file’s header.
After this task you can
turn a hex byte into a number and a letter by hand, and say what kind of file sixteen bytes point to — and why that is only a lead.

Keeper: The Overwrite does not burn pages. It rewrites them and leaves the old title on top, so I stopped trusting titles. This page reached my archive with none — sixteen marks, nothing more. Most files still carry their kind in their first bytes. A mark can be forged too — but it is where you start. Read that mark for me, by hand, before you trust a single road on it.

What you will learn

  • read a hex byte as a number
  • turn bytes into letters with the ASCII table
  • name a file's format from its first bytes, its signature
You need
nothing before this — it is the first task. Chapter 01 of the story is optional context
Time
~20 minutes
Tools
a notes file or paper. Nothing to download

Where this is used

Reverse engineering is working out how something works from the thing itself, without its source code or documents. Its smallest real job is this one: an unknown file turns up in an incident — an e-mail attachment, a file left on a server — and the first question is what it really is. Names lie: a file called invoice.pdf can be a program. Triage and recovery tools answer by reading the first bytes. Here you do that by hand.

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

Step 1 of 3 · ~6 min

A byte is a number

The Keeper's page: sixteen bytes
  1. 4D0
  2. 5A1
  3. 902
  4. 003
offset  00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00      4D 5A 90 00 03 00 00 00 04 00 00 00 FF FF 00 00

Each pair of characters is one byte: a number from 0 to 255, written in hexadecimal. Hex digits run 0–9, then A–F for 10–15. The left digit counts sixteens, the right digit counts ones: 0x23 = 2 × 16 + 3 = 35, and with a letter digit, 0x2C = 2 × 16 + 12 = 44. The 0x only says “this is hex”.

That is all the maths in this task: times 16, then add. A calculator is fine. A wrong answer only says “Not yet” and points you to a hint; nothing is recorded against you.

Bytes are numbered from zero. That number is the byte's offset — where it sits, not what it holds. The first byte is at offset 0, the second at offset 1. In the dump above, the first column (offset, then 00) is not a byte: it says where the row starts. The bytes begin after it, and the header row numbers them 00 to 0F.

H1 · Direction

Offset 2 is the third byte: count 0, 1, 2 from the left.

H2 · Method

Split the byte into its two digits. Multiply the left one by 16 and add the right one, as with 0x2C above.

H3 · Check

A byte whose left digit is 8 or more is at least 128. If your answer has two digits, you read the hex as if it were decimal.

Step 2 of 3 · ~8 min

A byte can be a letter

Text is bytes read through a table called ASCII. Today you need one range: uppercase A–Z are 0x41–0x5A, in alphabet order. To read a byte, subtract 0x41 and count that many letters on from A. Worked example: 0x4B − 0x41 = 0xA = 10, and ten letters on from A is K.

Two things that trip people up. First, A itself is 0 steps on: A is 0, B is 1, C is 2 … K is 10, Z is 25. Second, if subtracting in hex is new, do it in decimal with step 1’s method: 0x4B = 4 × 16 + 11 = 75, 0x41 = 4 × 16 + 1 = 65, and 75 − 65 = 10 — the same answer.

Bytes such as 0x00, or anything above 0x7F, are not plain ASCII text. Note them as you see them; do not force a letter on them.

Practise on a scrap the Keeper tore from another file:

The scrap, offsets 0 to 3
89 50 4E 47
H1 · Direction

Skip byte 0, 0x89: it is above 0x7F. Convert the other three one at a time.

H2 · Method

For each byte: subtract 0x41, turn the difference into decimal, count that many letters on from A. Writing the alphabet with 0, 1, 2… under it helps.

H3 · Check

All three land inside A–Z. Together they are a short name you may have seen at the end of an image file's name.

Step 3 of 3 · ~5 min · the flag

Read the Mark

A signature (or magic number) is a fixed byte pattern at the start of a format. Analysts look it up in a table like this one — the format, not the letters:

First bytesFormat
89 50 4E 47PNG image (step 2)
25 50 44 46PDF document
50 4BZIP archive — DOCX, XLSX, JAR and APK files are ZIP archives too
4D 5AWindows or DOS executable image — programs, but also DLLs and drivers

Not every format has one (plain text has none), some keep it further into the file, and a signature can be faked. It is a strong lead, not a proof.

Now the Keeper's page. Read its bytes 0 and 1 the same way, and write both subtractions in your notes — the bonus note asks for them.

A flag is this site’s confirmation that the final answer was accepted. Enter the two letters below; a correct check reveals your flag and, when saving is on, records this task as guided practice. You can also mark practice yourself in the progress controls; that is self-reported, not a checked answer.

H1 · Direction

Only bytes 0 and 1 make the mark. The rest describes the file's layout and can wait.

H2 · Method

The same as step 2: subtract 0x41 from each byte, convert the difference to decimal, count on from A.

H3 · Check

Both letters lie inside A–Z, and 0x5A is the top of that range. A letter past Z means a subtraction went wrong.

Walkthrough

Stuck after the hints? Show the walkthrough — it shows every answer
  1. Step 1. Offset 2 holds 0x90: 9 × 16 + 0 = 144.
  2. Step 2. 0x50 − 0x41 = 15 → P; 0x4E − 0x41 = 13 → N; 0x47 − 0x41 = 6 → G: PNG.
  3. Step 3. 0x4D − 0x41 = 12 → M; 0x5A − 0x41 = 25 → Z: MZ.
Hex view of the sixteen bytes. Offsets 00 and 01, values 4D and 5A, are highlighted; the text column shows them as M and Z.
A generated view of this page's own bytes, drawn by ByteToFlag — not a screenshot of a particular tool.

Bonus

Explain your finding

In your notes: what kind of file this is and which bytes say so; and would you start by reading it or by running it, and why. Reading a file's bytes (static analysis) does not run it, so the file gets no chance to act on your computer. Running it (dynamic analysis) shows what it does in that run, but needs a separate, safe machine.

I have written my note — show the model note
Observed
Bytes 0–1 are 4D 5A. 0x4D = 0x41 + 12 → M; 0x5A = 0x41 + 25 → Z.
Hypothesis
The file starts with “MZ”, the signature of a DOS or Windows program, so it is probably a program, not a document.
How I would start
By reading it, not running it: I do not know yet what it does, and reading its bytes does not run it.
Unknown
Whether it is a full Windows program or only an old DOS one, and whether the rest of its header agrees. Two bytes are a lead, not a proof.

Check yours: did you show the arithmetic, point at the exact bytes, choose a way to start with a reason, and say what you have not checked? Each “no” is what to add.

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

Read further

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

Take your method to the next task

Before you move on

  • Can you tell an offset from the value stored there?
  • Can you explain how a hex byte becomes a number or a letter?
  • Can you name the likely file type, point to the signature bytes that support it, and say what they do not prove?

If one is unclear, return to that step or compare your explanation with the model note. Capturing the flag records guided practice. See how this task relates to the independent checkpoint.

Task 2 · Find the Split: two copies of a map disagree; in part B, Unlock the Copper, copper marks say which one the Overwrite wrote. From task 3 on you will need a few free tools: set up your lab when you get there.

Task 2 · Find the Split Your map Back to Module 1