首页
社区
课程
招聘
[分享github] 借用卡巴VT实现Hook ssdt
2020-8-30 12:38 15934

[分享github] 借用卡巴VT实现Hook ssdt

2020-8-30 12:38
15934

hook ssdt shadow_ssdt 稳如狗

卡巴帮你初始化的VT环境,你说稳不稳

我们只要写回调函数就好了


VS2019直接编译

https://github.com/iPower/KasperskyHook

搜索卡巴VT

bool kaspersky::initialize()
{
// Find SetHvmEvent
//
set_hvm_event = reinterpret_cast< f_SetHvmEvent >( utils::find_pattern_km( L"klhk.sys", ".text", "\x48\x83\xEC\x38\x48\x83\x3D",
 "xxxxxxx" ) );

if ( !set_hvm_event )
 return false;

// Find klhk's service table
//
auto presult = utils::find_pattern_km( L"klhk.sys", "_hvmcode", "\x4C\x8D\x0D\x00\x00\x00\x00\x4D", "xxx????x" );

if ( !presult )
 return false;

system_dispatch_array = reinterpret_cast< void*** >( presult + *reinterpret_cast< int* >( presult + 0x3 ) + 0x7 );

// Find number of services (SSDT)
//
presult = utils::find_pattern_km( L"klhk.sys", ".text", "\x3B\x1D\x00\x00\x00\x00\x73\x56", "xx????xx" );

if ( !presult )
 return false;

ssdt_service_count = reinterpret_cast< unsigned int* >( presult + *reinterpret_cast< int* >( presult + 0x2 ) + 0x6 );

// Find number of services (Shadow SSDT)
//
presult = utils::find_pattern_km( L"klhk.sys", ".text", "\x89\x05\x00\x00\x00\x00\x8B\xFB", "xx????xx" );

if ( !presult )
 return false;

shadow_ssdt_service_count = reinterpret_cast< unsigned int* >( presult + *reinterpret_cast< int* >( presult + 0x2 ) + 0x6 );

// Find provider data
//
presult = utils::find_pattern_km( L"klhk.sys", ".text", "\x39\x2D\x00\x00\x00\x00\x75", "xx????x" );

if ( !presult )
 return false;

provider = reinterpret_cast< unsigned int* >( presult + *reinterpret_cast< int* >( presult + 2 ) + 0x6 );

return true;
}




HOOK SSDT



bool kaspersky::hook_ssdt_routine( unsigned short index, void* dest, void** poriginal )
{
if ( !system_dispatch_array || !dest || !poriginal )
 return false;

// Get ssdt service count
//
const auto svc_count = get_svc_count_ssdt();

// Kaspersky's SSDT isn't built/Invalid index
//
if ( !svc_count || index >= svc_count )
 return false;

// Swap entry
//
*poriginal = *system_dispatch_array[ index ];
*system_dispatch_array[ index ] = dest;

return true;
}



Hooks shadow SSDT


bool kaspersky::hook_shadow_ssdt_routine( unsigned short index, void* dest, void** poriginal )
{
if ( !system_dispatch_array || !dest || !poriginal )
 return false;

// Get service count for ssdt and shadow ssdt
//
const auto svc_count = get_svc_count_ssdt(), svc_count_shadow_ssdt = get_svc_count_shadow_ssdt();

// Failed to obtain service count
//
if ( !svc_count || !svc_count_shadow_ssdt )
 return nullptr;

// Calculate index for dispatch table
//
const auto index_dispatch_table = ( index - 0x1000 ) + svc_count;

// Get dispatch table limit
//
const auto dispatch_table_limit = svc_count + svc_count_shadow_ssdt;

// Invalid index
//
if ( index_dispatch_table >= dispatch_table_limit )
 return false;

// Swap entry
//
*poriginal = *system_dispatch_array[ index_dispatch_table ];
*system_dispatch_array[ index_dispatch_table ] = dest;

return true;
}


[培训]二进制漏洞攻防(第3期);满10人开班;模糊测试与工具使用二次开发;网络协议漏洞挖掘;Linux内核漏洞挖掘与利用;AOSP漏洞挖掘与利用;代码审计。

收藏
点赞9
打赏
分享
最新回复 (15)
雪    币: 248
活跃值: (3789)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
luskyc 2020-8-30 14:57
2
0
懒人专用
雪    币: 2020
活跃值: (2785)
能力值: (RANK:260 )
在线值:
发帖
回帖
粉丝
xiaohang 3 2020-8-30 18:47
3
0
有空拿来玩一下
雪    币: 8107
活跃值: (4396)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
sunsjw 1 2020-8-31 09:23
4
0
就服你。。有思想。
雪    币: 22
活跃值: (423)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
靴子 2020-8-31 09:41
5
0
good!
雪    币: 615
活跃值: (445)
能力值: ( LV4,RANK:40 )
在线值:
发帖
回帖
粉丝
ugvjewxf 2020-8-31 17:05
6
1
为什么不是360? 不是腾讯管家?  
雪    币: 27
活跃值: (748)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
我叫KK 2020-8-31 19:03
7
1
VMP BOOM
雪    币: 11311
活跃值: (4889)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
hhkqqs 1 2020-9-1 17:22
8
0
太骚了
雪    币: 1378
活跃值: (3067)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
风中小筑V 2020-9-4 21:36
9
0
very good.
雪    币: 267
活跃值: (3244)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
EX呵呵 2020-9-12 13:40
10
0
强呀
雪    币: 523
活跃值: (827)
能力值: ( LV6,RANK:90 )
在线值:
发帖
回帖
粉丝
笑熬浆糊 2 2020-9-21 14:38
11
0
这思路,真的是骚死我了
雪    币: 1019
活跃值: (593)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
一个懵懂的SB 2020-10-30 18:06
12
0
需要借助klhk. sys ,不如直接InfinityHook更方便
雪    币: 373
活跃值: (638)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
贝优妮塔 2021-1-10 03:08
13
0
最新版本 win10  set_hvm_event() 这里失败 有人懂么
雪    币: 43
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
游戏daera 2021-3-3 11:24
14
0
小白表示一脸懵逼
雪    币:
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
mb_ebbbspvn 2023-2-11 23:57
15
0
对于打了页表隔离补丁的系统..他能用吗,
雪    币: 22
活跃值: (423)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
靴子 2023-2-12 13:07
16
0
还有利用卡巴自动脱壳的
游客
登录 | 注册 方可回帖
返回