Master the fundamental concepts of binary formats through this focused micro-challenge.
You have read the whole brief, and the concepts above stay free on every task. Writing and running the code needs a plan.
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
Every task includes starter code, theory, and hidden tests so you can implement and verify locally in the browser.
How it worksBinary patching modifies an executable file directly without recompiling from source. Crackme solvers, malware analysts, and hotfix engineers all patch bytes in place when they need to change program behavior quickly.
The workflow:
offset = VA - section_VA + section_file_offsetFor example, changing a conditional jump from JNE (0x75) to JE (0x74) inverts a license check with a single-byte patch.
You will search a simulated binary for a target byte pattern, show the offset where it was found, and replace it with new values. This teaches the VA-to-file-offset conversion that Ghidra and IDA automate when you edit instructions in the decompiler view.
Changing instruction length breaks PC-relative call and jmp targets in x86 code. Single-byte patches (like flipping a jump opcode) are safest because they preserve instruction boundaries. Signed binaries detect any byte change via hash verification, which is why operating systems enforce code signing on boot loaders and app store distributions. Always work on a copy and document the original bytes before patching.
Patch an instruction in a binary safely: find the bytes, check that the patch keeps the instruction length, show where it lands in memory, and apply it.
VA = section_vaddr + (offset - section_offset).mov eax, imm32 (5 bytes starting with B8), show the old and new immediates.section_vaddr section_offset, both hex.cLoading…
Then:
Pattern not found, and stop.Error: match at 0x10 precedes section file offset 0x80, and stop.Found at file offset 0x83 (VA 0x401003), Old bytes: b8 1e 00 00 00 and New bytes: b8 3c 00 00 00 (lowercase), then
Error: replacement length 2 != pattern length 5 (unsafe patch), and stop;B8 pattern: mov imm32: 0x0000001E -> 0x0000003C (30 -> 60);Patched binary: and the dump, 16 bytes per line, each line starting with the offset as 4 uppercase hex digits and a space, then the bytes in lowercase separated by spaces: 0080 55 89 e5 b8 3c 00 00 00 89 45 fc b8 00 00 00 00.Offsets and addresses in these lines are uppercase hex.