Obtaining KeServiceDescriptorTableShadow address

制造业重点关注的17个Agent智能体落地场景方案.pptx 立即下载

In Windows NT based operating system every system call originated in user mode which is to be processed by the system抯 kernel must go through the gate to the kernel itself where it would be dispatched and executed. This gate is an interrupt INT 2Eh. While on the user side library ntdll.dll handles a system call, after passing the gate ntoskrnl.exe takes over invoking an internal function KiSystemService() and passing the original system call into it. Then, KiSystemService uses a lookup table for the information on which Native API call to assign the original call to. This lookup table is called System Service Table (SST), it has the following structure:

typedef NTSTATUS (NTAPI * NTPROC) ();
typedef NTPROC * PNTPROC;
#define NTPROC_ sizeof (NTPROC)

typedef struct _SYSTEM_SERVICE_TABLE
{
	PNTPROC	ServiceTable; // array of entry points to the calls 
	PDWORD	CounterTable; // array of usage counters 
	DWORD	ServiceLimit;   // number of table entries 
	PBYTE	ArgumentTable; // array of arguments
}
	SYSTEM_SERVICE_TABLE, 
	*PSYSTEM_SERVICE_TABLE, 
	**PP SYSTEM_SERVICE_TABLE; 

System Service Table itself is a member of another structure called Service Descriptor Table:

typedef struct _SERVICE_DESCRIPTOR_TABLE
{
	SYSTEM_SERVICE_TABLE ntoskrnl; //SST used by ntoskrnl.exe - Native API
	SYSTEM_SERVICE_TABLE win32k; // SST used by win32k.sys - gdi/user support
	SYSTEM_SERVICE_TABLE Table3; // reserved
	SYSTEM_SERVICE_TABLE Table4; // reserved
}
	SERVICE_DESCRIPTOR_TABLE, 
	*PSERVICE_DESCRIPTOR_TABLE, 
	**PPSERVICE_DESCRIPTOR_TABLE;

System Service Table structure is used by two different handles in the Kernel:

  • KeServiceDescriptorTable()
  • KeServiceDescriptorTableShadow()
点击看大图

While KeServiceDescriptorTable is readily available for kernel mode drivers to access, KeServiceDescriptorTableShadow is not. Moreover, KeServiceDescriptorTable does not have the System Service Table for win32k calls support.

Unfortunately, different versions of Windows NT have these two tables placed in different order. For example, on Windows 2000, KeServiceDescriptorTableShadow follows immediately after KeServiceDescriptorTable, while on Windows XP it appears right before KeServiceDescriptorTable.

Several different ways have been proposed to obtain the correct address of the Shadow table. In this example I shall demonstrate an approach to obtain the KeServiceDescriptorTableShadow address on Windows 2000 and Windows XP (incl. SP1) operating systems.

The idea behind this method (originally introduced in the book Undocumented Windows NT) is to use a function called KeAddSystemServiceTable as an indicator. This function is used by win32k.sys and therefore it just has to address the Shadow table since KeServiceDescriptorTable does not support win32k calls. Another assumption to be made is that the first entry in both KeServiceDescriptorTable and KeServiceDescriptorTableShadow is the same. Since it is relatively simple to obtain the address of KeServiceDescriptorTable, we may try to compare its first entry with the one obtained from KeAddSystemServiceTable. If they match, we consider the corresponding address to be the correct address of KeServiceDescriptorTableShadow. There is no guaranty that the very first valid address, produced by KeAddSystemServiceTable will match, thus we have to go through several addresses to find the right one.

The following code shows a correct solution for obtaining a KeServiceDescriptorTableShadow address on windows XP, it will work for a kernel mode device driver:

