擦除模組痕跡

2021-04-08 16:39:29 字數 1829 閱讀 5595

對於擦除模組痕跡,我實驗了兩種方法,下面一一闡述:

1.修改peb結構,用**說話

typedef 

struct

_peb_ldr_data

... peb_ldr_data, 

*ppeb_ldr_data;

typedef 

struct

_unicode_string

... unicode_string, 

*punicode_string;

typedef 

struct

_ldr_module 

... ldr_module, 

*pldr_module;

typedef 

struct

rtl_drive_letter_curdir

... rtl_drive_letter_curdir, 

*prtl_drive_letter_curdir;

typedef 

struct

_rtl_user_process_parameters

... rtl_user_process_parameters, 

*prtl_user_process_parameters;

typedef void (_stdcall 

*ppeblockroutine)(pvoid);

typedef 

struct

_peb_free_block

... peb_free_block, 

*ppeb_free_block;

struct

_nt_peb 

... ;

typedef 

struct

_client_id

... client_id, 

*pclient_id;

typedef 

struct

_gdi_teb_batch

... gdi_teb_batch, 

*pgdi_teb_batch;

struct

_nt_teb

... ;

static

struct

_nt_teb

*getcurrentthreadteb()                     

//獲得teb

...return

pteb;}

void

hidemodule(std::

string

strmodulename)

...;

multibytetowidechar(cp_acp,

0,strmodulename.c_str(), -1

,pwstrmodulename,strmodulename.size()); 

//peb裡面有當前程序的模組列表,toolhelp裡面的函式就是根據這個列表來遍歷的因此,修改此列表可以達到隱藏的目的

do...

pldrmodule 

=(pldr_module)pldrmodule

->

inloadordermodulelist.flink;

}while

(pldrmodule 

!=pfirstldrmodule);}

2.手動完成dll的載入:剛開始研究手動載入的時候覺得比較複雜,但是通過實踐之後,其實還是很簡單的,**比較長這裡就不詳加敘述了,我就用下面幾個步驟來分別敘述:

因為手動載入dll沒有經過系統的干涉,所以上面的peb結構裡面也就不會有相應的模組結構,也就達到了隱藏的目的。