Linux通过其特有的虚拟文件系统(Virtual Filesystem)实现对多种文件系统的兼容。虚拟文件系统又称虚拟文件系统转换(Virtual Filesystem Switch vFs),是一个异构文件系统上的软件粘合层,为访问文件系统的系统调用提供一个统一的抽象接口。VFS采用标准的Unix系统调用读写,位于不同
物理介质上的不同文件系统,使open()、read()、write()等系统调用不用关心底层的存储介质和文件系统类型。基于VFS的Rootkit可以有效的绕过安全检测工具的检测,通过对Linux下文件系统操作指针的修改实现隐藏功能,该类型经典Rootkit为adore—ng。以系统调用getdents64为例,该系统调用用于目录获取,其执行过程实际上是调用vfs—readdir()函数完成功能,vfs—readdir()则是通过Linux下文件对象的操作函数结构体f_op中的readdir()获取目录。readdir()函数是在文件或目录打开时由Linux根据该目录的文件系统类型进行赋值的,如果当前目录为ext2文件系统,则通过ext2一
file— operations(ext2文件操作结构体)将readdir()函数赋给索引节 inode,再由inode赋值给文件对象。Adore—ng的VFS函数劫持代码如下,打开一个目录或文件,通过其文件对象结构体file中的f—op变量获取readdir()函数指针,并将自己的目录读取函数new_readdir()赋给文件对象,从而实现劫持。由于Linux在文件对象赋值过程中均采用指针操作,该操作实际上替换的是ext2一file—operation中的readdir()函数,因此进行readdir()替换后,任意目录和文件的读取操作都将由adore—ng提供的new_readdir()执行。在new_ readdir()中可以对指定的目录或文件进行过滤,从而实现隐藏的目的。

int patch_ vfs(const char P,readdir_t orig_ readdir,readdir_
t new
_ readdir)
{
stnict file filep;
filep=filp
_ open(p,O_RDONLY,0)
if(IS—ERR(filep))
return一1:
if(orig_ readdir)
orig_ readdir=filep->f_ op->readdir;
filep。 f
_ op。>readdir new_ readdir;
filp_ close(filep,O);
retum0:

    随着虚拟化技术的发展,基于VMM的Rootkit检测技术得到了广泛关注。基于VMM的Rootkit检测护技术不同于传统的基于主机内部的检测技术,由于在VMM中无法获取操作系统的完整视图,因此为检测带来了很大难度。随着这方面技术的深入研究,基于语义重构和基于系统完整性的Rootkit
检测技术被相继提出并日趋成熟。

在虚拟化环境下,VMM与客户虚拟机之间被隔离。这种隔离机制为VMM提供了安全的环境,但同时也给基于VMM的Rootkit检测带来更大的挑战。VMM的可观测视图仅仅包括内存、10操作等低级别视图,而无法获取客户虚拟机中关于进程、模块等高级视图信息。这种视图级别的差距导致了语义断层的出现,为了消除语义断层,基于VMM的Rootkit检测技术采用语义重构对高级视图进行恢复,进一步使用交叉视图进行检测。 交叉视图分析是目前针对Rootkit的一种有效的检测方法。该方法基于可信视图与感染视图的对比分析,找到隐藏或是可疑的Rootkit信息,从而实现对Rootkit的检测。在基于
VMM的Rootkit检测过程中,可信视图主要通过语义重构获取,感染视图则在客户虚拟机中通过shell命令获取。目前基于VMM的Rootkit检测技术侧重于进程信息的重构,具体重构方法主要包括以下四种。
1)task—list链表重构
    Payne Bryan D等人提出了重构task—list链表的方法并实现了开源函数库Xenaccess 。该方法通过System.map中获取Linux导出符号init—task的线性地址。该符号表征task— list进程链表中首元素的地址。task—list属于内核数据,通过对swapper—Pg—dir内核页全局目录表及相应页表的查询,获取其对应机器地址,从而遍历链表恢复出当前系统的进程信息,包括ID、进程名等。该方法原理简单,在遍历进程过程中,需要提前根据客户虚拟机内核版本,获取task—struct结构体中指定变量的偏移量,从而获取数据值。由于客户虚拟机的内核数据信息处于该虚拟机的内存空间中,因此在重构时,需要将该部分内存映射到控制域中,该过程通过VMM的指定接口实现。
