annyoung

기업 메일로 송부된 스피어 피싱 분석 본문

분석생활

기업 메일로 송부된 스피어 피싱 분석

nopsled 2015. 5. 28. 21:20

이메일을 통해서 첨부된 악성코드(흔히 말하는 기업에서의 스피어 피싱)를 분석하려고 한다.


샘플 수집의 경로는 몇 일전 TLS callback에 대해서 물어봐주셨던 분에게 메일을 통해서 받았다.



 FileName

 fax_info.exe

 MD5

 99750A17CF9141BB10BD537BEC0A2DB0

 SHA-1

 7F16CB193145C69D49C19F4CEA08134AC8862CDD

 Packer

 X

압축을 사용하여 1차적으로 백신 우회를 하였고, pdf icon으로 위장하여 피해자가 실행하게 끔 된 바이너리다.


IAT만 봐도 작은 기능을 제외하고 큰 기능을 먼저 보자면 원격제어 기능을 가지고 있는 악성코드라는 것을 알 수 있다. 이유는 다음 내용에 설명하겠다.



void *__stdcall sub_401560(HINSTANCE hInstance, int a2, int a3, int a4) { HWND v4; // eax@1 HWND v5; // edi@1 void *result; // eax@3 struct tagMSG Msg; // [sp+8h] [bp-24h]@4 INITCOMMONCONTROLSEX picce; // [sp+24h] [bp-8h]@1 LoadStringA(hInstance, 0x69u, Buffer, 100); LoadStringA(hInstance, 0x6Au, byte_4039F0, 100); picce.dwSize = 8; picce.dwICC = 16384; InitCommonControlsEx(&picce); v4 = FindWindowA("FirstWindow", "MyClass"); v5 = v4; if ( v4 ) { ShowWindow(v4, 0); UpdateWindow(v5); } sub_4028E0(hInstance); ::hInstance = hInstance; result = CreateWindowExA(0, "MyClass", "FirstWindow", 0xCF0000u, -2147483648, 0, -2147483648, 0, 0, 0, hInstance, 0); if ( result ) { while ( GetMessageA(&Msg, 0, 0, 0) ) { TranslateMessage(&Msg); DispatchMessageA(&Msg); } result = (void *)Msg.wParam; } return result; } 

이유는 CreateWindowExA를 이용하여 크기가 0,0인 윈도우를 만들고 그리기 때문.


ATOM __cdecl sub_4028E0(HINSTANCE hInstance) { WNDCLASSEXA v2; // [sp+4h] [bp-30h]@1 v2.cbSize = 48; v2.style = 3; v2.lpfnWndProc = sub_401100; // BeginPaint, v2.cbClsExtra = 0; v2.cbWndExtra = 0; v2.hInstance = hInstance; v2.hIcon = LoadIconA(hInstance, (LPCSTR)0x6B); v2.hCursor = LoadCursorA(0, (LPCSTR)0x7F00); v2.hbrBackground = (HBRUSH)6; v2.lpszMenuName = (LPCSTR)106; v2.lpszClassName = "MyClass"; v2.hIconSm = LoadIconA(hInstance, (LPCSTR)0x6C); return RegisterClassExA(&v2); } 

아이콘과 커서를 로드하고 MyClass를 구성한다.


LRESULT __stdcall sub_401100(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)

{ LRESULT result; // eax@7 CHAR *v5; // eax@8 HMODULE v6; // ebx@8 HDC v7; // edi@10 signed int v8; // esi@24 CHAR PathName; // [sp+Ch] [bp-250h]@8 char v10; // [sp+10h] [bp-24Ch]@8 struct tagPAINTSTRUCT Paint; // [sp+20Ch] [bp-50h]@10 struct tagRECT Rect; // [sp+24Ch] [bp-10h]@10 if ( Msg > 0x210 ) { if ( Msg == 1153 ) { SendMessageA(dword_403A60, 0x443u, 0, 4320); v8 = 1167; do { PostMessageA(hWnd, v8, 0, v8); ++v8; } while ( v8 < 1222 ); return 0; } if ( Msg == 1172 ) { dword_403A70 += SendMessageA(dword_403A60, 0x443u, 0, 1008); return 0; } if ( Msg == 1174 ) { sub_402660(dword_403A70); return 0; } return DefWindowProcA(hWnd, Msg, wParam, lParam); } if ( Msg == 528 ) { dword_403A70 += 16; return 0; } if ( Msg <= 0xF ) { if ( Msg == 15 ) { v7 = BeginPaint(hWnd, &Paint); GetClientRect(hWnd, &Rect); // handle 값에 맞는 윈도우의 작업 반경을 구한다. DrawTextA(v7, &PathName, 10, &Rect, 1u); // Text를 그린다. EndPaint(hWnd, &Paint); return 0; } if ( Msg != 1 ) { if ( Msg == 2 ) { PostQuitMessage(0); return 0; } return DefWindowProcA(hWnd, Msg, wParam, lParam); } dword_403A74 = (int)hWnd; GetCurrentDirectoryA(0x200u, &PathName); v5 = (CHAR *)operator new(0x200u); lstrcpyA(v5, "sfile.txt"); PathName = 0; dword_403A70 = 150; SetCurrentDirectoryA(&PathName); v6 = LoadLibraryA("riched32.dll"); dword_403A6C = (int)CreateWindowExA(0, "edit", &WindowName, 0x40000000u, 300, 5, 10, 31, hWnd, 0, hInstance, 0); dword_403A68 = (int)CreateWindowExA(0, "STATIC", "Sound:", 0x40000000u, 5, 5, 300, 31, hWnd, 0, hInstance, 0); v10 = 0; dword_403A64 = (int)CreateWindowExA(0, "static", "Speed:", 0x40000000u, 5, 64, 290, 31, hWnd, 0, hInstance, 0); dword_403A60 = CreateWindowExA(0, "richedit", &WindowName, 0x40000004u, 4, 95, 600, 300, hWnd, 0, hInstance, 0); ::hWnd = CreateWindowExA(0, "edit", 0, 0x40000000u, 300, 60, 300, 31, hWnd, 0, hInstance, 0); dword_403A58 = (int)CreateWindowExA(0, "button", "OK", 0x40000000u, 405, 415, 100, 31, hWnd, 0, hInstance, 0); dword_403A54 = (int)CreateWindowExA(0, "button", "Cancel", 0x40000000u, 505, 405, 100, 31, hWnd, 0, hInstance, 0); SetFocus(::hWnd); if ( v6 ) { SleepEx(0x64u, 1); SendMessageA(hWnd, 0x481u, 0, 1); return 0; } return 0; } if ( Msg != 273 ) return DefWindowProcA(hWnd, Msg, wParam, lParam); dword_403A70 = wParam >> 16; if ( wParam >> 16 == 104 ) { DialogBoxParamA(hInstance, (LPCSTR)0x69, hWnd, DialogFunc, 0); result = 0; } else { if ( wParam >> 16 == 107 ) { DestroyWindow(hWnd); result = 0; } else { result = DefWindowProcA(hWnd, 0x111u, wParam, lParam); } } return result; }


IAT에서도 네트워크 통신을 위한 API를 찾을 수 없으며 잠재적인 위험으로 보인다.


Windows XP SP3 환경에서 실행해봤지만 x86용 어플리케이션이 아니므로 올바른 Win32 어플리케이션이 아니라고 뜨는거 보니 x64에서 분석해야 될 것 같다.


Win7용 가상머신이 없다. win7로 동적 분석 하고 싶다..


아쉽지만 분석 끝.

Comments