ASM1 (RE6_ASM_1)
ASM1 (RE6_ASM_1)
Platform: CUSTOM | Category: Reversing | Type: Challenge | Difficulty: Easy | OS: N/A | **Author: XESXOR Techniques: manual_register_tracing, x86_div_mul_semantics
Summary
Walkthrough of the CUSTOM Reversing ASM1 (RE6_ASM_1). Task: given a short x86 NASM snippet (asm_1.s), compute the final value of eax. Solution: hand-trace the registers, applying x86 div (EDX:EAX / r32 -> quotient EAX, remainder EDX) and mul (EDX:EAX = E
Description
Given the x86 NASM source
asm_1.s. Answer:eax = ?Submitted via POST fieldflag.
A beginner reverse task: statically trace a 6-instruction x86 snippet and report the final
value of register eax.
Analysis
Source (asm_1.s):
nasm read-only • copy allowedxor edx, edx ; edx = 0 mov eax, 0x64 ; eax = 0x64 mov ebx, 30 ; ebx = 30 div ebx ; unsigned divide EDX:EAX by ebx mov eax, edx ; eax = remainder mul edx ; EDX:EAX = eax * edx
The two traps are the x86 div/mul semantics:
div r/m32divides the 64-bit dividendEDX:EAXby the operand. Quotient goes toEAX, remainder goes toEDX. EDX must be initialized (herexor edx, edxclears it so the dividend is just0x64).mul r/m32computesEDX:EAX = EAX * operand(unsigned). The high dword lands in EDX, the low dword (the answer we care about) in EAX.
Solution
Hand-trace the registers:
xor edx, edx→edx = 0mov eax, 0x64→eax = 0x64mov ebx, 30→ebx = 30div ebx→ dividendEDX:EAX = 0x0_00000064, divisor30:- quotient
eax = 0x64 / 30 = 3 - remainder
edx = 0x64 % 30 = 10
- quotient
mov eax, edx→eax = 10(the remainder)mul edx→EDX:EAX = eax * edx = 10 * 10 = 0x64, soeax = 0x64,edx = 0
Final eax = REDACTED.
Verify with an actual CPU if desired:
bash read-only • copy allowedcat > /tmp/asm1.s <<'EOF' section .text global _start _start: xor edx, edx mov eax, 0x64 mov ebx, 30 div ebx mov eax, edx mul edx ; eax now holds the answer; pass it as exit code mov ebx, eax mov eax, 1 int 0x80 EOF nasm -f elf32 /tmp/asm1.s -o /tmp/asm1.o && ld -m elf_i386 /tmp/asm1.o -o /tmp/asm1 /tmp/asm1; echo "eax = $?" # -> eax = REDACTED
Key Takeaways / Lessons
- Mastering manual_register_tracing, x86_div_mul_semantics was key to this challenge.
- Always check for common misconfigurations and verify assumptions.
Crafted by XESXOR Research • 2026-06-13 • CUSTOM • ASM1 (RE6_ASM_1) • Difficulty: Easy