/* 
define structure for the system service table
*/ 
struct SYS_SERVICE_TABLE { 
	void **ServiceTable; 
	unsigned long CounterTable; 
	unsigned long ServiceLimit; 
	void **ArgumentsTable; 
}; 
/* 
Define KeServiceDescriptorTable based on the SST structure 
*/ 
extern struct SYS_SERVICE_TABLE *KeServiceDescriptorTable; 
/*
Declare function GetServiceDescriptorShadowTableAddress() 
*/
static struct SYS_SERVICE_TABLE * GetServiceDescriptorShadowTableAddress (); 
/* 
Declare the KeAddSystemServiceTable. This is just a 
handle to the call function, it will be used by the function 
above to obtain the correct address of the KeServiceDescriptorShadowTable 
*/ 
__declspec(dllimport) KeAddSystemServiceTable (ULONG, ULONG, ULONG, ULONG, ULONG); 
static struct SYS_SERVICE_TABLE * GetServiceDescriptorShadowTableAddress ()
{ 
	// First, obtain a pointer to KeAddSystemServiceTable
	unsigned char *check = (unsigned char*)KeAddSystemServiceTable; 
	int i;
 	//Initialize an instance of System Service Table, will be used to
	//obtain an address from KeAddSystemServiceTable
	struct SYS_SERVICE_TABLE *rc=0; 
	// Make 100 attempts to match a valid address with that of KeServiceDescriptorTable 
	for (i=0; i<=99; i++) { 
		__try { 
			// try to obtain an address from  KeAddSystemServiceTable 
			rc = *(struct SYS_SERVICE_TABLE**)check; 
			// if this address is NOT valid OR it itself is the address of 
			//KeServiceDescriptorTable OR its first entry is NOT equal 
			//to the first entry of KeServiceDescriptorTable 
			if (!MmIsAddressValid (rc) || (rc == KeServiceDescriptorTable) 
				|| (memcmp (rc, KeServiceDescriptorTable, sizeof (*rc)) != 0)) { 
					// Proceed with the next address 
					check++; 
					// don't forget to reset the old address 
					rc = 0; 
			} 
		} __except (EXCEPTION_EXECUTE_HANDLER) { rc = 0; } 
		// when the loop is completed, check if it produced a valid address 
		if (rc) 
			// because if it didn't, we failed to find the address of KeServiceDescriptorTableShadow 
			break; 
	} 
	// otherwise, there is a valid address! So return it! 
	return rc; 
} 

Note, that if you by some reason failed to find the correct address, your number of iterations (100 in my example) was not enough. Try to increase it slightly, I would not recommend to have the number of iterations larger than 4096, if you failed again even with the number that high, there are definitely other problems, most likely the assumptions mentioned above are no longer true for the operation system you use.

To call this function, simply create a new pointer to System Service Table with the same structure the function returns its address with, and then assign this address to it:

/*
define structure for the system service table
*/
struct SYS_SERVICE_TABLE {
	void **ServiceTable;
	unsigned long CounterTable; 
	unsigned long ServiceLimit; 
	void **ArgumentsTable; 
}; 

static struct  SYS_SERVICE_TABLE *ShadowTable; 
ShadowTable = GetServiceDescriptorShadowTableAddress(); 

Needless to say, that all these tricks can only be done with administrator rights. More over, if you plan to continue manipulating KeServiceDescriptorTableShadow, you will also need to enable Debug Privileges, even for the administrator.

科技中介服务机构如何构建智能化服务平台以提升服务效率与专业度?.docx 科技中介服务机构如何构建智能化服务平台以提升服务效率与专业度? 立即下载

相关推荐

【人工智能工程】完结JEV 决策大模型实战,让 AI 从会聊天到能决策

内容概要:本文介绍了JEV决策大模型的核心理念与工程实践,强调将其作为“快判断”层从通用大模型中剥离使用。JEV不生成文本,而是针对明确的状态和问题,输出结构化、带概率的决策结果,适用于高频、原子化的判断任务。文章详细阐述了JEV的工作机制、与通用大模型的本质区别、典型应用场景(如Agent工具路由)、questions的设计方法、能力边界以及兜底机制的重要性,并指出其在成本、延迟和输出确定性方面的优势。; 适合人群:具备一定AI工程实践经验的研发人员、系统架构师,尤其是正在构建Agent、自动化决策系统或优化大模型调用链的技术团队;; 使用场景及目标:①优化高频、轻量级判断任务(如工单分类、内容初筛、RAG相关性判定)的效率与成本;②实现主模型与决策模块的职责分离,提升系统整体稳定性与可维护性;③学习如何设计高质量的判断问题与概率校准机制; 阅读建议:此资源聚焦于决策模型的工程化落地,建议结合实际业务中的判断流程进行POC验证,重点关注questions设计、阈值校准与兜底策略的构建,避免盲目神化JEV的能力。

