최상단

컨텐츠

_alloca_probe_16

글 정보

Category
컴퓨터 이야기/Security
2014. 3. 15. 21:57

본문

리버싱을 하다 IDA 에서 
_alloca_probe_16 라는 함수를 만났다. 
뭔 함수인지는 모르겠는데 디버깅을 하다보니 스택의 위치(ESP)의 위치가 바뀌는 것을 확인할 수 있었다. 
스택에 동적으로 메모리를 할당하는 함수를 찾아보니 
malloca()
이라는 함수가 있었다. 
이 함수를 사용하면 스택에 메모리를 할당하게 되고, 이는 IDA에서

    _alloca_probe_16((unsigned int)&v5 ^ __security_cookie);
    v1 = (int *)&v4;
    if ( &v4 )
    {
        v4 = 0xCCCCu;
        v1 = (int *)&v6;
    }

이런 식으로 보여진다.
디버깅을 해보면 스택이 늘어나는 것을 확인할 수 있다......-0-;;

아래는 테스트 해본 소스 코드. 

// stackDynamicAllocTest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <malloc.h>

int stackTestFunc(int size)
{
     int stack_var1;
     int *allocArray = (int*)_malloca(size*4);
     int stack_var2;

     for ( int i = 0 ;i < size ; i++) {
          allocArray[i] = i;
     }
     return 0;
}

int _tmain(int argc, _TCHAR* argv[])
{
     stackTestFunc(100);
     return 0;
}





트랙백과 댓글 여닫기

페이징

PREV NEXT

1 ··· 4 5 6 7 8 9 10 ··· 369

TOP