<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[hambaga的博客]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/Kwansy</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; Kwansy]]></copyright><item><title><![CDATA[KTHREAD 结构体属性介绍]]></title><link>https://blog.csdn.net/Kwansy/article/details/110671173</link><guid>https://blog.csdn.net/Kwansy/article/details/110671173</guid><author>Kwansy</author><pubDate>Wed, 10 Mar 2021 11:30:05 +0800</pubDate><description><![CDATA[typedef struct _KTHREAD {

    //
    // The dispatcher header and mutant listhead are fairly infrequently
    // referenced.
    //

    DISPATCHER_HEADER Header;	// KTHREAD 是可等待对象，线程结束时有信号
    
    // 此链表存储了属于该线程的所有 mutant（对应3环的 mutex）
    // 一旦该线程获得了 mu]]></description><category></category></item><item><title><![CDATA[EPROCESS 结构体属性介绍]]></title><link>https://blog.csdn.net/Kwansy/article/details/110672988</link><guid>https://blog.csdn.net/Kwansy/article/details/110672988</guid><author>Kwansy</author><pubDate>Wed, 10 Mar 2021 11:29:58 +0800</pubDate><description><![CDATA[typedef struct _EPROCESS {
    // KPROCESS 和 EPROCESS 地址相同
    KPROCESS Pcb;

    //
    // Lock used to protect:
    // The list of threads in the process.
    // Process token.
    // Win32 process field.
    // Process and thread affinity setting.
    /]]></description><category></category></item><item><title><![CDATA[ETHREAD 结构体属性介绍]]></title><link>https://blog.csdn.net/Kwansy/article/details/110674081</link><guid>https://blog.csdn.net/Kwansy/article/details/110674081</guid><author>Kwansy</author><pubDate>Wed, 10 Mar 2021 11:29:51 +0800</pubDate><description><![CDATA[typedef struct _ETHREAD {
    KTHREAD Tcb;

    // 线程创建时间
    LARGE_INTEGER CreateTime;

    union {
        // 线程退出时间
        LARGE_INTEGER ExitTime;
        
        // 用于跨进程通信
        LIST_ENTRY LpcReplyChain;
        
        // 带键事件等待链表  
        LIST]]></description><category></category></item><item><title><![CDATA[vs2019 编译 WRK 踩坑记录]]></title><link>https://blog.csdn.net/Kwansy/article/details/110457212</link><guid>https://blog.csdn.net/Kwansy/article/details/110457212</guid><author>Kwansy</author><pubDate>Wed, 10 Mar 2021 11:29:15 +0800</pubDate><description><![CDATA[一、回顾
上一篇博客介绍了命令行编译 WRK 到调试的所有步骤，理论上我们已经可以开始学习了。
但是 IDE 可以方便的查找和修改函数，好处多多，所以这篇博客介绍如何使用 visual studio 编译 WRK。
这篇博客会沿用上一篇博客的部分配置，建议读者先跟着上一篇博客配置一下。
二、Windows-Research-Kernel-WRK-
https://github.com/HighSchoolSoftwareClub/Windows-Research-Kernel-WRK-
里面有详细的用法介绍]]></description><category></category></item><item><title><![CDATA[进程线程创建过程]]></title><link>https://blog.csdn.net/Kwansy/article/details/110938883</link><guid>https://blog.csdn.net/Kwansy/article/details/110938883</guid><author>Kwansy</author><pubDate>Wed, 10 Mar 2021 10:26:23 +0800</pubDate><description><![CDATA[一、进程创建过程
所有进程都通过 PspCreateProcess 函数创建，包括 System 进程。它被三个函数调用，分别是NtCreateProcessEx、PsCreateSystemProcess 和 PspInitPhase0 。
NtCreateProcessEx 是 CreateProcess 的内核服务；
PspInitPhase0 函数是系统初始化早期调用的，它创建了 System 进程，System 进程的句柄保存在全局变量 PspInitialSystemProcessHandle ]]></description><category></category></item><item><title><![CDATA[几种常见的反调试方法]]></title><link>https://blog.csdn.net/Kwansy/article/details/114520927</link><guid>https://blog.csdn.net/Kwansy/article/details/114520927</guid><author>Kwansy</author><pubDate>Mon, 08 Mar 2021 09:37:56 +0800</pubDate><description><![CDATA[#include &lt;Windows.h&gt;
#include &lt;stdio.h&gt;

