0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

picoCTF 2019 writeup asm3

0
Last updated at Posted at 2025-12-10

asm3 (Reverse Engineering)

What does asm3(0xd2c26416,0xe6cf51f0,0xe54409d5) return? Submit the flag as a hexadecimal value (starting with '0x'). NOTE: Your submission for this question will NOT be in the normal flag format. Source

添付ファイル
・test.S

test.Sを確認する。

asm3:
	<+0>:	push   ebp
	<+1>:	mov    ebp,esp
	<+3>:	xor    eax,eax
	<+5>:	mov    ah,BYTE PTR [ebp+0x9]
	<+8>:	shl    ax,0x10
	<+12>:	sub    al,BYTE PTR [ebp+0xe]
	<+15>:	add    ah,BYTE PTR [ebp+0xf]
	<+18>:	xor    ax,WORD PTR [ebp+0x12]
	<+22>:	nop
	<+23>:	pop    ebp
	<+24>:	ret    

ebp+0x8に第1引数0xd2c26416、ebp+0xcに第2引数0xe6cf51f0、ebp+0x10に第3引数0xe54409d5が入っている。

<+5>でebp+0x9はebp+0x8の1byte offsetだから、ahに0x64を入れるのでaxは0x6400になる。
<+8>でaxを0x10bit左シフトするから、eaxが0x64000000つまり、axが0x0000になる。
<+12>でebp+0xeはebp+0xcの2byte offsetだから、alから0xcfを引くのでアンダーフローして0x0031になる。
<+15>でebp+0xfはebp+0xcの3byte offsetだから、ahに0xe6を加算するので0xe631になる。
<+18>でebp+0x12はebp+0x10の2byte offsetだから、axと0xe544でXORするので0x375になる。

フラグが得られた。

0x375

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?