RtlAdjustPrivilege() 这玩意是在 NTDLL.DLL 里的一个不为人知的函数,MS没有公开,原因就是这玩意实在是太NB了,以至于不需要任何其他函数的帮助,仅凭这一个函数就可以获得进程ACL的任意权限!
下面是函数定义:

NTSTATUS RtlAdjustPrivilege
(
ULONG    Privilege,
BOOLEAN Enable,
BOOLEAN CurrentThread,
PBOOLEAN Enabled
)

参数的含义:
Privilege [In] Privilege index to change.                        
// 所需要的权限名称,可以到MSDN查找关于Process Token & Privilege内容可以查到

Enable [In] If TRUE, then enable the privilege otherwise disable.
// 如果为True 就是打开相应权限,如果为False 则是关闭相应权限

CurrentThread [In] If TRUE, then enable in calling thread, otherwise process.
// 如果为True 则仅提升当前线程权限,否则提升整个进程的权限

Enabled [Out] Whether privilege was previously enabled or disabled.
// 输出原来相应权限的状态(打开 | 关闭)

用法很简单:

#define SE_DEBUG_PRIVILEGE 0x14 //DEBUG 权限
int s;
RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE,true,false,&s); 

相关文章:

  • 2021-08-09
  • 2022-02-12
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2021-04-25
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2022-02-14
  • 2021-08-12
  • 2022-12-23
  • 2021-12-16
  • 2022-01-21
相关资源
相似解决方案