2)CPU可运行队列重构

针对基于task—list链表的重构方法在DKOM类Rootkit检测方面的不足,王丽娜、高汉军等人提出了基于CPU可运行队列的重构方法[81o Linux内核为每个CPU维护一个runqueue数据结构,用于存储该CPU的调度信息。该方法同样利用System.map获取per_cpu—runqueues和per_cpu—offset的线性地址,通过相加获取runqueue结构体地址。runqueue结构体中的active指向prio—array_t结构体,prio—array_t根据进程等级分为140个队列。通过遍历该运行队列,可恢复出
当前系统的进程列表。该方法的好处是对于DKOM类Rootkit检测效果明显。DKOM类Rootkit会进行断链操作,从而让进程从task—list中消失,使常规检测方法失效。然而,进程要运行必须进入CPU
运行队列进行等待,因此对于runqueues重构的信息可信等级更高。
3)系统调用劫持
    Xuxian J等人提出了基于系统调用劫持的语义信息重构方
法 0。该方法通过将快速系统调用中的SYSENTER—EIP—MSR
寄存器值进行修改,使系统调用过程中出现页错误,从而进入缺页异常处理程序。通过修改缺页异常处理程序,根据错误信息判断系统是否在创建或删除进程,若是则通过VMCS获取ESP地址,进而获取threadinfo结构体。threadinfo结构体中包含指向task—struct结构体指针,从而恢复创建或删除进程的信息。该方法的优势在于可以实时监控系统内部进程,可以解决针对短时间运行的恶意或隐藏进程的检测问题。另外,由于该方法不涉及任何内核数据偏移量,因此可以简单地应用于多种内核版本,适用范围广实用性强。

