首页
社区
课程
招聘
8
[原创]白话windows之 访问控制模型(Access Control Model)
发表于: 2013-6-10 21:38 18027

[原创]白话windows之 访问控制模型(Access Control Model)

2013-6-10 21:38
18027

当一个线程使用Open*打开一个内核对象时,会发生什么?

有两种可能:

1. 打开成功,拿到句柄

2. 打开失败

这不是废话么?!为啥打开失败呢?有两种可能:

1. 当前线程不具有指定的特权

2.  权限不足(由dwDesiredAccess参数指定权限)

这个时候就引入了今天的主题:令牌(包含特权列表)和安全描述符(描述用户权限)。

Token

token是什么?对了,他就是一个令牌。就像原先钦差大臣手里面的上方宝剑一样,上可惩天子,下可斩贪官!所以千万不要小看它哦亲~。那Token中都有些神马东东呢?

先看一下他的数据结构:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
lkd> dt nt!_token
   +0x000 TokenSource      : _TOKEN_SOURCE
   +0x010 TokenId          : _LUID
   +0x018 AuthenticationId : _LUID
   +0x020 ParentTokenId    : _LUID
   +0x028 ExpirationTime   : _LARGE_INTEGER
   +0x030 TokenLock        : Ptr32 _ERESOURCE
   +0x038 AuditPolicy      : _SEP_AUDIT_POLICY
   +0x040 ModifiedId       : _LUID
   [COLOR="Red"]+0x048 SessionId        : Uint4B[/COLOR]
   [COLOR="Red"]+0x04c UserAndGroupCount : Uint4B[/COLOR]
   +0x050 RestrictedSidCount : Uint4B
   [COLOR="Red"]+0x054 PrivilegeCount   : Uint4B[/COLOR]
   +0x058 VariableLength   : Uint4B
   +0x05c DynamicCharged   : Uint4B
   +0x060 DynamicAvailable : Uint4B
   +0x064 DefaultOwnerIndex : Uint4B
   [COLOR="Red"]+0x068 UserAndGroups    : Ptr32 _SID_AND_ATTRIBUTES[/COLOR]
   +0x06c RestrictedSids   : Ptr32 _SID_AND_ATTRIBUTES
   +0x070 PrimaryGroup     : Ptr32 Void
   [COLOR="Red"]+0x074 Privileges       : Ptr32 _LUID_AND_ATTRIBUTES[/COLOR]
   +0x078 DynamicPart      : Ptr32 Uint4B
   [COLOR="Red"]+0x07c DefaultDacl      : Ptr32 _ACL[/COLOR]
   +0x080 TokenType        : _TOKEN_TYPE
   +0x084 ImpersonationLevel : _SECURITY_IMPERSONATION_LEVEL
   +0x088 TokenFlags       : Uint4B
   +0x08c TokenInUse       : UChar
   +0x090 ProxyData        : Ptr32 _SECURITY_TOKEN_PROXY_DATA
   +0x094 AuditData        : Ptr32 _SECURITY_TOKEN_AUDIT_DATA
   +0x098 OriginatingLogonSession : _LUID
   +0x0a0 VariablePart     : Uint4B
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
SeAssignPrimaryTokenPrivilege
SeAuditPrivilege
SeBackupPrivilege
SeChangeNotifyPrivilege
SeCreateGlobalPrivilege
SeCreatePagefilePrivilege
SeCreatePermanentPrivilege
SeCreateSymbolicLinkPrivilege
SeCreateTokenPrivilege
SeDebugPrivilege
SeEnableDelegationPrivilege
SeImpersonatePrivilege
SeIncreaseBasePriorityPrivilege
SeIncreaseQuotaPrivilege
SeIncreaseWorkingSetPrivilege
SeLoadDriverPrivilege
SeLockMemoryPrivilege
SeMachineAccountPrivilege
SeManageVolumePrivilege
SeProfileSingleProcessPrivilege
SeRelabelPrivilege
SeRemoteShutdownPrivilege
SeRestorePrivilege
SeSecurityPrivilege
SeShutdownPrivilege
SeSyncAgentPrivilege
SeSystemEnvironmentPrivilege
SeSystemProfilePrivilege
SeSystemtimePrivilege
SeTakeOwnershipPrivilege
SeTcbPrivilege
SeTimeZonePrivilege
SeTrustedCredManAccessPrivilege
SeUndockPrivilege
SeUnsolicitedInputPrivilege
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
[COLOR="Blue"]lkd> !process 0 1 windbg.exe[/COLOR]
PROCESS 89031da0  SessionId: 0  Cid: 0c68    Peb: 7ffdb000  ParentCid: 0530
    DirBase: 09f602e0  ObjectTable: e1f25ba0  HandleCount:  86.
    Image: windbg.exe
    VadRoot 88c553c0 Vads 87 Clone 0 Private 2296. Modified 3959. Locked 1.
    DeviceMap e20447c8
   [COLOR="Red"] Token                             e108d258[/COLOR]
    ElapsedTime                       02:26:28.813
    UserTime                          00:00:01.171
    KernelTime                        00:00:06.078
    QuotaPoolUsage[PagedPool]         92740
    QuotaPoolUsage[NonPagedPool]      3600
    Working Set Sizes (now,min,max)  (1803, 50, 345) (7212KB, 200KB, 1380KB)
    PeakWorkingSetSize                3848
    VirtualSize                       60 Mb
    PeakVirtualSize                   61 Mb
    PageFaultCount                    7861
    MemoryPriority                    BACKGROUND
    BasePriority                      8
    CommitCharge                      2704
 
