|
抛一个很有意思的问题,关于OpenThreadToken
就我个人理解就是,在线程创建的时候默认继承的是ProcessToken,除非为线程分配一个单独ThreadToken,如果没有单独分配ThreadToken那么调用OpenThreadToken就是会返回无Token的错误信息。ProcessToken需要通过OpenProcessToken函数来获取。ImpersonationToken是一个模拟令牌,相当于假装有一个Client进程的安全令牌,这样就有一个访问Client进程的权限了。 请指正 |
|
|
|
抛一个很有意思的问题,关于OpenThreadToken
loc_49695E: ; CODE XREF: NtOpenThreadTokenEx+3Bj PAGE:0049695E lea eax, [ebp+var_28] PAGE:00496961 push eax ; int PAGE:00496962 lea eax, [ebp+var_2C] PAGE:00496965 push eax ; int PAGE:00496966 lea eax, [ebp+var_19] PAGE:00496969 push eax ; int PAGE:0049696A lea eax, [ebp+var_38] PAGE:0049696D push eax ; int PAGE:0049696E lea eax, [ebp+var_34] PAGE:00496971 push eax ; int PAGE:00496972 push [ebp+arg_8] ; int PAGE:00496975 push [ebp+Handle] ; Handle PAGE:00496978 call sub_49688F ; 完成功能的函数 PAGE:0049697D cmp eax, ebx PAGE:0049697F jge loc_4A211D mov [ebp+AccessMode], al PAGE:004968A6 xor ebx, ebx PAGE:004968A8 push ebx ; HandleInformation PAGE:004968A9 lea eax, [ebp+Handle] PAGE:004968AC push eax ; Object PAGE:004968AD push dword ptr [ebp+AccessMode] ; AccessMode PAGE:004968B0 push PsThreadType ; ObjectType PAGE:004968B6 push 40h ; DesiredAccess PAGE:004968B8 push [ebp+Handle] ; Handle PAGE:004968BB call ObReferenceObjectByHandle ; 对线程句柄引用一次 PAGE:004968C0 cmp eax, ebx PAGE:004968C2 mov ecx, [ebp+Handle] PAGE:004968C5 mov esi, [ebp+arg_C] PAGE:004968C8 mov [esi], ecx PAGE:004968CA jl short loc_4968F8 PAGE:004968CC push edi PAGE:004968CD push [ebp+arg_18] ; ImpersonationLevel PAGE:004968D0 push [ebp+arg_14] ; PBOOLEAN EffectiveOnly PAGE:004968D3 push [ebp+arg_10] ; PBOOLEAN CopyOnOpen PAGE:004968D6 push ecx ; hThread PAGE:004968D7 call PsReferenceImpersonationToken ; 关键函数,这里就是获取线程Token的函数 PAGE:004968DC cmp eax, ebx ; ebx=0 PAGE:004968DE mov edi, [ebp+arg_8] PAGE:004968E1 mov [edi], eax PAGE:004968E3 jnz loc_4A2268 ; 这里跳走 到PsReferenceImpersonationToken 函数这里,可以看到ImpersonationLevel参数被传了进去,是个指针。进入这个函数,我挑出来赋值的一段: test byte ptr [ebx+248h], 8 PAGE:004A19B3 mov esi, [ebx+20Ch] PAGE:004A19B9 jz short loc_4A1A22 PAGE:004A19BB mov ecx, [esi] PAGE:004A19BD mov [ebp+arg_0], ecx PAGE:004A19C0 call ObfReferenceObject PAGE:004A19C5 mov eax, [esi+8] PAGE:004A19C8 mov ecx, [ebp+arg_C] PAGE:004A19CB mov [ecx], eax PAGE:004A19CD mov al, [esi+4] PAGE:004A19D0 mov ecx, [ebp+arg_4] PAGE:004A19D3 mov [ecx], al PAGE:004A19D5 mov al, [esi+5] PAGE:004A19D8 mov ecx, [ebp+arg_8] PAGE:004A19DB mov [ecx], al PAGE:004A19DD PAGE:004A19DD loc_4A19DD: ; CODE XREF: PsReferenceImpersonationToken+14F41j PAGE:004A19DD mov ebx, [ebp+var_C] PAGE:004A19E0 mov esi, [ebx] PAGE:004A19E2 and esi, 0FFFFFFFEh PAGE:004A19E5 lea eax, [esi-4] PAGE:004A19E8 mov [ebp+arg_4], ebx ;CopyOnOpen PAGE:004A19EB mov [ebp+arg_8], esi ;EffectiveOnly PAGE:004A19EE mov [ebp+arg_C], eax ;ImpersonationLevel PAGE:004A19F1 mov eax, [ebp+arg_8] PAGE:004A19F4 mov ecx, [ebp+arg_4] PAGE:004A19F7 mov edx, [ebp+arg_C] 这里找到了ImpersonationLevel 这个值的出处 贴上MSDN PsReferenceImpersonationToken returns a pointer to the impersonation token for the given thread. If the thread is not currently impersonating a client, a NULL pointer is returned. 如果说ImpersonationLevel 这个值小于等于SecurityAnonymous等级的话,就直接返回空。从A线程打开B线程的Token时,就是这个SecurityAnonymous等级,所以每次都返回空... |
|
抛一个很有意思的问题,关于OpenThreadToken
能帮忙解决问题那就不叫灌水啊~谢谢了~等下我把ntosknl.exe的汇编贴出来..我想我找到一些原因了 |
|
抛一个很有意思的问题,关于OpenThreadToken
嗯,可以的,再补充一些,要是在主线程里面起一个A线程,然后在主线程中OpenThread获得A线程句柄,查询A线程的Token的话,就需要在A线程里面调用这个函数,而主线程不需要。 现在有个疑惑,为什么需要这样做.... 再具体一点就是线程为什么不能像进程那样可以直接获取Token,是因为CPU优先级的问题么? 能解释一下么? 谢谢了~ |
|
[求助]手脱ASProtect一次SHIFT+F9跑飞,请问哪里没设置好?
http://bbs.pediy.com/showthread.php?p=1344106#post1344106 可以看看这个 |
|
[求助]关于ssdt 给CreateProcess挂钩
u nt!NtCreateProcess nt!NtCreateProcess: 805c8420 8bff mov edi,edi 805c8422 55 push ebp 805c8423 8bec mov ebp,esp 805c8425 33c0 xor eax,eax 805c8427 f6451c01 test byte ptr [ebp+1Ch],1 805c842b 7401 je nt!NtCreateProcess+0xe (805c842e) 805c842d 40 inc eax 805c842e f6452001 test byte ptr [ebp+20h],1 805c8432 7403 je nt!NtCreateProcess+0x17 (805c8437) 805c8434 83c802 or eax,2 805c8437 807d1800 cmp byte ptr [ebp+18h],0 805c843b 7403 je nt!NtCreateProcess+0x20 (805c8440) 805c843d 83c804 or eax,4 805c8440 6a00 push 0 805c8442 ff7524 push dword ptr [ebp+24h] 805c8445 ff7520 push dword ptr [ebp+20h] 805c8448 ff751c push dword ptr [ebp+1Ch] 805c844b 50 push eax 805c844c ff7514 push dword ptr [ebp+14h] 805c844f ff7510 push dword ptr [ebp+10h] 805c8452 ff750c push dword ptr [ebp+0Ch] 805c8455 ff7508 push dword ptr [ebp+8] 805c8458 e80dffffff call nt!NtCreateProcessEx (805c836a) 805c845d 5d pop ebp 805c845e c22000 ret 20h NtCreateProcess只是对参数进行了一下校验,然后就call NtCreateProcessEX函数了,所以真正的实现在后面的函数中,InlineHook失败,是不是你并没有实现原函数前面的5个字节(xp下)的内容? |
|
[原创]PECompact v2.xx脱壳之魔兽改键精灵去弹广告
正在解决这个问题,小白刚刚学习,正好拿来参考~~Thanks |
|
[求助]对象目录的问题
对象目录存储结构是一个树形结构,如果加上符号链接的话,更像是图。 系统初始化的时候创建第一个目录对象,作为根目录,以后插入的命名对象都会插入到相应的目录项下。插入过程也就是树的遍历过程。 你说的循环指的是什么? |
|
[求助]如何移除驱动
没有选手动加载吧?换个加载工具吧,看雪资源里翻翻 |
|
求助 CTL_CODE问题
#define CTL_CODE( DeviceType, Function, Method, Access ) ( \ ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ ) DeviceType 文档里有~ Function 就当是ID好了,传个0xXXX就可以,但是不要和微软的定义重复 Method 与R0层交互时使用的数据传递方式 Access FILE_READ_ACCESS之类的 我对这玩意的理解是,这就是个功能码,用来区分不同的功能的,当然这个功能是你自己定义的,让驱动完成不同的操作。写清楚点就是(ID 就是功能码) switch(ID) { case 1: { func(); break; } .... } |
|
求助:如何得到进程被加载后的基地址?
dump文件中应该有吧? |
操作理由
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 }}
勋章
兑换勋章
证书
证书查询 >
能力值