Hooking CPUID – A Virtual Machine Monitor Rootkit Framework

笔记(1) Hook 游戏内引擎函数 游戏的CRC检测 以下是为了对付CRC检查 自己测试的所有的方法 写成了笔记规避CRC检查 1:将调用函数地址 写到别的地址 而不是在函数头进行Hook 这样游戏调用 会调到自己的函数 在自己的函数里 再调用游戏的函数 因为游戏不会再这里检查CRC的 这里又不是代码段游戏调用   ->MyHUD_Frame   ->Engine::g_pClient->HUD_Frame经过测试发现 并不可以 原... 阅读详情
By: mobydefrag

 

Hooking CPUID – A Virtual Machine Monitor Rootkit Framework

I am writing this article from inside a Virtual Machine … or perhaps I am not!

One of the fascinating debates taking place around the web is whether or not an OS can detect if it is running inside a VM. Surely a VMM will never be able to fool an external clock but discounting that, who knows?

In any regard, I have written a small VMM that attempts to place the host OS into a VM and then handles the basic subset of unconditional VM-exits. Great. Now what?

Make it available to the public community so they can experiment with it, of course.


Firstly, let me stress that the version I am releasing is the very minimal construction necessary for semi-proper operation. This means:

• It makes no attempt to hide the fact that the OS is in a VM
• It makes no attempt to hide itself from that OS
• It does not represent production level code
• It does represent spaghetti level code
• It carries no warranty that it will not cause your OS to crash and burn

Having said that, it should be significantly easy to modify and provide a starting point for anyone interested in VMM development or just wanting to play around.

The VMM was written using the Intel VT simply because I have a Core 2 Duo. The drivers are written in C and compile with the WDK build utility. Loading the drivers on an AMD processor is very highly undefined.

It works on my system and a few others and hopefully it will work on yours too.
For compatibility, my system is basically:

• Core 2 Duo 6420 • Crucial PC2-6400
• Asus P5K Deluxe • Radeon 1950 XT
• Windows XP SP2 • Windows Vista Ultimate

The interesting drivers/sources (found in the vault):

• vmxcpu0.sys places processor 0 into VMX mode
• vmxcpu1.sys places processor 1 into VMX mode

A tool like cpu-z will show the CPUID hooking taking place. If you only place one processor into VMX mode, only code run on that processor will be “inside” the VM.

Helpful tools include DbgView and OSR Driver Loader.

Make sure you have DbgView running if you want to see all the driver information.

I didn’t bother writing a loader/unloader because OSR Driver Loader works just fine.

See everyone in Vegas!
Shawn

Brief Description

Basically, Intel VT technology adds another processor mode called VMX mode. This mode is divided into VMX root and VMX non-root operation. In this example, the VMM runs in VMX root mode while the VM runs in VMX non-root mode.

VMX root mode has access to the new virtualization instructions but even more importantly is able to configure certain events such as interruptions, instructions, I/O port accesses, etc. to cause VM-exits in which control is transferred from the VM to the VMM (called a VM-exit).

Some instructions cause unconditional VM-exits (such as CPUID) and this is how the example works. Following the VM-exit, the VMM handler calls CPUID to fill the EAX register correctly then subverts the Vendor ID by directly writing ECX, EDX and EBX before returning control to the VM through a new virtualization instruction called VMRESUME.

Make sure you have disabled PAE. This release does not support these extensions.

Emulation Table

The following instructions cause VM-exits when they are executed in VMX non-root operation unconditionally: CPUID, INVD, MOV from CR3. This is also true of instructions introduced with VMX, which include: VMCALL, VMCLEAR, VMLAUNCH, VMPTRLD, VMPTRST, VMREAD, VMRESUME, VMWRITE, VMXOFF, and VMXON.

Additionally, a MOV to CR3 causes a VM-exit if a CR3-Targets field is 0 or the value is not in a white list of values. Since the current Intel VT only supports up to 4 targets (and you likely have more tasks running than that), CR3-Targets is set to 0 in the example and thus MOV to CR3 can be considered an unconditional VM-exit.

Execution of a new VMX instruction (such as VMXOFF) on a processor not in VMX mode will be seen as an attempt to execute an illegal instruction. Reboot anyone?

Instruction     Emulated   Operation

CPUID           Yes        EAX==0x00000000?Subvert:Normal
INVD            Yes        Normal                             *1
MOV from CR3    Yes        Normal
MOV to CR3      Yes        Normal
        