[COLOR="Blue"]lkd> !token e108d258[/COLOR]
_TOKEN e108d258
TS Session ID: 0
User: S-1-5-21-2025429265-1682526488-1801674531-1005
Groups:
 00 S-1-5-21-2025429265-1682526488-1801674531-513
    Attributes - Mandatory Default Enabled
 01 S-1-1-0
    Attributes - Mandatory Default Enabled
 02 S-1-5-32-544
    Attributes - Mandatory Default Enabled Owner
 03 S-1-5-32-545
    Attributes - Mandatory Default Enabled
 04 S-1-5-4
    Attributes - Mandatory Default Enabled
 05 S-1-5-11
    Attributes - Mandatory Default Enabled
 06 S-1-5-5-0-5125624
    Attributes - Mandatory Default Enabled LogonId
 07 S-1-2-0
    Attributes - Mandatory Default Enabled
Primary Group: S-1-5-21-2025429265-1682526488-1801674531-513
Privs:
 00 0x000000017 SeChangeNotifyPrivilege           Attributes - Enabled Default
 01 0x000000008 SeSecurityPrivilege               Attributes -
 02 0x000000011 SeBackupPrivilege                 Attributes -
 03 0x000000012 SeRestorePrivilege                Attributes -
 04 0x00000000c SeSystemtimePrivilege             Attributes -
 05 0x000000013 SeShutdownPrivilege               Attributes -
 06 0x000000018 SeRemoteShutdownPrivilege         Attributes -
 07 0x000000009 SeTakeOwnershipPrivilege          Attributes -
 08 0x000000014 SeDebugPrivilege                  Attributes - Enabled
 09 0x000000016 SeSystemEnvironmentPrivilege      Attributes -
 10 0x00000000b SeSystemProfilePrivilege          Attributes -
 11 0x00000000d SeProfileSingleProcessPrivilege   Attributes -
 12 0x00000000e SeIncreaseBasePriorityPrivilege   Attributes -
 13 0x00000000a SeLoadDriverPrivilege             Attributes - Enabled
 14 0x00000000f SeCreatePagefilePrivilege         Attributes -
 15 0x000000005 SeIncreaseQuotaPrivilege          Attributes -
 16 0x000000019 SeUndockPrivilege                 Attributes - Enabled
 17 0x00000001c SeManageVolumePrivilege           Attributes -
 18 0x00000001d SeImpersonatePrivilege            Attributes - Enabled Default
 19 0x00000001e SeCreateGlobalPrivilege           Attributes - Enabled Default
Authentication ID:         (0,4e3f87)
Impersonation Level:       Anonymous
TokenType:                 Primary
Source: User32             TokenFlags: 0x89 ( Token in use )
Token ID: 4f3891           ParentToken ID: 0
Modified ID:               (0, 4ffaa5)
RestrictedSidCount: 0      RestrictedSids: 00000000
1
2
3
4
5
6
7
8
lkd> dt nt!_Security_Descriptor
   +0x000 Revision         : UChar
   +0x001 Sbz1             : UChar
   +0x002 Control          : Uint2B
   +0x004 Owner            : Ptr32 Void
   +0x008 Group            : Ptr32 Void
   +0x00c Sacl             : Ptr32 _ACL
   [COLOR="Red"]+0x010 Dacl             : Ptr32 _ACL[/COLOR]