【原创】shadow ssdt学习笔记(一)

标 题: 【原创】shadow ssdt学习笔记(一) 作 者: zhuwg 时 间: 2007-12-22,22:01:29 链 接: http://bbs.pediy.com/showthread.php?t=56955 1。取得shadow ssdt真实地址 系统只提供了KeServiceDescriptorTable导出 KeServiceDescriptorTableSh

多媒体编程、网络编程、系统编程、网络安全编程、驱动编程 1162

从“烧电路”到“软杀伤”:拆解高功率微波(HPM)让无人机失灵的三种物理效应

本文深度解析高功率微波(HPM)如何通过热效应、电磁效应和非线性效应三种物理机制使无人机失灵。从电子元件的热损伤到系统的电磁干扰,再到电路中的非线性破坏,HPM技术为反无人机系统提供了高效的非动能打击手段。文章还探讨了现代无人机的多层级防护策略与应对方案。

weixin_42531886的博客 255

Win10 x64 KeServiceDescriptorTable SSDT 偏移计算理解

Win10 x64 KeServiceDescriptorTable SSDT 偏移计算理解引言站在巨人的肩膀上实现代码通用的偏移计算方法 引言 很久没写博客了,水个博客,KeServiceDescriptorTable 和 KeServiceDescriptorTableShadow的原理我就不写了,百度很多,主要这篇写如何定位x64下未导出的KeServiceDescriptorTable。 站在巨人的肩膀上 前辈们在之前已经找到了一个计算公式,通过读取msr寄存器的0xC0000082读取到

Doub1's Blog 2280

【校园网代理连接问题】已解决,“该设备或资源(Web 代理)未设置为接受端口“7890”上的连接“

我遇到这个问题很多次。每次都是vpn的问题,不止通俗意义上的梯子(clash之类的),还包括校园网vpn。点击“ 拨号和虚拟专用网络设置”中的“设置”, 关闭代理服务器。在打开vpn后或者关闭vpn后无法浏览网页,网页诊断显示“关闭“手动设置代理”中的“使用代理服务器”,关闭对应的本地代理即可。

聆雨。 1万+

QT+Halcon实现螺纹检测

工业上要检测螺丝的内外直径、内外牙距、内外角度,现在比较好用的图像处理库,开源的opencv,收费的有halcon。为了实现螺纹检测,和对比螺纹检测拿个库比较好。分别用opencv和halcon实现了螺纹检测,通过对比发现用halcon实现的效果比较。现在用博客把实现过程记录下来: 1、需要检测的螺纹数据如下: 2、为了实现检测螺丝以上数据,螺纹内径、螺纹外径、螺纹外牙距、螺纹...

专注现代C++实战,从核心语法到高性能编程,助力开发者深入掌握系统级编程精髓。 7052

Shadow SSDT

 A、Shadow SSDT表基址定位    B、Shadow SSDT表结构    C、Shadow SSDT HOOK KeServiceDescriptorTable //系统描述符表 extern KeServiceDescriptorTableShadow //影子系统描述符表  win32k.sys bp win32k!NtUserPostMessage bp win32k...

crkres9527 597

2024年下半年网络规划设计师论文真题

3、深入论述自身参与的工业网络是如何实施的,为实现制造业的智能化,如何实现数据的跨系统互通,促进各种工业数据的充分流动和无缝集成以及数据安全。3、结合自身参与的网络建设,详细叙述针对该网络“去NAT”的规划和设计方案。4、在实施过程中遇到的问题以及如何处理,项目实施后的效果和评价。2、大型园区网络“去NAT”改造和业务融合的整体架构。1、“网络去NAT”对推进ipv6演进和应用的意义。4、改造过程中遇到的问题及解决方案。2、简要叙述自身参与的制造网络建设。1、网络规划在智能制造中的意义。

