国外高手谈卡巴斯基存隐患(2)

豆豆网   技术应用频道   2007年06月22日  【字号: 收藏本文

内容摘要:KAV的杀毒软件依靠诸多不安全内核层的黑客程序,从而将系统稳定性置于危险中。想要解决这个问题,首先KAV需要去掉不安全的内核层黑客程序,比如给非输出函数打补丁或者不加验证地关联系统服务等等。

  KAV的输出表保护代码做了这样一个假设:用户层的PE页头是形式正确的并且不包含指向内核层地址的偏移地址:

.text:F8221360 KavReprotectExportTable proc near    ; CODE XREF: KavPatchImage+Bp
.text:F8221360
.text:F8221360 var_10     = dword ptr -10h
.text:F8221360 var_C      = dword ptr -0Ch
.text:F8221360 var_8      = dword ptr -8
.text:F8221360 var_4      = dword ptr -4
.text:F8221360 arg_0      = dword ptr 4
.text:F8221360 arg_4      = dword ptr 8
.text:F8221360
.text:F8221360  mov   eax, [esp+arg_0]
.text:F8221364  sub   esp, 10h
.text:F8221367  cmp   word ptr [eax], 'ZM'
.text:F822136C  push  ebx
.text:F822136D  push  ebp
.text:F822136E  push  esi
.text:F822136F  push  edi
.text:F8221370  jnz   loc_F8221442
.text:F8221376  mov   esi, [eax+3Ch]
.text:F8221379  add   esi, eax
.text:F822137B  mov   [esp+20h+var_C], esi
.text:F822137F  cmp   dword ptr [esi], 'EP'
.text:F8221385  jnz   loc_F8221442
.text:F822138B  lea   eax, [esp+20h+var_8]
.text:F822138F  xor   edx, edx
.text:F8221391  mov   dx, [esi+14h]
.text:F8221395  push  eax
.text:F8221396  xor   eax, eax
.text:F8221398  push  40h
.text:F822139A  mov   ax, [esi+6]
.text:F822139E  lea   ecx, [eax+eax*4]
.text:F82213A1  lea   eax, [edx+ecx*8+18h]
.text:F82213A5  push  eax
.text:F82213A6  push  esi
.text:F82213A7  call  KavExecuteNtProtectVirtualMemoryInt2E ; NtProtectVirtualMemory
.text:F82213AC  test  al, al
.text:F82213AE  jz   loc_F8221442
.text:F82213B4  mov   ecx, [esi+8]
.text:F82213B7  mov   [esp+20h+var_10], 0
.text:F82213BF  inc   ecx
.text:F82213C0  mov   [esi+8], ecx
.text:F82213C3  xor   ecx, ecx
.text:F82213C5  mov   cx, [esi+14h]
.text:F82213C9  cmp   word ptr [esi+6], 0
.text:F82213CE  lea   edi, [ecx+esi+18h]
.text:F82213D2  jbe   short loc_F8221442
.text:F82213D4  mov   ebp, [esp+20h+arg_4]
.text:F82213D8
.text:F82213D8 loc_F82213D8:       ; CODE XREF: KavReprotectExportTable+E0j
.text:F82213D8  mov   ebx, [edi+10h]
.text:F82213DB  test  ebx, 0FFFh
.text:F82213E1  jz   short loc_F82213EA
.text:F82213E3  or   ebx, 0FFFh
.text:F82213E9  inc   ebx
.text:F82213EA
.text:F82213EA loc_F82213EA:       ; CODE XREF: KavReprotectExportTable+81j
.text:F82213EA  mov   ecx, [edi+8]
.text:F82213ED  mov   edx, ebx
.text:F82213EF  sub   edx, ecx
.text:F82213F1  cmp   edx, ebp
.text:F82213F3  jle   short loc_F822142C
.text:F82213F5  mov   esi, [edi+0Ch]
.text:F82213F8  mov   ecx, [esp+20h+arg_0]
.text:F82213FC  sub   esi, ebp
.text:F82213FE  push  ebp
.text:F82213FF  add   esi, ebx
.text:F8221401  add   esi, ecx
.text:F8221403  push  esi
.text:F8221404  call  KavFindSectionName
.text:F8221409  test  al, al
.text:F822140B  jz   short loc_F8221428
.text:F822140D  cmp   dword ptr [edi+1], 'TINI'
.text:F8221414  jz   short loc_F8221428
.text:F8221416  lea   eax, [esp+20h+var_4]
.text:F822141A  push  eax
.text:F822141B  push  40h
.text:F822141D  push  ebp
.text:F822141E  push  esi
.text:F822141F  call  KavExecuteNtProtectVirtualMemoryInt2E ; NtProtectVirtualMemory
.text:F8221424  test  al, al
.text:F8221426  jnz   short loc_F822144E
.text:F8221428
.text:F8221428 loc_F8221428:       ; CODE XREF: KavReprotectExportTable+ABj
.text:F8221428        ; KavReprotectExportTable+B4j
.text:F8221428  mov   esi, [esp+20h+var_C]
.text:F822142C
.text:F822142C loc_F822142C:       ; CODE XREF: KavReprotectExportTable+93j
.text:F822142C  mov   eax, [esp+20h+var_10]
.text:F8221430  xor   ecx, ecx
.text:F8221432  mov   cx, [esi+6]
.text:F8221436  add   edi, 28h
.text:F8221439  inc   eax
.text:F822143A  cmp   eax, ecx
.text:F822143C  mov   [esp+20h+var_10], eax
.text:F8221440  jb   short loc_F82213D8
.text:F8221442
.text:F8221442 loc_F8221442:       ; CODE XREF: KavReprotectExportTable+10j
.text:F8221442        ; KavReprotectExportTable+25j ...
.text:F8221442  pop   edi
.text:F8221443  pop   esi
.text:F8221444  pop   ebp
.text:F8221445  xor   eax, eax
.text:F8221447  pop   ebx
.text:F8221448  add   esp, 10h
.text:F822144B  retn  8
.text:F822144E ; ---------------------------------------------------------------------------
.text:F822144E
.text:F822144E loc_F822144E:       ; CODE XREF: KavReprotectExportTable+C6j
.text:F822144E  mov   eax, [edi+8]
.text:F8221451  mov   [edi+10h], ebx
.text:F8221454  add   eax, ebp
.text:F8221456  mov   [edi+8], eax
.text:F8221459  mov   eax, esi
.text:F822145B  pop   edi
.text:F822145C  pop   esi
.text:F822145D  pop   ebp
.text:F822145E  pop   ebx
.text:F822145F  add   esp, 10h
.text:F8221462  retn  8
.text:F8221462 KavReprotectExportTable endp

来源:赛迪网    作者:杜莉    责编:豆豆技术应用

正在加载评论...