[招生]科锐逆向工程师培训(2025年3月11日实地,远程教学同时开班, 第52期)!

收藏
免费 8
支持
分享
赞赏记录
参与人
雪币
留言
时间
心游尘世外
为你点赞~
2024-5-31 05:15
QinBeast
为你点赞~
2024-5-31 05:08
飘零丶
为你点赞~
2024-4-3 00:31
shinratensei
为你点赞~
2024-2-10 00:45
伯爵的信仰
为你点赞~
2023-8-7 00:04
.
为你点赞~
2023-7-7 20:04
PLEBFE
为你点赞~
2023-3-7 00:32
shishichen
为你点赞~
2022-8-2 17:45
最新回复 (22)
雪    币: 1140
活跃值: (3426)
能力值: ( LV12,RANK:385 )
在线值:
发帖
回帖
粉丝
2
不错!
windbg命令是亮点.
俺以前是用vs查看变量的.
2013-6-10 22:23
0
雪    币: 541
活跃值: (654)
能力值: ( LV12,RANK:250 )
在线值:
发帖
回帖
粉丝
3
看内核结构,windbg没有对手啊
趁着自己也顶一下
2013-6-11 00:41
0
雪    币: 1233
活跃值: (907)
能力值: ( LV12,RANK:750 )
在线值:
发帖
回帖
粉丝
4
不错的技术文章
2013-6-11 07:56
0
雪    币: 212
活跃值: (231)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
把我的知识好好梳理了下,感谢楼主
2013-6-11 09:04
0
雪    币: 541
活跃值: (654)
能力值: ( LV12,RANK:250 )
在线值:
发帖
回帖
粉丝
6
等着加精啊斑竹,大家对这个主题好像不太感兴趣啊,回复的好少
2013-6-12 10:23
0
雪    币: 371
活跃值: (72)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
7
估计能精...
2013-6-12 10:29
0
雪    币: 541
活跃值: (654)
能力值: ( LV12,RANK:250 )
在线值:
发帖
回帖
粉丝
8
加精了,MAKE一下,第一篇加精的文章
2013-6-13 13:29
0
雪    币: 922
活跃值: (1491)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
9
哥来给你顶顶
2013-6-14 09:47
0
雪    币: 16
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
10
好文章,不错,收藏先
2013-6-14 15:54
0
雪    币: 134
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
11
加入群了 这篇文章值得收藏
2013-6-15 13:17
0
雪    币: 3150
活跃值: (1294)
能力值: ( LV8,RANK:120 )
在线值:
发帖
回帖
粉丝
12
嗯,不错。。
2013-6-16 15:03
0
雪    币: 239
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
13
好东西,mark了
2013-6-16 15:38
0
雪    币: 297
活跃值: (120)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
14
楼主V5,让某某,某某,某某明白鼠标模式调试器在命令驱动的调试器面前到底是个啥地位,啥啥啥IDE集成调试器啥的,就说这么多,免的引起口水仗
2013-6-16 17:38
0
雪    币: 74
活跃值: (1105)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
15
不错 mark~~
2013-6-16 17:52
0
雪    币: 257
活跃值: (67)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
16
不错的文章,顶一下
2013-6-16 18:03
0
雪    币: 535
活跃值: (245)
能力值: ( LV12,RANK:400 )
在线值:
发帖
回帖
粉丝
17
感谢楼主分享, 学习了
2013-6-17 09:36
0
雪    币: 49
活跃值: (19)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
18
群是刚开的么?
光秃秃的 少内部共享资料都没有
也没人讲话
2013-6-17 09:52
0
雪    币: 194
活跃值: (286)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
19
支持,原来多发精品文章才好获得精华。。
2013-6-17 10:14
0
雪    币: 230
活跃值: (106)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
20
不错,挺有收获!
2013-6-17 12:58
0
雪    币: 453
活跃值: (88)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
21
不错,mark一下
2013-6-17 14:09
0
雪    币: 334
活跃值: (92)
能力值: ( LV7,RANK:100 )
在线值:
发帖
回帖
粉丝
22
恩,一直是我想学的东西,感谢楼主的分享,让我明白了一些,楼主大爱啊
2013-6-18 06:59
0
雪    币: 74
活跃值: (918)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
23
讲的不错,感谢分享
2013-6-18 09:46
0
游客
登录 | 注册 方可回帖
返回

账号登录
验证码登录

忘记密码?
没有账号?立即免费注册