鹿鸣天涯 2371

简单说说SSDT

论技术,我还差得远,而且网上关于SSDT的文章也多不胜数。但是还是想自己写一下,因为我想试试我能不能用最简单的语言来描述SSDT——这个对一般来人来说比较神秘的属于内核的地带。引用EVA说的一句话,“以为写个驱动就是内核,还远着了”——大概是这么个意思,记得不是很清楚。 关于SSDT,描述得最清楚的应该算《SSDT Hook的妙用-对抗ring0 inline hook》一文了,作者是堕落天才。这

camin920的专栏 791

Opus Clip AI技术浅析(一)

Opus Clip AI 是一款由Opus公司推出的AI视频剪辑工具,旨在通过人工智能技术简化视频编辑过程,帮助用户快速从长视频中提取精彩片段,并生成适合社交媒体分享的短视频。

m0_75253143的博客 2155

openbmc mctp i3c适配步骤

本文介绍了在Intel OKS平台下,BMC作为I3C从设备如何适配MCTP over I3C的实现方法。主要内容包括:1)关键术语解释,如MDB(Mandatory Data Byte)值为0xAE,DCR(Device Characteristics Register)和BCR(Bus Characteristics Register)的设置;2)适配流程说明,包括BMC作为控制器主节点分配地址后成为MCTP端点,CPU作为总线所有者的角色转换;3)测试验证步骤,展示通过mctp-client工具发送指

wit_yuan的专栏 132

KeServiceDescriptorTableShadow和KeAddSystemServiceTable函数的关系

KeServiceDescriptorTableShadow和KeAddSystemServiceTable函数的关系

linux-0.11调试教程 997

【Dumper-7】入门指南 - 带你领略不一样的UE世界

摘要: Dumper-7是一款用于分析UE4/UE5游戏的逆向工具,可自动生成游戏内部结构的C++ SDK。支持Visual Studio、CMake和Xmake三种构建方式,通过DLL注入目标游戏后,自动识别引擎结构并输出C++ SDK文件(默认保存在C:\Dumper-7目录)。该工具适用于游戏Mod开发、安全研究和机制分析,提供完整的类层次映射、属性/函数识别功能。使用时需注意x64平台配置,生成SDK后可集成到自定义DLL项目中,通过示例代码展示如何查找游戏对象、访问世界状态和调用引擎函数。

kinghzking的专栏 439

Windows下如何获得KeServiceDescriptorTableShadow地址

Windows下如何获得KeServiceDescriptorTableShadow地址 总结网上文章的观点,主要有下面几种:1.根据操作系统分类。在WIN2K下KeServiceDescriptorTableShadow接跟着keServiceDescriptorTable;而在XP下,顺序正好相反,KeServiceDescriptorTable紧跟着KeServiceDescri

misterliwei的专栏 3164

RT-DETR算法优化改进:轻量级上采样CARAFE算子 | 注意力机制大作战

上采样操作CARAFE,具有感受野大、内容感知、轻量级、计算速度快等优点,引入RT-DETR二次创新;1)代替Upsample进行使用;

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 1267

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

shadow ssdt学习笔记