4)CR3寄存器信息重构
    SteDhen T.Jones等人提出了基于CR3寄存器信息重构的方法[101。在Linux操作系统中,CR3寄存器用于存储系统页目录指针,页目录指针指向进程页目录表,用于完成从线性地址到物理地址的转换工作。由于不同进程的内存空间不同,不同的进程也都有不同页目录表指针,通过监测CR3寄存器
的值,一段时间内,若出现新的CR3值,则证明有新的进程创建;若已存在的CR3值消失,则证明该进程已被删除。当判断新进程创建后,根据ESP指针获取threadinfo结构体。该方法基于VMM层进行重构,重构的可信视图信息可信度高。该方法需要基于时间维进行对比方可发现进程的创建与删除,因此其实现难度较大。由于CR3寄存器的监测要对VMM内核进行适当修改,且进程切换在系统内操作频繁,因此会影响虚拟环境的运行效率。

2.2系统完整性
    基于语义重构的Rootkit检测技术通过Linux系统导出符号定位关键数据结构的内存位置,然而由于恶意代码的影响,系统导出符号有可能会出现错误,从而导致语义重构失败基于完整性检测的Rootkit检测技术检测可执行文件、内核控制流程的完整性,其检测效果明显,但是由于该技术多涉及内核修改,因此会带来较大的性能损失。李博等人通过虚拟环境下的系统调用劫持,辨识可执行文件的执行『1”。Linux的可执行程序在加载之前,会调用open系统调用打开文件,其中函数open()的第一个参数为所打开文件的路径。在获取文件路径后,通过对Linux文件系统布局的分析,重构文件系统元数据,并从磁盘中找到文件镜像,通过哈希值计算及对比分析,检测可执行文件的完整性。Grizzard提出一种内核控制流的完整性检测方法。该方法重写目标操作系统内核,使所有内核控制流分支均陷入到 VMM内核中。在VMM内核中,通过与预先训练获得的控制流图进行对比分析,从而检测控制流程的完整性。该方法对于内核工作效率影响大,经实验,其性能损失约在30%。Hai Jin等人在Xen平台利用其用户层驱动blktap实现文件完整性检测[121~Xen中的控制域Dom0包含所有10操作的原生驱动,客户虚拟机中的所有10操作均通过10环通知控制域中的Blktap进行执行。该方法通过劫持Blktap驱动,劫持客户虚拟机的文件操作,并通过哈希值对比检测文件完整性。该方法检测覆盖范围广但对于正常的文件修改容易产生误报。

2.3检测技术的综合分析
     基于语义重构和基于系统完整性的检测技术从不同的角度对Rootkit进行检测。基于语义重构的检测技术侧重于恢复内存中关键数据结构信息或根据相关寄存器事件判断客户虚拟机中的行为;基于系统完整性的检测技术则通过哈希值对比分析文件是否遭到恶意修改,或通过数据分析方法检测内核控制流的一致性。在实际应用中往往将二者结合,如李博等人提出的基于VMM的可执行文件完整性检测技术,首先通过语义重构技术截获系统调用,恢复出文件绝对路径,再进行下一步的完整性检测工作。
针对语义重构技术的四种不同方法,由于其对于实现细节依赖性很大,因此只在适用范围、实现复杂性以及可信视图安全等级三方面进行简要对比分析。在适用范围方面,系统调用劫持和CR3寄存器信息重构适用于不同的操作系统内核版本,而CPU运行队列及task—list的信息重构技术则要依赖于目标操作系统的内核偏移量信息,因此其灵活性相对较差。在实现复杂性方面,task—list信息重构相对简单;CPU运行队列重构虽然原理简单,但由于CPU进程调度频繁,因此其在实现过程中会遇到进程遍历不全的情况;对于系统调用劫持和CR3寄存器信息重构两种方法,其均需要修改VMM内核,实现复杂度较高。

在可信视图安全等级方面,CR3寄存器信息重构属于VMM层信息,可信度最高;系统调用劫持、CPU可运行队列以及task—list均属于VM内核层信息,其可信度相对较低。其中task—list信息的安全等级最低,对于直接操作内核对象类Rootkit(Direct Kernel Object Manipulation,DKOM)其无法进行检测。

3基于VMM的Rootkit检测模型

近些年,基于VMM的Rootkit检测模型成为研究热点。根据检测模型的特点及相应检测原理可分为“In—VM”、“In—VMM”和“In—Host”模型。
3.1“ln—VM”模型

“In—VM”模型指在客户虚拟机VM中安装相应检测模块的Rootkit检测模型。该模块通常置于目标VM的内核中,通过VMM的接口与其他模块进行通信。基于该种模式的Rootkit检测模型主要有Lares等。Lares是由佐治亚理工的Bryan D.Payne等人于2008年开发[13]o Lares在VM内安装驱动程序Hookdriver.sys,该驱动程序实现对于VM的安全监测,并通过通信模块trampoline利用Xen平台的超级调用HyperCall将检测信息传入系统其他模块。为了实现对Hookdriver驱动程序的保护,在VMM层实现内存保护模块,将驱动程序所在的内存设置为不可写状态,从而实现驱动程序完整性保护。

3.2“In—VMM”模型

“In—VMM”模型不在VM内添加任何额外的模块,但修改VMM内核实现检测功能。基于该种模式的Rootkit检测模型主要有VMDetector和ComMon等。VMDetector是由Ying Wang、Chunming Hu和Bo Li于2011年开发[14]0 VMDetector结合硬件虚拟化技术,基于系统调用劫持和CR3寄存器信息重构技术,修改VMM内核中缺页异常处理程序,监测CR3及进程创建事件,获取隐藏进程的可信视图,并根据交叉视图分析,检测出Rootkit的存在,并恢复出其详细信息。该模型同时还支持隐藏连接的交叉视图分析。

ComMon是由Guofu,X.等人于2012年开发051 0 ComMon 是一个综合的Rootkit检测架构,其同样利用系统调用劫持技术修改VMM内核,当劫持相关文件操作的系统调用时,则通过task—struct中files—struct的fdtable恢复出当前操作的文件,并根据系统调用参数恢复文件的路径,从而提供文件检测功能。

3.3“In—Host”模型
“In—Host”模型不同于前两种模型,不存在任何模块位于VMM或VM内,其检测模型完全处于Host(控制域)内部。基于该种模式的Rootkit检测模型主要有XenPHD和XenAccess等。XenAccess是由佐治亚理工大学的Bryan D.Payne等人开发的基于Xen平台的语义重构及隐藏进程检测的开源库;
XenPHD是由王丽娜等人研发的Xen平台隐藏进程检测系统。二者分别采用基于VMM的Rootkit检测技术中task—list和runqueues重构,恢复系统内进程的可信视图,并通过交叉视图进行隐藏进程检测。

Hyperjacking虚拟化管理程序劫持

Hperjacking rootkit攻击,专门针对系统管理程序的攻击

获得底层权限,在操作系统启动前先启动VMM,让原先的操作系统执行在此VMM上,而恶意程序则执行在另一个与VMM平行的独立操作系统上,原先的操作系统便会无法察觉到这个恶意程序的存在。

Hyperjacking 工具:bluepill subvirt vitriol

In the early 2000’s virus writing was all the rage. Think of the massive virus outbreaks that took place. Millions of infected hosts. The Sober virus that infected 218 million machines in seven days. The MyDoom virus sent over 100 million virus-infected emails. The “I Love You” virus infected 55 million machines and collected their usernames and passwords. These attacks were about bragging rights, not money.

Hyperjacking 101 - A Deep DiveThat’s so last decade. Virus writing is so passé. Following it, however, was the age of malware and phishing. This was monetary bound, and sought to phish the user/pass and actually use them. Western Union must have made a bazillion dollars as the fence for criminals and crooks worldwide.

There’s a bigger picture. As we’ve moved from local workstations and servers containing copious amounts of tasty private information and data, toward the cloud where all of that data sexiness lives behind the locked doors of the Cloud Providers, the game is changing.

There are new technical challenges.

The back end to the cloud is Virtual infrastructure. And if you think of a cake, there would be the pan which is the physical piece, or the hardware. Above that is a yummy bit called the hypervisor which is a software piece that governs the host machine. This is essentially the cake part, the soft mushy filler between the pan and the frosting. But it’s software. The hypervisor dictates the basic operation of the host machine. It’s the abstraction layer between physical hardware and virtual machines in any virtualized platform. And on top of that abstraction layer is the frosting, or the guest operating systems. These systems are the “Virtual Machines”.

Enough of the cake references. I’m getting hungry.

In my previous article I outlined the fact that going virtual adds simplicity for IT departments. It’s easier to provision servers, it’s easier to move servers, it’s easier to decommission servers. It’s easier to set up networks. It’s easier from a management perspective all around. But in order to attain this simplicity, we are adding complexity on the platform side (the hypervisor), and not enough complexity to the network side. (i.e., virtualization creates flat networks which out of the box virtualization creates.) So by creating simplicity in the management side, we need to add complexity by adding a hypervisor and add security back to a flat network. Segregation. Divide and conquer. Yin and Yang.

One element of this added complexity is hyperjacking. Still in its infancy, hyper-jacking revolves around the corporate world's newfound enthusiasm for application, operating system and solution virtualization. Hyperjacking is a verb that describes the hypervisor stack jacking. Hyperjacking involves installing a rogue hypervisor that can take complete control of a server. Regular security measures are ineffective because the OS will not even be aware that the machine has been compromised. Sneaky sneaky.

Why? Or rather, how? Because the hypervisor actually runs underneath the operating system, making it a particular juicy target for nefarious types who want not only to own (or PWN to those in the know) the host servers in order to attack guest VMs, but also to maintain persistence. (Okay, they’ve gotten into your hypervisor and stolen your data but, they’d also like the ability to come back whenever they want to steal more data.) Hyper-jacking is a great way to not only compromise a server and steal some data, but also to maintain that persistence. Get control of the hypervisor and you control everything running on the machine. The hypervisor is the single point of failure in security and if you lose it, you lose the protection of sensitive information. This increases the degree of risk and exposure substantially.

Now, what we’ve seen are some lab-based examples of hyper-jacking-style threats. But not many are in the wild. Or rather, we haven’t identified anything in the wild yet. Whether or not this has actually taken place across a mass amount of VMs we don’t know. But some examples of hyper-jacking-style threats include a specific type of malware called virtual machine based root-kits.

For a hyperjacking attempt to succeed, an attacker would need a processor capable of doing hardware-assisted virtualization. So the best way to avoid hyper-jacking is to use hardware-rooted trust and secure launching of the hypervisor. This requires the technology to exist in the processor and chipsets themselves and offers trusted execution technology as well as a trusted platform modules to execute a trusted launch of a system from the hardware through the hypervisor.

Now many vendors have subscribed to a set of standards from the Trusted Computing Groups compliance of measured launch and root trusts. And with that, there are also several security vendors who are offering hypervisor security products that work by checking the integrity of the hypervisor while it’s still in motion.

To do this, the programs examine the hypervisors and program memory, as well as the registers inside the CPU, to see if there are any unknown program elements. Root-kits in the hypervisor hide by modifying certain registers of the CPU and relocating the hypervisor somewhere else. And in this case, the hypervisor integrity software locates this relocated hypervisor. The hypervisor integrity software does this without the hypervisor being aware that it’s taking place. Of course, adding hooks into the process for examining the hypervisor also makes me uncomfortable, but that’s a conversation for another day.

This is all software, and software has rules that can be bent. So while addressing risks associated with the hypervisor we must remember that the hypervisor and the guest operating systems it supports are software and as such, need to be patched and hardened. Period.

Now with that in mind, you’re probably wondering “Well, how can I harden my environment?” Well, there are risks with all, but at least you’re thinking about it. Proactive thinking vs. reactive. Well done. Let’s put some basic design features in your environment to mitigate your risks:

1. Like security? Well, keep the management of said hypervisor in a secure environment. This is more of a network design issue than anything. It’s not hypervisor related, but still something to be considered. Never connect your hypervisor management functions to a less secure environment, than the virtual instances. Don’t put your management function access in the DMZ. Although this sounds like a common sense thing, we’ve all heard horror stories. Don’t be the horror story.

2. Your guest operating systems should never have access to the hypervisor. Nor should they know about it. Guest operating systems should never know they’re virtual. And your hypervisor should never tell a guest OS that it’s hosted. Secret secret.

3. Embedded solutions are much safer. I know this is common sense to most. Operating system-based solutions are traditionally less secure because there are more moving parts. My father always said, “keep it simple, stupid.” Same deal. Embedded modules are more simple and functional, as well as easier to manage, maintain and secure.

Understanding the hypervisor risks is one step toward securing them. Although much of the hyper-jacking conversation has been theoretical, don’t set yourself up in a place where youcould be compromised if some 0-day hypervisor attack pops up. Secure your hypervisor, secure your world. Or at least part of it.

基于VMM的Rootkit检测技术及模型分析相关推荐

  1. 【技术】DTEmpower核心功能技术揭秘(7) - ROD基于回归分析的异常点检测技术

    概述 <DTEmpower核心功能技术揭秘>系列的文章围绕着如何提升机器学习模型的精度,介绍了AIOD.AIAgent.autoML等核心技术.其中AIOD异常点检测技术融合了数十种常见的 ...

  2. 高级WIN2K ROOTKIT检测技术

    高级WIN2K ROOTKIT检测技术 (执行路径分析) 原文: http://www.blackhat.com/presentations/bh-usa-03/bh-us-03-rutkowski/ ...

  3. 基于像素的皮肤检测技术

    基于像素的皮肤检测技术 介绍一种基于颜色空间的皮肤检测技术,可以检测亚洲人种与白人的皮肤,皮肤检测 人脸识别的基础,也是很多人像识别技术的基础操作,在实际应用中还是非常有用的. 基于像素的皮肤检测主要 ...

  4. 自动驾驶采标系列三:基于图像的目标检测技术

        标注猿的第54篇原创        一个用数据视角看AI世界的标注猿    上一篇文章我们从"环境感知"数据的采集设备上进行了详细说明,已经了解了相应设备采集的数据及采集前 ...

  5. 基于主机的入侵检测技术

    基于主机的入侵检测技术 审计数据的获取 审计数据的预处理 基于统计模型的入侵检测技术 基于专家系统的入侵检测技术 基于状态转移分析的入侵检测技术 基于完整性检查的入侵检测技术 基于智能体的入侵检测技术 ...

  6. 基于网络的入侵检测技术

    网络入侵检测 分层协议模型与TCP/IP协议 TCP/IP协议分层结构 数据报文的分层封装 以太网帧格式 ARP/RARP报文格式

  7. 中科院广州电子沈阳航空航天大学:基于CASAIM激光自动检测技术实现航空部件自动化智能检测

    近期,中科院广州电子科教与智能制造部(CASAIM)同沈阳航空航天大学在航空部件自动化智能检测达成科研战略合作. 沈阳航空航天大学是一所以航空宇航为特色,以工为主,工.理.文.经.管.艺等学科协调发展 ...

  8. 爆炸物检测技术对比与分析

    1.基于激光诱导击穿光谱技术 激光诱导击穿光谱(Laser Induced-breakdown Spectroscopy,LIBS)技术是一种多元素分析技术,是基于对高功率激光脉冲与样品介质相互作用产 ...

  9. 基于RealSense的坐姿检测技术

    计算机的飞速普及,让人们将越来越多的工作放在计算机上去完成,各行各业,尤其是程序开发人员.文字工作者,在计算机上的工作时间越来越长,这种情况下不良的坐姿对颈肩腰椎都会产生很大影响,容易导致多种疾病的发 ...

最新文章

  1. ios4--UIView的常见属性(尺寸和位置)
  2. python小项目案例-拯救Python新手的几个项目实战
  3. 移动端H5页面注意事项
  4. 《Linux设备驱动程序》学习2—高级字符设备驱动ioctl
  5. 字字带泪——写在三十岁到来这一天
  6. 队列判空_三分钟基础:什么是队列?
  7. ExchangeServer2016 HAB 分层通讯簿 设置教程
  8. 数据结构动态顺序字符串基本操作实验_技术连载:数据结构 - 栈
  9. 如何在手机上安装linux系统并可视化界面
  10. 今日头条php笔试题,今日头条笔试题回顾及个人答案参考
  11. win10c盘清理(win10磁盘清理和磁盘整理)
  12. linu {,} 使用
  13. js判断图片加载完成后再执行代码
  14. c/c++语言中常用的math函数
  15. 账号二次登陆,强制当前账号下线
  16. java.awt包_Java中awt包
  17. vs2015安装Qt插件问题
  18. Linux (redhat)封装虚拟机镜像
  19. 庭院深深深几许,杨柳堆烟,帘幕无重数
  20. 以水稻为例教你如何使用BSA方法进行遗传定位(下篇)

热门文章

  1. DELPHI FMX 获取系统版本 ANDROID IOS通用
  2. 由多线程引起的map取值为null的分析
  3. open*** 启动报错
  4. word文档快速取消图片的链接
  5. 在vs2005中使用loki的方法
  6. winform运行时如何接受参数?(示例)
  7. 关键路径法及C语言实现
  8. Leaflet获取可视范围内4个顶点
  9. Mac下Selenium无法最大化Chrome解决方案
  10. MySQL两种表存储结构MyISAM和InnoDB的性能比较测试