๐Ÿ“š์บก์Šคํ†ค ๋””์ž์ธ1 <CodeEngn Basic RCE L04>

Loopy ยท2022๋…„ 5์›” 21์ผ
0

๐Ÿ”Ž์บก์Šคํ†ค ๋””์ž์ธ1

๋ชฉ๋ก ๋ณด๊ธฐ
8/19

๐Ÿ”ฅ๋ชฉํ‘œ: ์ฝ”๋“œ์—”์ง„ ๋ฒ ์ด์ง L04 ๋ฌธ์ œ๐Ÿ”ฅ

Basic RCE L04: ์ด ํ”„๋กœ๊ทธ๋žจ์€ ๋””๋ฒ„๊ฑฐ ํ”„๋กœ๊ทธ๋žจ์„ ํƒ์ง€ํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๊ฐ–๊ณ ์žˆ๋‹ค. ๋””๋ฒ„๊ฑฐ๋ฅผ ํƒ์ง€ํ•˜๋Š” ํ•จ์ˆ˜์˜ ์ด๋ฆ„์€ ๋ฌด์—‡์ธ๊ฐ€.

๋ฌธ์ œ ๋‹ค์šด๋กœ๋“œ -> zip ์••์ถ• ํ•ด์ œ
๋น„๋ฐ€๋ฒˆํ˜ธ: codeengn

์ƒํ™ฉ: ๋””๋ฒ„๊ฑฐ๋ฅผ ํƒ์ง€ํ•˜๋Š” ํ•จ์ˆ˜์˜ ์ด๋ฆ„ ์ฐพ๊ธฐ

ํŒŒ์ผ ์‹คํ–‰ ํ›„ -> ์•„๋ž˜์™€ ๊ฐ™์€ ์ฐฝ์ด ๋œจ๋”๋‹ˆ "์ •์ƒ์ •์ƒ"์ด ๊ณ„์† ๋‚˜ํƒ€๋‚œ๋‹ค.

x32dbg์— ํŒŒ์ผ ์‹คํ–‰ ํ™”๋ฉด

X32dbg๋กœ ๋ณด๋ฉด, ์•„๋ž˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์€ "๋””๋ฒ„๊น… ๋‹นํ•จ"์ด ๊ณ„์† ๋œฌ๋‹ค.

์ฐฝ์„ ๋‹ซ๊ณ  ๊ณ„์† ์ฝ์–ด๋ณด์ž...

call dword ptr ds: [<&IsDebuggerPresent>] ๋ถ€๋ถ„ = ๋””๋ฒ„๊ฑฐ ํƒ์ง€

431024: "๋””๋ฒ„๊น… ๋‹นํ•จ \n"
43101c: "์ •์ƒ \n"

์ฐพ์•˜๋‹ค :) ์œ— ๋ถ€๋ถ„๋ถ€ํ„ฐ ์ฝ์–ด๋ณด์ž.

   ์ค‘๊ฐ„์— breakpoint๋ฅผ ๊ฑธ์ง€ ์•Š์•„์„œ ๋‹ค์‹œ ์ฐพ์•˜๋‹ค.. ๋‹ค์Œ๋ถ€ํ„ฐ๋Š” ๊ผญ ๊ฑธ๋„๋ก ํ•˜์ž..!  
  

call dword ptr ds: [<&sleep>]
cmp esi, esp

IsDebuggerPresent๊ฐ€ ์‹คํ–‰ ์ „ EAX = 0 -> ์‹คํ–‰ ํ›„, EAX = 1

์ฆ‰, IsDebuggerPresent ํ•จ์ˆ˜๋ฅผ ํ†ตํ•ด์„œ

EAX๊ฐ’ = 1์ด๋ฉด ๋””๋ฒ„๊น… ๋‹นํ•˜๋Š” ๊ฒƒ์œผ๋กœ ๊ฐ„์ฃผํ•˜์—ฌ "๋””๋ฒ„๊น… ๋‹นํ•จ" ์ถœ๋ ฅ
EAX๊ฐ’ = 0์ด๋ฉด ์ •์ƒ ์ถœ๋ ฅ

-> EAX๊ฐ’์„ 0์œผ๋กœ ๋ฐ”๊ฟ”์ฃผ๋ฉด ์ •์ƒ ์ถœ๋ ฅ๋œ๋‹ค.

๋”ฐ๋ผ์„œ, ๋””๋ฒ„๊ฑฐ๋ฅผ ํƒ์ง€ํ•˜๋Š” ํ•จ์ˆ˜์˜ ์ด๋ฆ„์€ IsDebuggerPresent

----------References

profile
์ •๋ณด๋ณดํ˜ธํ•™๊ณผ ๋Œ€ํ•™์ƒ ๐Ÿ˜Š

0๊ฐœ์˜ ๋Œ“๊ธ€