VMCLEAR         No         Ignored
VMLAUNCH        No         Ignored
VMPTRLD         No         Ignored
VMPTRST         No         Ignored
VMREAD          No         Ignored
VMRESUME        No         Ignored
VMWRITE         No         Ignored
VMXOFF          No         Ignored
VMXON           No         Ignored
        
RDMSR           Yes        Normal                             *2
WRMSR           Yes        Normal                             *2
        
VMCALL          No         EAX==0x12345678?VMXOFF:Ignored     *3

*1 Quote from Intel manual, “Use this instruction with care.” Go for it.

*2 I didn’t see these instructions causing VM-exits until I last minute tested on a laptop with a Core Duo T2300 processor. It was faster to just emulate them than setting up all the RDMSR and WRMSR bitmaps etc. so they wouldn’t occur.

*3 This instruction is used by the DriverUnload() routine to turn off VMX mode and remove the OS from the VM. It does so only if the EAX register contains the value 0x12345678 otherwise VMCALL is ignored.

EFAQ (Expected Frequently Asked Questions)

(q) Why a separate driver for each processor?
(a) Good question, I wanted to be able to easily put just one processor into VMX mode without implementing communication with the ring of zero. Laziness.

(q) What if I have more than two processors?
(a) Simply make a copy of either file and the only change you should need to make is in the 2 KeSetSystemAffinityThread() calls.

(q) Where do I get more detailed information about Intel virtualization?
(a) Take a look at the Intel System Programming Guide Volume 3B.

(q) How do I know if it is working?
(a) Try running the cpuid.exe utility included with the release.

(q) It does not appear to be working, what’s wrong?
(a) Did you disable PAE? Have DbgView running to see the output.

(q) Why is everything in one file and not modularized?
(a) It’s all eventually one file anyways, I just gave it a head start!

Unsupported

(1) Restart/Shutdown/Sleep will not function properly if driver is loaded.
(2) Pentium Addressing Extensions support (PAE)
- Add /noexecute=alwaysoff & /nopae to your boot.ini file.

Limitations of Public Release

(1) Doesn’t attempt to hide the fact that the OS is inside a VM.
(2) Doesn’t attempt to protect the VMM handler memory.
(3) Doesn’t attempt to be complete in any other aspect.
(4) Doesn’t bring you more Coke Zero©.

从CPU指纹到安全防御:如何利用CPUID与LBR/BTS检测内核级Rootkit? 本文深入探讨了如何利用Intel处理器的CPUID指令与LBR/BTS硬件特性检测内核级Rootkit。通过分析CPU执行的真实指令轨迹,绕过被篡改的操作系统接口,直接从硬件层面发现异常控制流转移,构建不依赖操作系统可信性的安全防御方案。文章详细介绍了CPUID指令的工作原理、LBR/BTS的分支记录机制,并提供了实战案例和代码示例。 阅读详情

相关推荐

cpuid_hook

cpuid hook(通过VMX技术,实现hook cpuid)~~~~~~~~!!!!!!!!!!

在控制台查看CPUID的命令

打开控制台,输入: wmic CPU get ProcessorID结果如下:

u014434080的专栏 1万+

cpuid hook(转载)

通过VMX技术,实现hook cpuid

【免费下载】 cpuidhook转载-通过VMX技术实现hookcpuid:项目核心功能与优势解析

在当前信息技术飞速发展的背景下,虚拟化技术已成为提升系统性能、保障信息安全的重要手段。今天,我们要介绍一个名为“cpuidhook转载-通过VMX技术实现hookcpuid”的开源项目,它通过VMX技术实现对CPUID指令的hook,为虚拟化环境中的CPU信息管理提供了新的解决方案。 ## 项目介绍 “cpuidhook转载-通过VMX技术实现hookcpuid”项目提供了一份关于利用VMX技...

gitblog_06706的博客 840

通过PC的CPU id生成唯一性的UUID

C++代码,VS工程,在windows x86上运行。通过获取PC的CPU id字符串,以这个字符串作为种子,生成唯一性的UUID。这个UUID可以用作PC的唯一性标识,或者身份认证的标识。UUID不同CPU不会重复,但相同CPU下每次的UUID值都一样。

cpuid hook(通过VMX技术,实现hook cpuid) c++.zip

cpuid hook(通过VMX技术,实现hook cpuid) c++.zip

一个 Hook Api 的源代码

#include #include #include #pragma comment(lib,"Dbghelp.lib")#pragma comment(lib,"User32.lib")typedef int (__stdcall *OLD_MessageBox)( HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption,UINT u

rgbsky_nudt的专栏 1004

