security descriptor的一般概念我会一点,但是现在我需要完成一个具体的任务:在CreateProcess函数的参数中设置安全选项,要求是让系统中只有该进程的创建者(也就是CreateProcess函数的调用进程)才能完全访问到这个被新创建的进程对象,而假如同一个机器上任意其他第三个用户进程试图使用诸如WriteProcessMemory之类的函数来改写被创建的进程对象的内存区域的时候,会因为权限不够而失败。
这个要求能做到么?谁能给出一个能完成这个要求的例程么?

解决方案 »

  1.   

    Writing to a process address space is controlled by the SecurityDescrptor 
    of the Process Object and by the SeDebug privilege. 
    By default, you can always debug your own precesses, 
    and, the Administrators are granted the SeDebug privilege. 
    Protecting memory inspection from a debugger is pretty much a lost cause 
    (unless you can leverage natural security-principal restrictions). 
    A determined person can always read the physical page from 
    a driver/kernel-debugger. If you want to run a process under user account, but protected from other 
    processes of the same user, you need to make sure the process owner (in its 
    ACL) is something privileged (LOCAL_SYSTEM, LOCAL_SERVICE). A service should 
    start a process with an user token, but with a security descriptor which 
    disallows most access. SeDebugPrivilege can easily override any DACL if the person has the 
    privilege enabled on their account
      

  2.   

    jiangsheng(蒋晟.Net[MVP]) :
            蒋先生看来是security descriptor的专家,您贴的这段文字是别人的文章中摘录下来的,还是您本人的大作?如果是摘录的话,提供原文或者原文链接给我吧。即使我看了原文,恐怕还有好多问题要请教蒋先生
      

  3.   

    对于能够读写物理内存的工具来说,security descriptor提供的内存保护固然是太轻量级了,不过一般人写的小工具到不了这个深度,我也就指望能够暂时对付对付使用WriteProcessMemory函数的那些小毛贼,呵呵
      

  4.   

    蒋先生不如直接写一个接近我的需求的security descriptor初始化例程,我用本坛的搜索已经拜读先生写给另外一个人的一个security descriptor初始化例程,不过很可惜,那个历程似乎是初始化了一个权限完全空的security descriptor,因此作用是禁止任何人访问一个内核对象,可能对于我这个需求来说太严格了,呵呵,我看了那个历程不能完全找到思路,谢谢赐教
      

  5.   

    能不能用VirtualProtect改变保护属性?
    猜的/
      

  6.   

    默认的权限设置可以在http://www.microsoft.com/technet/security/prodtech/windows2000/w2kccscg/w2kscgcc.mspx
    找到
    由于权限是基于用户策略的,所以同一用户创建的进程默认具有同样的权限。进程级别的保护可以通过以不同身份执行进程,以及设置进程的用户访问控制列表来做到。
    参见
    http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.kernel/2004-06/0708.html
      

  7.   

    在用AdjustTokenPrivileges启用了TOKEN_ADJUST_PRIVILEGES权限之后可以用SetKernelObjectSecurity设置进程的访问权限
    参考http://blog.csdn.net/jiangsheng/archive/2004/06/24/25563.aspx