ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [2021/09/27][짤막한 이야기 - 임포트 주소 테이블 복원(상세)]
    짤막한 이야기 2021. 9. 27. 06:38
    728x90
    반응형

    [2021/09/27][짤막한 이야기 - 임포트 주소 테이블 복원(상세)]
    앞선 포스트에서 IAT 복원과 관련한 PinTool 소스코드를 아주 일부만 제공하였다.
    제공된 소스코드는 특정 함수가 호출되는 시점에서 해당 함수의 인자값과 반환값을 읽어들이는 기능의 명세 부분에 해당한다.
    "LoadLibraryA"와 "GetProcAddress" 함수의 동작 원리를 검색하여본다면, 이것이 어떻게 IAT를 복원하는지 쉽게 파악할 수 있다.
    실제로 인자값과 반환값의 기록을 수행하는 부분은 그림과 같다.
    이 때, "메모리 쓰기"를 모니터링하여 실제 IAT가 언패킹 과정 중 복원이 되는 "위치"를 파악하여야 하는데, 이에 대한 소스코드도 함께 제시한다.
    "메모리 쓰기"는 특정 함수가 수행하는 것이 아니라 특정 명령어(Instruction)가 수행하는 것이기 때문에 PinTool API 중 "Instruction" 함수에 명세되어야 한다.
    각 단위에 대한 모니터링 혹은 변조에 대한 내용은 "제1부"에서 상세하게 기술되어 있으며, 이를 이해하기 위해서는 PinTool에서 제공하는 "계측 코드(Instrumentation Code)"와 "분석 코드(Analysis Code)"의 개념을 이해하여야 한다.
    앞으로 PinTool의 이론적인 내용도 포스팅 할 예정이다.
    [관련된 문서 - 핀툴 프로그래밍 기본서[제3부. 핀툴로 UPX 언패킹하기]]
    #이야기 #루니프 #핀 #핀툴 #패킹 #언패킹 #IAT #함수인자값 #함수반환값 #IAT위치

    [2021/09/27][Short Story - Import Address Table Restoration(Details)]
    In the previous post, only a small part of the PinTool source code related to IAT restoration was provided.
    The provided source code corresponds to the specification part of the function that reads the function's argument values ​​and return values ​​when a specific function is called.
    If you search the principle of "LoadLibraryA" and "GetProcAddress" functions, you can easily understand how this restores IAT.
    The part that actually records the argument and return values ​​is as shown in the figure.
    At this time, it is necessary to monitor the "Memory Write" to determine the "Location" where the actual IAT is restored during the unpacking process, and the source code for this is also presented.
    "Memory Write" is not performed by a specific function, but by a specific instruction, so it must be specified in the "Instruction" function of the PinTool API.
    The contents of monitoring or modulation of each unit are described in detail in "Part1", and in order to understand this, it is necessary to understand the concepts of "Instrumentation Code" and "Analysis Code" provided by PinTool.
    I will post the theoretical contents of PinTool in the future.
    [Related Documents - Basic Book for PinTool Programming[Part3. Unpacking UPX with PinTool]]
    #Story #LootNiP #Pin #PinTool #Packing #Unpacking #IAT #FunctionArgumentValue #FunctionReturnValue #IATLocation

    728x90
    반응형
Designed by Tistory.