AAAI 2025杰出论文解读:神经符号推理与生物多样性计算的突破性进展

本文深度解读了AAAI 2025两篇杰出论文的突破性进展。南京大学周志华团队提出“溯因反射”框架,高效解决神经符号推理中的“不一致性”核心难题,为构建可靠、可解释的AI系统提供了新路径。斯坦福大学等机构的DiVShift研究,则系统分析了公民科学数据中的复杂分布偏移,为利用海量数据精准监测生物多样性及应对AI数据偏差提供了关键方法论。

weixin_29085865的博客 501

VT虚拟化技术笔记(part 4

转:https://bbs.kanxue.com/thread-271967.htmVT虚拟化技术笔记(part 4)最近在学习VT技术,想把学习过程中记录的笔记分享出来。技术不精,有不对的地方还望指正。代码会发到https://github.com/smallzhong/myvt这个仓库中,目前还在施工中,还没写完。欢迎star,预计4月份完工(最近有点事,有个小测验要准备,可能得拖更一段时间)。

qq_38350702的博客 1196

PC微信逆向:破解聊天记录文件!_读取别人pc微信msg文件

本文详细介绍了PC版微信数据库的解密方法,总结了前人经验并补充了关键细节。通过OllyDbg调试工具从微信内存中获取32字节加密密钥,使用C++结合OpenSSL库实现解密程序。重点解决了开发环境配置问题,包括Visual Studio项目设置和OpenSSL库的版本适配,将原本固定的数据库路径改为参数化输入,提高了工具的通用性。该方案为电子取证中的微信数据提取提供了完整的技术路径,避免了研究者重复探索已解决的问题。

zz96405784848的博客 9769

20240128 C#与SCPI协议实战:轻量级仪器控制库ScpiNet应用指南

本文详细介绍了轻量级C#库ScpiNet在仪器控制中的应用。相较于传统的NI-VISA,ScpiNet无需安装庞大运行时,通过纯C#实现直接与USB或以太网设备通信,支持跨厂商SCPI仪器。文章提供了从快速连接到实战封装、错误处理的完整指南,帮助开发者构建简洁高效的自动化测试系统。

h9j8k7l6m5n的博客 548

逆向基础-Windows驱动开发【SSDT HOOK】

驱动开发,SSDT HOOK

AppWhite_Star的博客 2218

零基础搭建本地AI绘画环境:Stable Diffusion 3.5保姆级安装教程(含中文优化方案)

本文提供零基础搭建本地AI绘画环境的详细教程,重点介绍Stable Diffusion 3.5的安装与中文优化方案。从硬件配置检查到软件依赖安装,再到核心组件配置与中文语义增强,教程涵盖全流程操作指南,帮助用户快速掌握AI文生图模型的本地部署技巧,提升创作效率。

weixin_30752699的博客 314

更改CPUID思路整理

CPUID是个汇编指令来的....不依赖API.. VIA有几款CPU是可以自己决定CPUID的 支持VT技术的CPU 可以在VMM 中修改相应的寄存器,达到修改CPUID返回值 的效果. 确保CPU 支持INTEL VMX 技术,将VMXCPU加载后,再运行CPU-Z之类的软件,就发现不同了. 上传的附件 vmxcpu.zip (34.0 KB, 356

lionzl的专栏 8669

ContextCapture系列教程(三):大疆精灵4RTK版无人机POS数据提取、处理(处理后勉强达到免相控要求)

大疆精灵 Phantom 4 RTK于2018年发布,是大疆为高精度建图与精准飞行设计的行业级无人机,在精灵4无人机外形的基础上,机身增加了RTK模块,可以实现高精度 RTK 定位导航,相机与 RTK 系统采用微秒级时间同步,可以通过app 进行航线规划飞行

pausau的博客 1万+

红绿灯背后的数学:如何用Java算出“黄金绿灯时间“?

本文探讨了城市交通信号灯配时优化的数学原理与Java实现方法。文章首先分析了信号灯配时不合理导致的交通问题,指出精确计算绿灯时长的重要性。核心内容包括:1)基于M/M/1排队模型建立车流量数学模型,通过优化算法最小化总等待时间;2)使用Java实现信号灯优化控制器,采用梯度下降法动态调整绿灯时长。文中提供了完整的Java代码实现,包括信号灯控制器基类和优化控制器类,采用原子类保证线程安全,并详细解释了关键算法原理和实现细节。该方案可为城市智能交通系统提供理论支持和技术实现参考。

墨夶的博客 1345