1。取得shadow ssdt真实地址系统只提供了KeServiceDescriptorTable导出KeServiceDescriptorTableShadow是个未导出结构定义Copy code    typedef struct _SYSTEM_SERVICE_TABLE    {          PNTPROC  ServiceTable;  // array of entry

sea 2336

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

Window Hook 技术详解

Hook简介 微软的MSDN中,对Hook的解释为: A hook is a point in the system message-handling mechanism where an application can install a subroutine to monitor the message traffic in the system and process certain

cx1990820的专栏 8692

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

系统服务描述符表

   大家都知道在WINNT 的内核中存在着两个变量,KeServiceDescriptorTable,KeServiceDescriptorTableShadow,我们可以使用KD 看到。kd> dd nt!KeServiceDescriptorTable8046e0c0  804746e8 00000000 000000f8 80474acc8046e0d0  00000000 0000000

CPPLOVER_78的专栏 6051

研究心得-恢复2k xp得win32k.sys得KeServiceDescriptorTableShadow

/** * @file sdtreset.cpp  * * @brief sdtreset.cpp, v 1.0.0 2005/10/25 11:48:42 sunwang * * details here. * 草稿代码,命名混乱,重构时候使用java风格,getKiServiceTableAddrMM * 其实找到了KeServiceDescriptorTable/Shadow的真实entry

明日帝国的专栏-技术改进生活 5636

Shadow SSDT详解、WinDbg查看Shadow SSDT

一、获取ShadowSSDT 好吧,我们已经在R3获取SSDT的原始地址及SDT、SST、KiServiceTbale的关系里面提到:所有的SST都保存在系统服务描述表(SDT)中。系统中一共有两个SDT,一个是ServiceDescriptorTable,另一个是ServiceDescriptorTableShadow。ServiceDescriptor中只有指向KiServic...

515

KeServiceDescriptorTable 与 KeServiceDescriptorTableShadow

早先“盗用”过公开的Re SSDT的源代码,对SSDT多少还是了解些,也Hook 过SSDT,但一直对另外一个SSDT——Shadow SSDT不甚了解,只知道它跟GUI调用有莫大的关系,具体怎么联系起来的,说不清楚。   最近研究起了Hook ShadowSSDT这个东西,经过查找资料、阅读Win2k的源码,以及WinDbg闹腾了半天,才终于明白了KeServiceDescriptorTa

1089

在XP内核模式下如何获得KeServiceDescriptorTableShadow的地址

在XP内核模式下如何获得KeServiceDescriptorTableShadow的地址 In Windows NT based operating system every system call originated in user mode which is to be processed by the system抯 kernel must go through the gate

A00553344的专栏 3367

RMB系统调用4、SSDT

一、回顾 前两篇博客,我逆向分析了 KiSystemService 和 KiFastCallEntry 填充_KTRAP_FRAME 结构体的代码,二者大同小异,主要的区别是 sysenter 只改了eip,cs,ss,虽然esp也改了,但是windows不使用,而是从TSS里取esp0;另外sysenter并没有像中断门那样压栈,所以3环的 ss, esp, eflags, cs,eip都要在函数里依次保存到 _KTRAP_FRAME 。 这次课后作业是逆向 KiSystemService / KiFas

Windows内核学习笔记 371

rku逆向分析 膜拜XueTr的linxer大牛

这个驱动本来准备端午节搞的,但后来端午节去了躺北京玩了几天,也就搁置了...最近连续花了4个晚上,大致把它搞的差不多了,有些收获...初学window驱动,水平很菜,有些东西我也未必清明,加上3环的代码还没有吃透,期间也没有用调试器跟踪,全是IDA(F5)静态分析的,谬误在所难免,高手请飘过,希望对菜鸟学习有点帮助.<br /><br />1.SSDT检测<br /><br />这个功能有三个IoControlCode与之对应,他们分别是22000fh(拷贝KeServiceDescriptorTable)

Sunny_wwc的专栏 7004

系统服务调度表SSDT及SSSDT Shadow

系统服务:由操作系统提供的一组函数(内核函数),API可以间接或者直接的调用系统服务。操作系统以动态链接库(DLL)的形式提供API。 SSDT:系统服务调度表(System  Service  Dispatch Table),该表可以基于系统服务编号进行索引,来定位函数内存地址。 SSPT:系统服务参数表(System  Service  Parameter  Table),指定系统服务函数

多媒体编程、网络编程、系统编程、网络安全编程、驱动编程 1648

windbg符号链接的问题.还有KeServiceDescriptorTableShadow内存块查找时问号的情况

最近配置windbg比较郁闷,搞了几天才搞定,自己的经验希望能帮助大家.也方便自己以后查阅 首先介绍几个命令: lm 列出加载模块信息 如下 0: kd> lm start    end        module name 80800000 80a28000   nt         (export symbols)       ntkrnlmp.exe Unloaded m

yandaoming的专栏 1187
上一篇: WIN和TCPIP栈的一些资料
下一篇: Windows2k下的同步机制
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值