Frida Hooking 질문 있습니다.

홈 > 커뮤니티 > 질문 게시판
질문 게시판

Frida Hooking 질문 있습니다.

4 py0zz1 3 4411
질문 글을 너무 많이 올리는 것 같네요..ㅠ
Frida Unity App Hooking 관련 레퍼런스를 계속 찾아봤는데, 다 코드수정하는거 뿐이라.. 질문할 곳이 여기 뿐이네요

var libmono = Module.enumerateExports("libmono.so");

libmono.forEach(function (func, index, array)
{
    if(func.address != 0x0)
    {   
        Interceptor.attach(func.address,
        {
            onEnter: function(args)
            {
                console.log("[*] "+func.name);
            },
            onLeave: function(){}
      });
    }
});

위와 같이 libmono.so의 함수오브젝트들을 가져와서 forEach문에서 Trace하는 코드입니다.

[*] mono_class_get_name
[*] mono_class_get_namespace
[*] mono_class_get_image
[*] mono_image_get_name
[*] mono_domain_get
[*] mono_object_new
[*] mono_class_vtable
[*] mono_mempool_alloc0
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_type_generic_inst_is_valuetype
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_enum_basetype
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_type_get_underlying_type
[*] mono_class_from_mono_type
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_get_root_domain
[*] mono_class_data_size
[*] mono_class_data_size
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields
[*] mono_class_get_fields

코드를 정상적으로 실행돼서 위와 같은 결과가 출력이 되는데요.

1) 문제는 Trace가 1초정도 되다가 App이 종료되어 버립니다..
    실행되는 함수마다 Attach작업을 해서 그런 것 같은데요.. 혹시 이럴 때는 어떻게 처리를 해줘야 할까요?

2) 그리고 제가 분석한 결과로는, 후킹함수의 RVA를 더하는 Base주소를 libmono.so로 가져오면 안될 것 같은데 여기에 대해서 조언 부탁드립니다..
3 Comments
1 eXPerience 2019.12.06 22:42  
감사합니다~
M LIN 2019.12.07 15:06  
1) 흠... 크래쉬 로그를 통해 원인을 분석해봐야 알것 같습니다.
아무래도 디테일하게 후킹하는데에는 프리다로는 한계가 있습니다.
윈도우의 DLL 인젝션 처럼 SO를 직접 만들어서 삽입하는것도 하나의 방법입니다.
2번 질문 또한 직접 코딩한다면 해결될듯합니다.
4 py0zz1 2019.12.07 23:15  
음.. 그렇군요..
답변 감사합니다.
Category