IFEO的本意是为一些在默认系统环境中运行时可能引发错误的程序执行体提供特殊的环境设定,系统厂商之所以会这么做,是有一定历史原因的,在Windows NT时代,系统使用一种早期的堆栈Heap,由应用程序管理的内存区域)管理机制,使得一些程序的运行机制与现在的不同,而后随着系统更新换代,厂商修改了系统的堆栈管理机制,通过引入动态内存分配方案,让程序对内存的占用更为减少,在安全上也保护程序不容易被溢出,但是这些改动却导致了一些程序从此再也无法运作,为了兼顾这些出问题的程序,微软以“从长计议”的态度专门设计了“IFEO”技术,它的原意根本不是“劫持”,而是“映像文件执行参数”!
转:http://security.ctocio.com.cn/tips/92/8064592_1.shtml
【IT专家网独家】当前的木马、病毒似乎比较钟情于“映像劫持”,通过其达到欺骗系统和杀毒软件,进而绝杀安全软件接管系统。笔者最近就遇到很多这种类型的木马病毒,下面把自己有关映像劫持的学习心得写下来与大家交流。
一、原理
所谓的映像劫持(IFEO)就是Image File Execution Options,它位于注册表的
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/键值下。由于这个项主要是用来调试程序用的,对一般用户意义不大,默认是只有管理员和local system有权读写修改。
比如我想运行QQ.exe,结果运行的却是FlashGet.exe,这种情况下,QQ程序被FLASHGET给劫持了,即你想运行的程序被另外一个程序代替了。
二、被劫持
虽然映像劫持是系统自带的功能,对一般用户来说根本没什么用的必要,但是就有一些病毒通过映像劫持来做文章,表面上看起来是运行了一个正常的程序,实际上病毒已经在后台运行了。
大部分的病毒和木马都是通过加载系统启动项来运行的,也有一些是注册成为系统服务来启动,他们主要通过修改注册表来实现这个目的,主要有以下几个键值:
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/WindowsCurrent/Version/Run
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Windows/AppInit_DLLs
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Winlogon/Notify
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/WindowsCurrent/Version/RunOnce
HKEY_LOCAL_MACHINE/Software/Microsoft/WindowsCurrent/Version/RunServicesOnce
但是与一般的木马,病毒不同的是,就有一些病毒偏偏不通过这些来加载自己,不随着系统的启动运行。木马病毒的作者抓住了一些用户的心理,等到用户运行某个特定的程序的时候它才运行。因为一般的用户,只要发觉自己的机子中了病毒,首先要察看的就是系统的加载项,很少有人会想到映像劫持,这也是这种病毒高明的地方。
映像劫持病毒主要通过修改注册表中的HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/项来劫持正常的程序,比如有一个病毒 vires.exe 要劫持qq程序,它会在上面注册表的位置新建一个qq.exe项,再在这个项下面新建一个字符串的键 debugger把其值改为C:/WINDOWS/SYSTEM32/VIRES.EXE(这里是病毒藏身的目录)即可。
三、玩劫持
1、禁止某些程序的运行
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/qq.exe]
Debugger=123.exe
把上面的代码保存为norun_qq.reg,双击导入注册表,每次双击运行QQ的时候,系统都会弹出一个框提示说找不到QQ,原因就QQ被重定向了。如果要让QQ继续运行的话,把123.exe改为其安装目录就可以了。
2、偷梁换柱恶作剧
每次我们按下CTRL+ALT+DEL键时,都会弹出任务管理器,想不想在我们按下这些键的时候让它弹出命令提示符窗口,下面就教你怎么玩:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/taskmgr.exe]
Debugger=D:/WINDOWS/pchealth/helpctr/binaries/mconfig.exe
将上面的代码另存为 task_cmd.reg,双击导入注册表。按下那三个键打开了“系统配置实用程序”。
3、让病毒迷失自我
同上面的道理一样,如果我们把病毒程序给重定向了,是不是病毒就不能运行了,答案是肯定的。
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/sppoolsv.exe]
Debugger=123.exe
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/logo_1.exe]
Debugger=123.exe
上面的代码是以金猪病毒和威金病毒为例,这样即使这些病毒在系统启动项里面,即使随系统运行了,但是由于映象劫持的重定向作用,还是会被系统提示无法找到病毒文件(这里是logo_1.exe和sppoolsv.exe)。
四、防劫持
1、权限限制法
打开注册表编辑器,定位到
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/,选中该项,右键→权限→高级,取消administrator和system用户的写权限即可。
2、快刀斩乱麻法
打开注册表编辑器,定位到[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/,把“Image File Execution Options”项删除即可。
总结:以上关于映像劫持的解析与利用但愿对于大家查杀木马病毒有所帮助,也希望大家能够挖掘更多更实用的功能。
映像胁持的基本原理:
当然,把这些键删除后,程序就可以运行!
引用JM的jzb770325001版主的一个分析案例:
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/avp.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/AgentSvr.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/CCenter.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/Rav.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/RavMonD.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/RavStub.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/RavTask.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/rfwcfg.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/rfwsrv.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/RsAgent.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/Rsaupd.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/runiep.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/SmartUp.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/FileDsty.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/RegClean.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/360tray.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/360Safe.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/360rpt.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/kabaload.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/safelive.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/Ras.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KASMain.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KASTask.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KAV32.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KAVDX.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KAVStart.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KISLnchr.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KMailMon.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KMFilter.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KPFW32.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KPFW32X.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KPFWSvc.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KWatch9x.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KWatch.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KWatchX.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/*Detector.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/UpLive.EXE.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KVSrvXP.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KvDetect.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KRegEx.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/kvol.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/kvolself.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/kvupload.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/kvwsc.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/UIHost.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/IceSword.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/iparmo.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/mmsk.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/adam.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/MagicSet.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/PFWLiveUpdate.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/SREng.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/WoptiClean.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/scan32.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/shcfg32.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/mcconsol.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/HijackThis.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/mmqczj.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/*wall.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/FTCleanerShell.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/loaddll.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/rfwProxy.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KsLoader.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KvfwMcl.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/autoruns.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/AppSvc32.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/ccSvcHst.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/isPwdSvc.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/symlcsvc.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/nod32kui.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/avgrssvc.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/RfwMain.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KAVPFW.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/Iparmor.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/nod32krn.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/PFW.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/RavMon.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/KAVSetup.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/NAVSetup.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/SysSafe.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/QHSET.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/zxsweep.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/AvMonitor.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/UmxCfg.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/UmxFwHlp.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/UmxPol.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/UmxAgent.exe
HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options/UmxAttachment.exe
-------------------------------------------------------
从这个案例,我们可以看到这个技术的强大之处!很多的杀软进程和一些辅助杀软或工具,全部被胁持,导致你遇到的所有杀软都无法运行!
试想如果更多病毒,利用于此,将是多么可怕的事情!
应用举例:
1.病毒清除和防范
2.网吧网管 防止顾客关闭管理软件,可将“任务管理器”劫持为IE浏览器,*一些黑客软件等等。
3.恶作剧,在MM面前SHOW一番。
这几天一直想要把这个经验写一下,总没抽出时间,晚上加加班。样本已经被杀毒U盘的监控干掉,本文回忆下修复过程。
现象
一媒体朋友的笔记本染毒,杀毒软件起不来。开机就弹出若干个窗口,总也关不掉,直到系统内存耗尽死机,安全模式也是同样的现象。无奈之下,尝试重装系统,不过,因为不少人都知道的原因,她只是格式化了C分区,系统重装后,访问其它分区后,再次出现重装前的中毒症状。
从上述现象至少得到2个信息:1、病毒会通过自动播放传播;2、病毒可能利用映像劫持。
故障现象
检查故障机,重启时,很自然的想到启动到带命令行的安全模式。运行regedit,结果失败。msconfig一样失败。改regedit.exe为regedit.com,同样失败,没有继续尝试改别的名字。重启电脑进普通模式,想看一下具体中毒的现象。
登录到桌面后,发现一个类似记事本的程序不停打开一个小对话框,速度很快,根本来不及关闭,任务管理器也调不出来。立即拿出我的杀毒U盘,其中常备ProcessExplorer、冰刃、Sreng。发现杀毒U盘没有正常的启动成功。双击冰刃/Sreng都宣告失败。
解决步骤
分别对将icesword和Sreng主程序改名后运行,此时,那个象记事本的病毒程序已经打开近百个对话框,系统变得很慢。在WINXP的任务栏选中这一组窗口,关闭掉,先抢占一些系统资源再说。
然后,双击U盘上的ProcessExplorer,一眼看到有记事本图标的三个进程,尝试结束其中一个,发现结束后,程序会立即重新启动。看来,直接KILL进程是不行的。结束不行,就用下冻结进程,分别选中这三个进程,单击右键,在进程属性中选择Suspend(暂停)进程,病毒就不再弹出新的对话框,杀它就容易了。(参考下图的示例:)
图1 暂停进程
切换到冰刃,简单地通过进程管理,根据病毒进程的程序位置和文件名,轻松使用冰刃内置的文件管理器浏览到这几个文件,复制一个备份到桌面,再单击右键,选择强制删除。
(下图演示冰刃的强制删除):
图2 强制删除
接下来,再切换到冰刃窗口中的注册表编辑器,浏览到HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options,逐个查看子注册表键中对应的程序名,找到另一个病毒程序。(这里要说明一下,有网友认为只需要保留Your Image File Name Here without a path子键,其它都可以删除。觉得这样做还是有风险的,谨慎的做法还是一个子键一个子键的检查,如果发现键值为病毒程序的路径时,再删除这个子键)。
图3 清理注册表
同样,需要使用冰刃的文件管理器将病毒程序强制删除。这个病毒太恶劣了,我发现几乎所有的杀毒软件、防火墙、系统自带的管理工具(regedit,msconfig,cmd,任务管理器)、第三方的系统辅助工具(Sreng、autoruns、冰刃)全部被劫持。
修复注册表后,双击杀毒U盘中的毒霸,新版杀毒U盘增加了监视功能,在我点击桌面备份的那几个病毒程序时,杀毒U盘的监控立即干掉了病毒。然后打开资源管理器,浏览到其它分区根目录,杀毒U盘又把另几个分区根目录下隐藏的病毒干掉。
另类解决方案
在你没有冰刃、Process Explorer时,可以用其人之道,还治其人之身。编辑一个修改注册表的批处理脚本,把病毒程序也给加到映像劫持的清单中,如下示例:
@echo off
echo Windows Registry Editor Version 5.00>ssm.reg
echo [HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File
Execution Options/syssafe.EXE] >>ssm.reg
echo "Debugger"="syssafe.EXE" >>ssm.reg (如果发现多个病毒程序,就编辑多行)
rem regedit /s ssm.reg &del /q ssm.reg (如果发现多个病毒程序,就编辑多行)
重启电脑后,病毒程序也启动不了,呵呵,比较毒吧,然后把注册表编辑器的程序名regedit.exe为其它的什么名字,双击后对注册表的HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Image File Execution Options项进行修改。再升级杀毒软件杀毒。
总结
对普通用户来说,遇到这类对抗杀毒软件很强的病毒,实在很棘手。使用杀毒软件轻松修复的可能性很小,手工修复对普通用户来说,很有难度。
建议
1.使用组策略编辑器,关闭所有驱动器的自动播放功能(自动播放功能传播了太多的病毒)。
2.及时升级杀毒软件,防止被这类病毒袭击,中招后再去处理,需要花更多功夫。
3.一旦中毒,应立即联系专业反病毒工程师协助,重装系统不是好方法。