cpuid hook(转载) - 通过VMX技术实现hook cpuid

cpuid hook(转载) - 通过VMX技术实现hook cpuid 去发现同类优质开源项目:https://gitcode.com/ 介绍 此仓库提供了一份关于通过VMX技术实现CPUID指令hook的资源文件。CPUID是x86架构CPU的一个指令,用于提供有关CPU的详细信息。通过VMX技术,我们可以在虚拟化环境中截获并修改CPUID指令的执行结果,从而实现对CPU信息的控制和管理。 特...

gitblog_06786的博客 519

Vue3 - [兼容PC和手机H5] 详细监听浏览器刷新 / 关闭 / 前进后退事件,用户点击关闭和刷新页面前 “拦截“ 操作并弹出提示框(实时监听用户关闭或刷新网页,触发时文字提醒并执行自定义操作)

vue3监听页面关闭和刷新,vue3中如何监听页面刷新和关闭事件,vue3中监听浏览器窗口关闭事件,并在窗口关闭进行操作,vue3怎么只在某个页面监听,其他页面不监听,vue3监听刷新和关闭怎么离开页面时注销释放,vue3怎么阻止浏览器前进和后退并提示,页面跳转离开后依旧可以监听到刷新和关闭,vue3怎么知道用户关闭了网页,vue3如何监听刷新网页操作并截断,vue3移动端手机h5网页手机网站监听浏览器刷新关闭,vue3当页面关闭或刷新时怎么提示用户离开不保存数据,vue3项目监听浏览器窗口或标签页关闭,并

🏆 前端领域优质创作者 1万+

网络靶场实战-物联网安全qiling框架初探

在这一小节中,我们简单学习了qiling框架,我们使用ctf例题以及qilinglab的11个闯关题目进行练习,熟练掌握了qiling框架的基础使用。后面的小节中,我们将使用qiling框架对仿真设备进行实例fuzz测试。

蛇矛实验室 1632

TOGAF架构内容—TOGAF 内容框架和企业元模型

TOGAF架构内容—TOGAF 内容框架和企业元模型

深圳市多克创新科技有限公司 1664

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

VMP3.6的反调试和反虚拟机

看雪上有人泄露了3.6.0.1406,第一时间先下载下来,然后加壳之后扔进x32dbg,A debugger has been found....... 还能怎么办?右键回收站。正准备放弃的时候,想了想要不在看看,好吧那就在看看,结果一段瞎分析之后定位到了scylla没有处理完善的函数NtQueryInformationThread和QueryInformationProcess 你问我怎么定位的,全是某牛姓男子给我说的,还有需要注意的时这些api下执行是不会断下的,因为它自己shadow了一份syst

被遗弃的庸才博客 6776

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

DLL巧妙的绕过被VMP壳HOOK的ZwProtectVirtualMemory

被VMP HOOK的ZwProtectVirtualMemory介绍 ZwProtectVirtualMemory,是一个修改内存输入的API函数,VirtualProtect和VirtualProtectEx修改内存属性都会通过ZwProtectVirtualMemory这个API函数. 在VMP壳的程序中,注入DLL进行一定的内存修改,但会发现,对WINAPI或者程序的代码段等进行WriteProcessMemory操作,会发现修改错误,错误提示是没有修改权限. 而WriteProcessMemo

JUST DO IT. 5577

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

zzeus学习

VMP壳 脱壳后 自动生成文件 修复OEP 输入表 UIF 去弄 Importrec 去修复 要看准 右键-》高级-》选择区段 -》FULL DUMP -》修改这个生成的文件就行了 查看按钮事件 按钮事件入口被VMP掉了 进去看到 jmp xxxxx 就是VMP入口 右键 ZEUS 分析 看LOG窗口 寻找 C...

weixin_30338481的博客 232

循环嵌套(多层 for 循环)

表:order(订单表,order_id, user_id)、user(用户表,user_id, user_name)✅ 优化:先查所有订单,拿到所有 user_id 批量 in 查询,内存 join。✅ 优化:先把优惠券转 HashMap,单层循环查找(hash 查找 O (1))SQL 只有 2 次,O (1) 数据库查询,内存遍历 O (n)。需求:查询所有订单列表,同时带出每个订单对应的用户名称。需求:订单列表、优惠券列表,把订单匹配对应的优惠券名称。复杂度:O (M+N),非常快。

weixin_43732943的博客 194
上一篇: Exploring the Insides of your Favourite Malware Sandbox, a Generic Approach
下一篇: Loading unsigned drivers on Vista
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值