본문 바로가기

Fake ebp 이 기법을 적용하는데에는 다음 조건이 맞으면 활용하기 좋다.1.ret이후로는 덮어 씌울수 없다.2.ret에 스택 or 라이브러리를 필터링 해놓았다. 이 기법의 이름 대로, ebp를 바꾸는 작업을 통해 다른 부분에서 ret을 뽑아낼수 있도록 바꿔주는 기법이다. 일단 모든 거의 모든 함수에는 다음과 같은 에필로그가 존재한다. leaveret 이 두가지 어셈블리는 다음과 같이 해석할수 있다. mov esp ebppop ebp pop eipjmp eip 그렇다면 이것을 이용하여 ebp를 내가 원하는 곳으로 조작할수 있고, return address에는 leave-ret의 가젯의 주소를 넣어 놓는다면, 필터링이 되지 않는 곳에서 return을 하거나, RTL공격시 인자를 주는 행위가 가능해진다.이것이 이 기법의 .. 더보기
LOB FC3 [dark_eyes -> hell_fire] 를 풀다가 생긴 의문점에 대한 분석 1.왜 로 ret을 바꾸면 쉘이 따지는가? 먼저 그부분의 어셈블리를 한번 살펴보자. 0x75077f : call 0x743d30 0x750784 : mov ecx,DWORD PTR [ebx-316]0x75078a : xor edx,edx0x75078c : xor eax,eax0x75078e : mov DWORD PTR [ebx+5820],edx0x750794 : lea edx,[ebx-47601]0x75079a : mov edi,DWORD PTR [ecx]0x75079c : mov DWORD PTR [ebx+5816],eax0x7507a2 : mov DWORD PTR [esp+4],esi0x7507a6 : mov DWORD PTR [esp+8],edi0x7507aa : mov DWORD PTR [esp].. 더보기
LOB FC3 [dark_eyes -> hell_fire] [dark_eyes@Fedora_1stFloor ~]$ cat hell_fire.c/* The Lord of the BOF : The Fellowship of the BOF - hell_fire - Remote BOF on Fedora Core 3 - hint : another fake ebp or got overwriting - port : TCP 7777*/ #include int main(){ char buffer[256]; char saved_sfp[4]; char temp[1024]; printf("hell_fire : What's this smell?\n"); printf("you : "); fflush(stdout); // give me a food fgets(temp, 1024, stdin.. 더보기