Security Id と $Secure
Security IDと$Secureの関係について確認します。
[注意事項]一部は不完全なパース結果となっています。
最初にサンプルファイル(crocodile.jpg)のアクセス権を確認します。
ファイル crocodile.jpg のSecurity IDを確認します。
Security ID 値は $STANDARD_INFORMATION 内に保存されています。
MFTレコードでSecurity IDを確認します。(0C 01 00 00)
NTFS DOC の内容に従い、$Secureの内容をパースしてみます。
$Secure ファイルは、 $SDH, $SDS, $SII から構成されています。それらは、$DATAや$INDEX_ROOT、$INDEX_ALLOCATION、$BITMAP などから構成されています。
11.3.2. $SDH Index
18 00 Offset to data ⇒ 24byte
14 00 Size of data ⇒ 20byte
00 00 00 00 Padding
30 00 Size of Index Entry ⇒ 48byte
08 00 Size of Index Key ⇒ 8byte
00 00 Flags
00 00 Padding
DE E3 3D 9A Key: Hash of Security Descriptor
0C 01 00 00 Key: Security Id
DE E3 3D 9A Data: Hash of Security Descriptor
0C 01 00 00 Data: Security Id
F0 06 00 00 00 00 00 00 Data: Offset to Security Descriptor (in $SDS) ⇒ 1776 byte
80 00 00 00 Data: Size of Security Descriptor (in $SDS) ⇒ 128 byte
00 00 00 00 Data: Padding
11.3.3. $SII Index
14 00 Offset to data ⇒ 20byte
14 00 Size of data ⇒ 20byte
00 00 00 00 Padding
28 00 Size of Index Entry ⇒ 40byte
04 00 Size of Index Key
00 00 Flags
00 00 Padding
0C 01 00 00 Key: Security Id
DE E3 3D 9A Data: Hash of Security Descriptor
0C 01 00 00 Data: Security Id
F0 06 00 00 00 00 00 00 Data: Offset to Security Descriptor (in $SDS) ⇒ 1776 byte
80 00 00 00 Data: Size of Security Descriptor (in $SDS) ⇒ 128 byte
11.3.1. $SDS Data Stream
DE E3 3D 9A Hash of Security Descriptor
0C 01 00 00 Security Id
F0 06 00 00 00 00 00 00 Offset of this entry in this file ⇒ 1776 byte
80 00 00 00 Size of this entry ⇒ 128 byte
$SECURITY_DESCRIPTOR (0x50)
6.3.3. Header
Table 2.9. Layout of the $SECURITY_DESCRIPTOR (0x50) attribute header
01 Revision (a)
00 Padding
04 97 Control Flags (b)
34 00 00 00 Offset to User SID ⇒ 52 byte
50 00 00 00 Offset to Group SID ⇒ 80 byte
00 00 00 00 Offset to SACL ⇒ 0 byte
14 00 00 00 Offset to DACL ⇒ 20 byte
SACL
DACL
02 ACL Revision
00 Padding (0x00)
20 00 ACL size ⇒ 32 byte
01 00 ACE count
00 00 Padding (0x0000)
ACE
00 Type ⇒ Access Allowed
00 Flags
18 00 Size ⇒ 24 byte
FF 01 1F 00 Access mask ⇒ 111110000000111111111 ⇒ Full Control
01 02 00 00 00 00 00 05 20 00 00 00 21 02 00 00 SID ⇒ BUILTIN_USERS S-1-5-32-545
User SID ⇒ S-1-5-21-1901480256-120802936-2790681297-1000
01
05 00 00 00 00 00
05
15 00 00 00 ⇒ 21
40 49 56 71 ⇒ 1901480256
78 4E 33 07 ⇒ 120802936
D1 6A 56 A6 ⇒ 2790681297
E8 03 ⇒ 1000
0000
Group SID
01
05 00 00 00 00 00
05
15 00 00 00
40 49 56 71
78 4E 33 07
D1 6A 56 A6
01 02 ⇒ 513
0000
追記
Zaki さんがSecure2Csvというツールがあると教えてくれました。これはとても便利なツールですね!!
GitHub - jschicht/Secure2Csv: Decode security descriptors in $Secure on NTFS
参考URL:
http://www.ntfs.com/ntfs-permissions-file-structure.htm より引用
2.4.2.4 Well-Known SID Structures
https://msdn.microsoft.com/ja-jp/library/cc980032.aspx