BOOL IsDebug1()
{
	return IsDebuggerPresent();
}

BOOL IsDebug2()
{
	HANDLE hProcess = GetCurrentProcess();
	BOOL bDebug;
	if (0 == CheckRemoteDebuggerPresent(hProcess, &amp;bDebug))
	{
		return TRUE;
	}]]></description><category></category></item><item><title><![CDATA[使用SEH实现跳转]]></title><link>https://blog.csdn.net/Kwansy/article/details/114455200</link><guid>https://blog.csdn.net/Kwansy/article/details/114455200</guid><author>Kwansy</author><pubDate>Sat, 06 Mar 2021 20:25:38 +0800</pubDate><description><![CDATA[这是一个很粗糙的demo，它的功能是添加了一个异常处理函数到SEH链表的头部。然后触发一个除零异常，跳转到我们指定的函数中执行。
没有仔细研究SEH的工作原理，只是知道了有这么一种跳转方式而已，详细的内容请看《加密与解密4》第八章内容。
// SEH.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include &lt;Windows.h&gt;

void fool()
{
	Mess]]></description><category></category></item><item><title><![CDATA[花指令——多个指令共用字节]]></title><link>https://blog.csdn.net/Kwansy/article/details/114442024</link><guid>https://blog.csdn.net/Kwansy/article/details/114442024</guid><author>Kwansy</author><pubDate>Sat, 06 Mar 2021 16:25:29 +0800</pubDate><description><![CDATA[一、原理
一个字节属于两条指令。
短跳转的指令机器码是 EB XX，XX是指跳转位置到JMP指令的下一条指令的偏移，例如 EB 00 就是跳转到JMP 的下一条指令，相当于啥也不做，如图：

那么如果是 EB FF ，就会跳转到JMP指令本身的第二字节：

对于这个特性，稍加利用，可以编写出这样的代码：

跳转执行后，跳到JMP第二字节，FF C0 被识别成 INC EAX，48 被识别成 DEC EAX，执行后反汇编的结果如下：

这就是无效汇编指令的原理，EB FF C0 48 这段硬编码可以添加到程序]]></description><category></category></item><item><title><![CDATA[CreateProcess 重定向CMD实现反弹shell]]></title><link>https://blog.csdn.net/Kwansy/article/details/114274598</link><guid>https://blog.csdn.net/Kwansy/article/details/114274598</guid><author>Kwansy</author><pubDate>Mon, 01 Mar 2021 23:53:53 +0800</pubDate><description><![CDATA[这段代码比我还老了，哈哈~
功能很简单，就是一直尝试向某个ip:port反弹shell，C2用nc就能接收这个反弹shell。
// RedirectCmd.cpp : Defines the entry point for the console application.
// 还原《恶意代码分析实战》第九章练习样本2

#include "stdafx.h"
#include &lt;WinSock2.h&gt;
#include &lt;Windows.h&gt;

#pragma comment(l]]></description><category></category></item><item><title><![CDATA[timestomping 修改文件时间戳]]></title><link>https://blog.csdn.net/Kwansy/article/details/114262524</link><guid>https://blog.csdn.net/Kwansy/article/details/114262524</guid><author>Kwansy</author><pubDate>Mon, 01 Mar 2021 14:43:45 +0800</pubDate><description><![CDATA[Attribute Changer 是一款免费的修改文件时间戳的工具，使用简单，不多介绍。下面给出代码修改的方法：
#include &lt;Windows.h&gt;

