2008年第1期 夜枫《内核方法实现进程保护》就已经介绍了ring3下修改SSDT表中的NativeAPI 技术,只不过实现的是进程保护,hook了不一样的API函数而已,一样也是修改SSDT表的操做。 冰刃(IceSword)软件,是否能对抗hook ZwSetInformationFile? 尝试PK,果然不出所料,在冰刃面前,Hook ZwSetInformationFile技术毫无做用。windows
战斗一: ZwSetInformationFile 是什么东西?服务器
查DDK : ZwSetInformationFile routine changes various kinds of information about a file object.函数
FileBasicInformation: Change the information that is supplied in a FILE_BASIC_INFORMATION struct. 工具
typedef struct FILE_BASIC_INFORMATION {
LARGE_INTEGER CreationTime;
LARGE_INTEGER LastAccessTime;
LARGE_INTEGER LastWriteTime;
LARGE_INTEGER ChangeTime;
ULONG FileAttributes;
} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
学习
修改文件的这些属性,说白了就是修改文件的MFT部分。在文件层作的,在底层的话,就是修改MFT扇区中的数据。优化
还能够修改好多,只有在用到的时候,再去查。操作系统
ZwSetInformationFile changees information about a file .If you set FileInformationClass to FileDispositionInformation,you can subsequently pass FileHandle to ZwClose but not to any other ZwXXXFile routine.Beacuase FileDispositionInformation causes the file to be marked for deletion,it is a programing error to attempt any subsequent operation on the handle other than closing it ..net
If you set FileInformationClass to FileEndOfFileInformation,and the EndOfFile member FILE_END_OF_FILE_INFORMATION specifies an offset beyond the current end-of-file mark, ZwSetInformationFile extends the file and pads extension with zeros.orm
FileDispositionInformation: sets the DeleteFile member of a FILE_DISPOSITION_INFORMATION to TRUE. so the File can be deleted when ZwClose is called to release the last open handle to the file object. The caller must have opened the file with the delete flag set in the DesiredAccess paramter. server
FileEndofFileInformation: Change the current end-of-file information,supplied in a FILE_END_OF_FILE_INFORMATION structure. The operation can either truncate or extend the file .The caller must have opened the file with the FILE_WRITE_DATA flag in the DesiredAccess parameter.
DDK中的内容暂时告一段落。
战斗二:初与冰刀(iceSword)
IceSword 使用了大量新颖的内核技术,使得后门无所躲藏,使用者要有操做系统的知识。能够产看木马后门,这些系统级后门愈来愈强,通常均可以垂手可得的隐藏进程、端口、注册表、文件信息,通常的工具根本没法发现这些“幕后黑手”。
下载了冰刃后,并一睹它的芳容:
当打开进程的时候,能够看到全部的进程,隐藏的进程都以红色显示出来。端口也相似。
当用冰刃打开SSDT的时候,发现:
8059946E正好是SSDT的基地址,对其反汇编和用冰刃看到的函数同样。
在冰刃中还发现了其它的win32 API: NtClose 、 NTCreateFile 、NTSetInformation 、NTWriteFile 、ZwSetInformationFile、等对应API。
战斗三: 基地址反汇编后的函数为:NtAcceptConnectPort. 这个例程到底什么呢?
function is used in LPC communication by server process for establish connection with client. 进程间通讯(IPC)是在多任务操做系统或者联网的计算机之间运行的程序和进程所用的通讯技术。有两种类型的进程间通讯。本地过程调用(LPC)和远程过程调用(RPC)。处于未知的缘由,微软没有公开LPC的接口。微软为机器间的客户机服务器通信提供了一套RPC。 windows NT 优化了RPC,将其转化为LPC,只不过客户机服务器全在同一台机器上。
服务器端调用NtCreatePort()函数建立一个端口。它返回一个端口句柄,服务器就使用此句柄调用NtListenPort()函数来等待和接受请求。任何客户端均可以经过此端口发送链接请求,并获得一个用于通信的端口句柄。先稍微的接触一下,知道各个遇见的对手都是什么样的。未来用到的时候,再作深究。
战斗四:inline Hook?
胜败乃兵家常事,大侠请从新来过! inline hook 就像我玩仙剑的时候,出现的菜鸟迎战的第一个boss. 下一节,主要分析,真对inline hook 进行攻关,感受这种学习和玩游戏同样,说不定就打出什么好的装备,和经验值。我就以这样的心态来学习吧。请勿各位看我帖子的朋友们,不要嘲笑我。