728x90 ๐์ ๋ณด๋ณด์/๋ฆฌ๋ฒ์ฑ6 ๋ฆฌ๋ฒ์ฑ - go ์ธ์ด .exe ํ์ผ main ํจ์ ๋ฐ print ํจ์ ์ฐพ๊ธฐ main ํจ์ ์ฐพ์ ๋ฐฉ๋ฒ IDA์์ ํจ์ ๋ชฉ๋ก์ ๋ณด๋๊น main_main์ด ๊ทธ๋๋ก ๋ ธ์ถ๋์ด ์์์ (x64dbg์๋ ida์ฒ๋ผ ์๋ธ๋ฃจํด์ ๋ฆฌ์คํธํํ๋ ๊ธฐ๋ฅ์ด ์์์ผ๋ฉด ์ข๊ฒ ๋ค.. ) x64dbg์์๋ ํจ์๋ค์ ์ฐพ๊ธฐ ์ด๋ ค์ ๋๋ฐ ์ฝ๋๋ฅผ ํ์คํ์ค์ฉ ์ฒ์ฒํ ์คํ์ ํ๋ฉด ์ค๋ ๋ ๋ฌธ์ ์ธ์ง ์๊พธ ์์ธ ์ค๋ฅ๊ฐ ๋ฌ๋ค.. (์ฐพ์๋ณด๋๊น SEH: Structured Exception Handling๋ผ๋ ๊ฒ ๊ฐ๋ค. ์ฃผ๋ก ์๋ชป๋ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ฐธ์กฐํ๋ ๊ฒฝ์ฐ ๋ฐ์) Exception 0x80000004 0x0 0x0 0x623c1d PC=0x623c1d runtime.mstart0() C:/Program Files/Go/src/runtime/proc.go:1553 +0x5d fp=0x74521ffb38 sp=0x74521ffb10 pc=.. 2024. 3. 7. ๋ฆฌ๋ฒ์ฑ - Bush hid the facts, ์๋์ฐ XP ๋ฉ๋ชจ์ฅ ๋ฒ๊ทธ ๋ฌธ์ ํ์ธ 1. ๋ฉ๋ชจ์ฅ์ ์๋ก ๋ง๋ค์ด์ ์์ "Bush hid the facts"๋ฅผ ์ ๋ ฅํ๋ค. "๋ถ์ ๋ํต๋ น์ ์ง์ค์ ์จ๊ธฐ๊ณ ์๋ค"๋ผ๋ ๋ป์ ์ฌ์คํ(?) ๋ด์ฉ์ด๋ค. 2. ๋ฉ๋ชจ์ฅ์ ์ ์ฅํ ํ์ ๋ค์ ํ์ผ์ ๋ด์ฉ์ ๋ค์ฌ๋ค๋ณธ๋ค. ๊ทธ๋ฌ์ ๋ณธ๋ ๋ด์ฉ์ด ์์ด์ง๊ณ ๊ธ์๊ฐ ๊นจ์ ธ์ ๋์จ๋ค. ๋ฌธ์ ๋ถ์ 1. ํน์๋ ๋ฉ๋ชจ์ฅ์์ ๋ฐ์ํ๋ ์ค๋ฅ ์๋๊น ํ๊ณ cmd ์ฐฝ์์ type ๋ช ๋ น์ด๋ก ํ์ผ์ ๋ด์ฉ์ ํ์ธํด ๋ณด์๋ค. ํ์ธํด๋ณธ ๊ฒฐ๊ณผ ์ค์ ํ์ผ์ ๋ด์ฉ์ ๊ทธ๋๋ก์ธ๊ฑธ ๋ณด์ ๋ฉ๋ชจ์ฅ์์ ์๊ธฐ๋ ์ค๋ฅ์ธ ๊ฒ์ด๋ค. 2. ๊นจ์ง ํ์ผ์ (B.txt๋ก) ์ ์ฅํ๊ณ ํฅ์ค ์๋ํฐ๋ก ๋ถ์ํด๋ณธ๋ค. ๋ถ์์ ํด๋ณด๋ฉด ์๋ณธ์ธ A.txt๋ ๋ด์ฉ์ด ์ ์ ์ฅ๋์๋ ๋ฐ๋ฉด B.txt๋ ๋ด์ฉ ์์ FF FE๋ผ๋ ํ์ผ ํค๋๊ฐ ๋ค์ด๊ฐ๊ฒ ๋๋ค. ํ์ธํด ๋ณธ ๊ฒฐ๊ณผ FF FE๋ UT.. 2023. 7. 12. ๋ฆฌ๋ฒ์ฑ - ์จ๋ผ์ธ ์์ค ์ฝ๋์์ ์ด์ ๋ธ๋ฆฌ ์ฝ๋๋ก ๋ณํ(godbolt.org) https://godbolt.org/ Compiler Explorer godbolt.org ์ฐธ๊ณ : https://www.youtube.com/watch?v=gPsYkV7-yJk 2023. 4. 17. ๋ฆฌ๋ฒ์ฑ - ๋ฐ์ด๋๋ฆฌ์ ์ค์ ๋ ๋ณดํธ ๊ธฐ๋ฒ ํ์ธ(checksec) checksec -f {ํ์ผ} RELRO(RELocation Read-Only): Read-Only ๊ถํ ์ค์ ์ผ๋ก Write ๊ฐ๋ฅํ์ง ์ฌ๋ถ Stack Canary: Return Address Overwrite ์ฌ๋ถ ํ์ธ Stack Canary๋ ์นด๋๋ฆฌ๋ฅผ ํตํด ์คํ ์ค๋ฒํ๋ก์ฐ๋ฅผ ๊ฐ์งํ๋ค. NX(No-eXecute): NX๋ฅผ ์ฐํํ ์ ์๋ ๊ฐ์ฅ ๋ํ์ ์ธ ๋ฐฉ๋ฒ์ ROP(Return Oriented Programming) NX(No-eXecute)๋ ์์ฝ๋ ์คํ์ ๋ฐฉ์งํ๋ค. ASLR(Address Space Layout Randomization): ์คํ๋ ๋๋ง๋ค ๋ฐ์ดํฐ ์์ญ(์คํ, ํ, ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ฑ)์ ์ฃผ์๋ฅผ ๋๋ค์ผ๋ก ๋ณ๊ฒฝ Windows์ฉ checksec https://github.com/Wenzel/che.. 2023. 3. 26. ๋ฆฌ๋ฒ์ฑ - ์๋์ฐ ์์ฝ๋ ์คํ C์ธ์ด ์์ค #include #include int main(void){ char shellcode[] = {0x00,}; void *exec = VirtualAlloc(0, sizeof shellcode, MEM_COMMIT, PAGE_EXECUTE_READWRITE); memcpy(exec, shellcode, sizeof shellcode); ((void(*)())exec)(); return 0; } 2023. 3. 23. ๋ฆฌ๋ฒ์ฑ - ๋ฆฌ๋ฒ์ค ์ฝ์ด(ReverseCore) https://reversecore.com/18?category=216978 PE(Portable Executable) File Format (1) - PE Header Introduction Windows ์ด์์ฒด์ ์ PE(Portable Executable) File Format ์ ๋ํด์ ์์ฃผ ์์ธํ ๊ณต๋ถํด ๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค. PE format ์ ๊ณต๋ถํ๋ฉด์ Windows ์ด์์ฒด์ ์ ๊ฐ์ฅ ํต์ฌ์ ์ธ ๋ถ๋ถ์ธ Process, Memory, D.. reversecore.com ๋ฆฌ๋ฒ์ฑ ํต์ฌ ์๋ฆฌ ์ ์๋ถ์ด ์ด์ํ์๋ ๋ธ๋ก๊ทธ์ธ๋ฐ ์ด์์ฒด์ ์ ๊ตฌ์กฐ ์๋ฆฌ(PE)์ DLL Injection, API Hooking๊ณผ ๊ฐ์ ์์ธํ ํดํน ๊ธฐ๋ฒ์ ์๋ฆฌ๋ ์ ์ค๋ช ์ด ๋์ด์๋ค. 2022. 9. 16. ์ด์ 1 ๋ค์ 728x90