// 修改文件2的时间戳使其和文件1一样
void Timestomping(LPCSTR lpszFile1, LPCSTR lpszFile2)
{
	HANDLE hFile1 = CreateFileA(lpszFile1,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_A]]></description><category></category></item><item><title><![CDATA[CreateService / SC 创建自启动服务]]></title><link>https://blog.csdn.net/Kwansy/article/details/114259834</link><guid>https://blog.csdn.net/Kwansy/article/details/114259834</guid><author>Kwansy</author><pubDate>Mon, 01 Mar 2021 12:05:22 +0800</pubDate><description><![CDATA[下面的代码创建了一个服务，然后把自己复制到C盘下，通过服务实现开机自启动。
如果要卸载这个服务，只需执行一下命令：
sc delete AutoStartServiceDemo

// AutoStartServiceDemo.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include &lt;windows.h&gt;


char lpszServiceName[MAX_PATH]]]></description><category></category></item><item><title><![CDATA[repne scasb + rep movsd + rep movsb 内联实现 strcat]]></title><link>https://blog.csdn.net/Kwansy/article/details/114242070</link><guid>https://blog.csdn.net/Kwansy/article/details/114242070</guid><author>Kwansy</author><pubDate>Sun, 28 Feb 2021 23:14:29 +0800</pubDate><description><![CDATA[我在前面写了两篇博客分别介绍内联实现 strlen 和 strcpy，这次介绍的 strcat 其实是 strlen + strcpy ，没什么新东西。

.text:0040265A                 lea     edi, [ebp+lpszExeName]
.text:00402660                 lea     edx, [ebp+Src]
.text:00402666                 or      ecx, 0FFFFFFFFh
.text:0]]></description><category></category></item><item><title><![CDATA[rep movsd + rep movsb 内联实现 strcpy]]></title><link>https://blog.csdn.net/Kwansy/article/details/114239988</link><guid>https://blog.csdn.net/Kwansy/article/details/114239988</guid><author>Kwansy</author><pubDate>Sun, 28 Feb 2021 21:09:52 +0800</pubDate><description><![CDATA[下面的代码片段是一个内联的 strcpy ，not ecx 为止是计算源字符串的长度（含NULL），00402646 到 00402651 是以4字节为单位复制，最后3行是把剩下的0-3字节复制过去。

.text:00402632                 mov     edi, offset aSystemrootSyst ; "%SYSTEMROOT%\\system32\\"
.text:00402637                 lea     edx, [ebp+Src]
.tex]]></description><category></category></item><item><title><![CDATA[repne scasb 内联实现 strlen]]></title><link>https://blog.csdn.net/Kwansy/article/details/114225995</link><guid>https://blog.csdn.net/Kwansy/article/details/114225995</guid><author>Kwansy</author><pubDate>Sun, 28 Feb 2021 15:39:28 +0800</pubDate><description><![CDATA[逆向时如果见到这种代码，记住这是 strlen：
0040251B  |.  33C0          xor eax,eax                              ;  search NULL
0040251D  |.  F2:AE         repne scas byte ptr es:[edi]             ;  search...
0040251F  |.  F7D1          not ecx                              ]]></description><category></category></item><item><title><![CDATA[“/c del %s ＞＞ NUL“ 删除自身demo]]></title><link>https://blog.csdn.net/Kwansy/article/details/114223951</link><guid>https://blog.csdn.net/Kwansy/article/details/114223951</guid><author>Kwansy</author><pubDate>Sun, 28 Feb 2021 15:00:35 +0800</pubDate><description><![CDATA[#include &lt;Windows.h&gt;


