ASM3 (RE6_ASM_3)
ASM3 (RE6_ASM_3)
Platform: rev_kids20 | Category: Reversing | Type: Challenge | Difficulty: Easy | OS: Linux | Author: XESXOR | Date: 2026-06-13 | Status: Solved Techniques: manual_emulation, mul_semantics, register_trace
Summary
Task: x86 NASM source asm_3.s is given and you must report the final value of register ecx. Solution: manually trace the instruction stream, applying mul semantics (EDX:EAX = EAXoperand, low 32 bits in EAX) and tracking ebx as a saved copy of the input, yielding 10^3 + 107 + 37 = REDACTED.
ASM3 (RE6_ASM_3) — rev_kids20
Description
Given x86 NASM source
asm_3.s. Answer:ecx = ?
A short beginner-level x86 (32-bit) reversing task from the Timofey/Reverse track.
The challenge gives raw NASM assembly and asks for the value of register ecx
after the final instruction executes. The answer is submitted via a POST flag
request to rev-kids20.forkbomb.ru.
Analysis
Source asm_3.s:
asm read-only • copy allowedBITS 32 global _start section .text _start: mov eax, 10 mov ebx, eax ; ebx = 10 (preserved copy of the original input) mul eax ; EDX:EAX = EAX * EAX mov esi, 10 mul esi ; EDX:EAX = EAX * ESI mov ecx, eax mov eax, ebx ; restore the original 10 from the saved copy mov esi, 7 mul esi ; EDX:EAX = EAX * ESI add ecx, eax add ecx, 37
Two facts drive the whole trace:
mul r/m32semantics — the implicit operand isEAX. The full 64-bit product is stored asEDX:EAX; the low 32 bits land inEAX, the high 32 bits inEDX. Here every product fits in 32 bits, soEDX(the high word) can be ignored entirely.ebxis a preserved copy of the original input value10. It is never clobbered by the multiply chain, so it can be restored intoeaxlater to start a second, independent computation.
Solution
Step-by-step register trace:
mov eax, 10→eax = 10mov ebx, eax→ebx = 10(saved copy)mul eax→eax = 10 * 10 = 100mov esi, 10→esi = 10mul esi→eax = 100 * 10 = 1000mov ecx, eax→ecx = 1000mov eax, ebx→eax = 10(restored from saved copy)mov esi, 7→esi = 7mul esi→eax = 10 * 7 = 70add ecx, eax→ecx = 1000 + 70 = 1070add ecx, 37→ecx = 1070 + 37 = REDACTED
The program computes:
ecx = 10^3 + 10*7 + 37 = REDACTED
Final ecx = REDACTED.
python read-only • copy allowed#!/usr/bin/env python3 # Manual emulation of asm_3.s eax = 10 ebx = eax # mov ebx, eax (saved copy) eax = (eax * eax) & 0xFFFFFFFF # mul eax -> 100 esi = 10 eax = (eax * esi) & 0xFFFFFFFF # mul esi -> 1000 ecx = eax # ecx = 1000 eax = ebx # restore 10 esi = 7 eax = (eax * esi) & 0xFFFFFFFF # mul esi -> 70 ecx = (ecx + eax) & 0xFFFFFFFF # 1070 ecx = (ecx + 37) & 0xFFFFFFFF # REDACTED print(ecx) # REDACTED
Submit the answer:
bash read-only • copy allowedcurl -s -X POST -d 'flag=REDACTED' http://rev-kids20.forkbomb.ru/...