int _tmain(int argc, _TCHAR* argv[])
{
	char szFile[MAX_PATH] = {0};
	char param[0x1000] = {0};
	GetModuleFileNameA(NULL,szFile,MAX_PATH);
	GetShortPathNameA(szFile,szFile,MAX_PATH);
	sprintf(param,"/c del %s &gt;&gt; NUL", szF]]></description><category></category></item><item><title><![CDATA[CreateFileMapping 内存映射读写文件]]></title><link>https://blog.csdn.net/Kwansy/article/details/114062311</link><guid>https://blog.csdn.net/Kwansy/article/details/114062311</guid><author>Kwansy</author><pubDate>Thu, 25 Feb 2021 09:55:58 +0800</pubDate><description><![CDATA[传统的文件读写ReadFile WriteFile 是以流的方式读写；可以通过下面的API组合，将文件映射到内存中进行读写，这样比流的方式处理起来更方便。
读文件
HANDLE hFile = CreateFileA("C:\\Users\\Administrator\\Desktop\\aa.txt",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,0);
HANDLE hMap = CreateFileMappingA(hFile,NULL,PAGE_]]></description><category></category></item><item><title><![CDATA[逆向分析使用COM组件对象模型的代码]]></title><link>https://blog.csdn.net/Kwansy/article/details/114010975</link><guid>https://blog.csdn.net/Kwansy/article/details/114010975</guid><author>Kwansy</author><pubDate>Wed, 24 Feb 2021 10:06:43 +0800</pubDate><description><![CDATA[《恶意代码分析实战》第七章实验7-2的程序使用了COM进行联网通信。首先把书上第七章关于COM介绍的原文贴出来：



总结一下，就是说恶意程序有时会通过另一个服务程序提供的接口函数实现一些操作，书上给的例子就是调用IE浏览器的 IWebBrowser2 接口的 IWebBrowser2Vtbl.Navigate 函数实现访问WEB地址。
逆向分析实验7-2，我们会看到如下代码（已注释）：

HRESULT CoCreateInstance(
  REFCLSID  rclsid,
  LPUNKNOWN ]]></description><category></category></item><item><title><![CDATA[reflective dll injection 反射注入]]></title><link>https://blog.csdn.net/Kwansy/article/details/113881923</link><guid>https://blog.csdn.net/Kwansy/article/details/113881923</guid><author>Kwansy</author><pubDate>Sat, 20 Feb 2021 13:55:04 +0800</pubDate><description><![CDATA[一、reflective dll injection 反射注入介绍
网上对反射注入的定义是只通过内存把DLL注入到特定进程中，也就是说整个过程都不涉及文件操作。
优点


规避杀软基于文件系统的检测


不会在进程的DLL链表里留下记录


通过特殊处理，可以使用正常的方式编写DLL，实现shellcode的效果


缺点

DLL体积较大，相比于shellcode注入，更容易被检测

二、修改dos头，填入精心构造的 bootstrap shellcode
metasploit 实现的bootstrap ]]></description><category></category></item><item><title><![CDATA[apatedns unhandled exception]]></title><link>https://blog.csdn.net/Kwansy/article/details/113643057</link><guid>https://blog.csdn.net/Kwansy/article/details/113643057</guid><author>Kwansy</author><pubDate>Thu, 04 Feb 2021 14:02:06 +0800</pubDate><description><![CDATA[运行 apatedns 会提示安装 .NET ，它会自动下载最新版，NO！我们要下载 2.0 的，不然会闪退。


]]></description><category></category></item><item><title><![CDATA[Win10 EPROCESS 断链]]></title><link>https://blog.csdn.net/Kwansy/article/details/113372198</link><guid>https://blog.csdn.net/Kwansy/article/details/113372198</guid><author>Kwansy</author><pubDate>Fri, 29 Jan 2021 10:51:54 +0800</pubDate><description><![CDATA[介绍
参考了 https://github.com/landhb/HideProcess/
动态获取 ActiveProcessLinksOffset ，可兼容不同版本的win10 x64系统。
运行结果
隐藏加载器自身

隐藏成功

驱动加载
#include &lt;windows.h&gt;  
#include &lt;winsvc.h&gt;  
#include &lt;conio.h&gt;  
#include &lt;stdio.h&gt;
#include &lt;winioctl.h&]]></description><category></category></item></channel></rss>