Skip to content

Commit

Permalink
U/sgriffin/sid (#811)
Browse files Browse the repository at this point in the history
* Simplify fuzzing

* make fuzzing faster

* Ensure artifacts dir exists as part of setup

* fix test instance name

* Clean up ace output to better match struct

* Fix SmartViewAddInTest1

* Isolate SD parsers

* index on u/sgriffin/sid: 9bbd863 Fix SmartViewAddInTest1

* Split NTSD parsing from SD parsing and add test cases.

* save changes

* stub in ntsd to pass test cases (still todo conversion), finish sdbin, sidBin, aclBin

* land ntsd parser - all tests green

* simplify ntsd, add test case

* reimplement NTSDToString with smartview

* Remove dead code

* Remove dead code

* remove dead code

* remove dead code

* fix clang violations
  • Loading branch information
stephenegriffin authored Jan 16, 2025
1 parent 270e12c commit 4908661
Show file tree
Hide file tree
Showing 60 changed files with 1,463 additions and 547 deletions.
5 changes: 2 additions & 3 deletions UI/MySecInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,8 @@ namespace mapi::mapiui
}

// Dump our SD
auto sd = SDToString(std::vector<BYTE>(lpSDBuffer, lpSDBuffer + cbSBBuffer), m_acetype);
output::DebugPrint(
output::dbgLevel::Generic, L"sdInfo: %ws\nszDACL: %ws\n", sd.info.c_str(), sd.dacl.c_str());
auto sd = NTSDToString(std::vector<BYTE>(lpSDBuffer, lpSDBuffer + cbSBBuffer), m_acetype);
output::DebugPrint(output::dbgLevel::Generic, L"sd: %ws", sd.c_str());
}
}

Expand Down
1 change: 1 addition & 0 deletions UnitTest/SmartViewTestData/In/ACECONTAINER-1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
00092400a9081200010500000000000515000000371a6c07352f372aad20fa5b01930100
4 changes: 4 additions & 0 deletions UnitTest/SmartViewTestData/In/ACEFB-1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
06 1f 3800 03000000 ffffffff
0A0D0200-0000-0000-C000-000000000046
C02EBC53-53D9-CD11-9752-00AA004AE40E
01 01 000000000005 0B000000
4 changes: 4 additions & 0 deletions UnitTest/SmartViewTestData/In/ACEMESSAGE-1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
05 1f 3800 a9081200 ffffffff
0A0D0200-0000-0000-C000-000000000046
C02EBC53-53D9-CD11-9752-00AA004AE40E
FF 01 000000000005 0B000000
1 change: 1 addition & 0 deletions UnitTest/SmartViewTestData/In/ACEMESSAGE-2.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
01 09 1400 a9081200 01 01 000000000005 0B000000
7 changes: 7 additions & 0 deletions UnitTest/SmartViewTestData/In/ACL-1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
0200E000 0600 0000
00 09 2400 A9081200 010500000000000515000000371A6C07352F372AAD20FA5B01930100
01 09 2400 16071F00 010500000000000515000000371A6C07352F372AAD20FA5B01930100
01 09 2400 BF0F1F00 010500000000000515000000271A6C07352F372AAD20FA5BAA830B00
00 02 2400 A9081200 010500000000000515000000371A6C07352F372AAD20FA5B01930100
01 02 2400 16C90D00 010500000000000515000000371A6C07352F372AAD20FA5B01930100
01 02 2400 BFC91F00 010500000000000515000000271A6C07352F372AAD20FA5BAA830B00
27 changes: 27 additions & 0 deletions UnitTest/SmartViewTestData/In/NTSD-1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
0800
0300
00000000

01
00
0780
F4000000
00010000
00000000
14000000

02
00
E000
0600
0000
00092400A9081200010500000000000515000000371A6C07352F372AAD20FA5B01930100
0109240016071F00010500000000000515000000371A6C07352F372AAD20FA5B01930100
01092400BF0F1F00010500000000000515000000271A6C07352F372AAD20FA5BAA830B00
00022400A9081200010500000000000515000000371A6C07352F372AAD20FA5B01930100
0102240016C90D00010500000000000515000000371A6C07352F372AAD20FA5B01930100
01022400BFC91F00010500000000000515000000271A6C07352F372AAD20FA5BAA830B00

010100000000000512000000

01020000000000052000000020020000
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions UnitTest/SmartViewTestData/In/NTSD-5.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0A00B07ABB6079AB2082C760
15 changes: 14 additions & 1 deletion UnitTest/SmartViewTestData/In/SECURITYDESCRIPTOR-1.dat
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
080003000000000001000780F40000000001000000000000140000000200E0000600000000092400A9081200010500000000000515000000371A6C07352F372AAD20FA5B019301000109240016071F00010500000000000515000000371A6C07352F372AAD20FA5B0193010001092400BF0F1F00010500000000000515000000271A6C07352F372AAD20FA5BAA830B0000022400A9081200010500000000000515000000371A6C07352F372AAD20FA5B019301000102240016C90D00010500000000000515000000371A6C07352F372AAD20FA5B0193010001022400BFC91F00010500000000000515000000271A6C07352F372AAD20FA5BAA830B0001010000000000051200000001020000000000052000000020020000
01000780
F4000000
00010000
00000000
14000000
0200E000 0600 0000
00 09 2400 A9081200 010500000000000515000000371A6C07352F372AAD20FA5B01930100
01 09 2400 16071F00 010500000000000515000000371A6C07352F372AAD20FA5B01930100
01 09 2400 BF0F1F00 010500000000000515000000271A6C07352F372AAD20FA5BAA830B00
00 02 2400 A9081200 010500000000000515000000371A6C07352F372AAD20FA5B01930100
01 02 2400 16C90D00 010500000000000515000000371A6C07352F372AAD20FA5B01930100
01 02 2400 BFC91F00 010500000000000515000000271A6C07352F372AAD20FA5BAA830B00
010100000000000512000000
01020000000000052000000020020000
1 change: 1 addition & 0 deletions UnitTest/SmartViewTestData/In/SID-6.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FF 01 000000000005 0B000000
1 change: 1 addition & 0 deletions UnitTest/SmartViewTestData/In/SID-7.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
010500000000000515000000A065CF7E784B9B5FE77C8770E7871F00123456
16 changes: 16 additions & 0 deletions UnitTest/SmartViewTestData/Out/ACECONTAINER-out-1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ACE
Type: 0x00 = ACCESS_ALLOWED_ACE_TYPE
Flags: 0x09 = OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE
Size: 0x0024
Mask: 0x001208A9 = fsdrightListContents | fsdrightReadProperty | fsdrightExecute | fsdrightReadAttributes | fsdrightViewItem | fsdrightReadControl | fsdrightSynchronize
SID
User: (no domain)\(no name)
Textual SID: S-1-5-21-124525111-708259637-1543119021-103169
Revision: 0x01
SubAuthorityCount: 0x05
IdentifierAuthority: SECURITY_NT_AUTHORITY
SubAuthority[0]: 21 = 0x00000015
SubAuthority[1]: 124525111 = 0x076C1A37
SubAuthority[2]: 708259637 = 0x2A372F35
SubAuthority[3]: 1543119021 = 0x5BFA20AD
SubAuthority[4]: 103169 = 0x00019301
15 changes: 15 additions & 0 deletions UnitTest/SmartViewTestData/Out/ACEFB-out-1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ACE
Type: 0x06 = ACCESS_DENIED_OBJECT_ACE_TYPE
Flags: 0x1F = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | NO_PROPAGATE_INHERIT_ACE | INHERIT_ONLY_ACE | INHERITED_ACE
Size: 0x0038
Mask: 0x00000003 = fsdrightFreeBusySimple | fsdrightFreeBusyDetailed
Flags: 0xFFFFFFFF
ObjectType: {00020D0A-0000-0000-C000-000000000046} = IID_CAPONE_PROF
InheritedObjectType: {53BC2EC0-D953-11CD-9752-00AA004AE40E} = GUID_Dilkie
SID
User: NT AUTHORITY\Authenticated Users
Textual SID: S-1-5-11
Revision: 0x01
SubAuthorityCount: 0x01
IdentifierAuthority: SECURITY_NT_AUTHORITY
SubAuthority[0]: 11 = 0x0000000B
15 changes: 15 additions & 0 deletions UnitTest/SmartViewTestData/Out/ACEMESSAGE-out-1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ACE
Type: 0x05 = ACCESS_ALLOWED_OBJECT_ACE_TYPE
Flags: 0x1F = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | NO_PROPAGATE_INHERIT_ACE | INHERIT_ONLY_ACE | INHERITED_ACE
Size: 0x0038
Mask: 0x001208A9 = fsdrightReadBody | fsdrightReadProperty | fsdrightExecute | fsdrightReadAttributes | fsdrightViewItem | fsdrightReadControl | fsdrightSynchronize
Flags: 0xFFFFFFFF
ObjectType: {00020D0A-0000-0000-C000-000000000046} = IID_CAPONE_PROF
InheritedObjectType: {53BC2EC0-D953-11CD-9752-00AA004AE40E} = GUID_Dilkie
SID
User: (no domain)\(no name)
Textual SID: S-255-5-11
Revision: 0xFF
SubAuthorityCount: 0x01
IdentifierAuthority: SECURITY_NT_AUTHORITY
SubAuthority[0]: 11 = 0x0000000B
12 changes: 12 additions & 0 deletions UnitTest/SmartViewTestData/Out/ACEMESSAGE-out-2.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ACE
Type: 0x01 = ACCESS_DENIED_ACE_TYPE
Flags: 0x09 = OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE
Size: 0x0014
Mask: 0x001208A9 = fsdrightReadBody | fsdrightReadProperty | fsdrightExecute | fsdrightReadAttributes | fsdrightViewItem | fsdrightReadControl | fsdrightSynchronize
SID
User: NT AUTHORITY\Authenticated Users
Textual SID: S-1-5-11
Revision: 0x01
SubAuthorityCount: 0x01
IdentifierAuthority: SECURITY_NT_AUTHORITY
SubAuthority[0]: 11 = 0x0000000B
102 changes: 102 additions & 0 deletions UnitTest/SmartViewTestData/Out/ACL-out-1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
ACL
Revision: 0x02
Sbz1: 0x00
AclSize: 0x00E0
AceCount: 0x0006
Sbz2: 0x0000
ACE
Type: 0x00 = ACCESS_ALLOWED_ACE_TYPE
Flags: 0x09 = OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE
Size: 0x0024
Mask: 0x001208A9 = fsdrightReadBody | fsdrightReadProperty | fsdrightExecute | fsdrightReadAttributes | fsdrightViewItem | fsdrightReadControl | fsdrightSynchronize
SID
User: (no domain)\(no name)
Textual SID: S-1-5-21-124525111-708259637-1543119021-103169
Revision: 0x01
SubAuthorityCount: 0x05
IdentifierAuthority: SECURITY_NT_AUTHORITY
SubAuthority[0]: 21 = 0x00000015
SubAuthority[1]: 124525111 = 0x076C1A37
SubAuthority[2]: 708259637 = 0x2A372F35
SubAuthority[3]: 1543119021 = 0x5BFA20AD
SubAuthority[4]: 103169 = 0x00019301
ACE
Type: 0x01 = ACCESS_DENIED_ACE_TYPE
Flags: 0x09 = OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE
Size: 0x0024
Mask: 0x001F0716 = fsdrightWriteBody | fsdrightAppendMsg | fsdrightWriteProperty | fsdrightWriteAttributes | fsdrightWriteOwnProperty | fsdrightDeleteOwnItem | fsdrightWriteSD | fsdrightDelete | fsdrightWriteOwner | fsdrightReadControl | fsdrightSynchronize
SID
User: (no domain)\(no name)
Textual SID: S-1-5-21-124525111-708259637-1543119021-103169
Revision: 0x01
SubAuthorityCount: 0x05
IdentifierAuthority: SECURITY_NT_AUTHORITY
SubAuthority[0]: 21 = 0x00000015
SubAuthority[1]: 124525111 = 0x076C1A37
SubAuthority[2]: 708259637 = 0x2A372F35
SubAuthority[3]: 1543119021 = 0x5BFA20AD
SubAuthority[4]: 103169 = 0x00019301
ACE
Type: 0x01 = ACCESS_DENIED_ACE_TYPE
Flags: 0x09 = OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE
Size: 0x0024
Mask: 0x001F0FBF = fsdrightReadBody | fsdrightWriteBody | fsdrightAppendMsg | fsdrightReadProperty | fsdrightWriteProperty | fsdrightExecute | fsdrightReadAttributes | fsdrightWriteAttributes | fsdrightWriteOwnProperty | fsdrightDeleteOwnItem | fsdrightViewItem | fsdrightWriteSD | fsdrightDelete | fsdrightWriteOwner | fsdrightReadControl | fsdrightSynchronize
SID
User: (no domain)\(no name)
Textual SID: S-1-5-21-124525095-708259637-1543119021-754602
Revision: 0x01
SubAuthorityCount: 0x05
IdentifierAuthority: SECURITY_NT_AUTHORITY
SubAuthority[0]: 21 = 0x00000015
SubAuthority[1]: 124525095 = 0x076C1A27
SubAuthority[2]: 708259637 = 0x2A372F35
SubAuthority[3]: 1543119021 = 0x5BFA20AD
SubAuthority[4]: 754602 = 0x000B83AA
ACE
Type: 0x00 = ACCESS_ALLOWED_ACE_TYPE
Flags: 0x02 = CONTAINER_INHERIT_ACE
Size: 0x0024
Mask: 0x001208A9 = fsdrightReadBody | fsdrightReadProperty | fsdrightExecute | fsdrightReadAttributes | fsdrightViewItem | fsdrightReadControl | fsdrightSynchronize
SID
User: (no domain)\(no name)
Textual SID: S-1-5-21-124525111-708259637-1543119021-103169
Revision: 0x01
SubAuthorityCount: 0x05
IdentifierAuthority: SECURITY_NT_AUTHORITY
SubAuthority[0]: 21 = 0x00000015
SubAuthority[1]: 124525111 = 0x076C1A37
SubAuthority[2]: 708259637 = 0x2A372F35
SubAuthority[3]: 1543119021 = 0x5BFA20AD
SubAuthority[4]: 103169 = 0x00019301
ACE
Type: 0x01 = ACCESS_DENIED_ACE_TYPE
Flags: 0x02 = CONTAINER_INHERIT_ACE
Size: 0x0024
Mask: 0x000DC916 = fsdrightWriteBody | fsdrightAppendMsg | fsdrightWriteProperty | fsdrightWriteAttributes | fsdrightViewItem | fsdrightWriteSD | fsdrightDelete | fsdrightWriteOwner | 0xC000
SID
User: (no domain)\(no name)
Textual SID: S-1-5-21-124525111-708259637-1543119021-103169
Revision: 0x01
SubAuthorityCount: 0x05
IdentifierAuthority: SECURITY_NT_AUTHORITY
SubAuthority[0]: 21 = 0x00000015
SubAuthority[1]: 124525111 = 0x076C1A37
SubAuthority[2]: 708259637 = 0x2A372F35
SubAuthority[3]: 1543119021 = 0x5BFA20AD
SubAuthority[4]: 103169 = 0x00019301
ACE
Type: 0x01 = ACCESS_DENIED_ACE_TYPE
Flags: 0x02 = CONTAINER_INHERIT_ACE
Size: 0x0024
Mask: 0x001FC9BF = fsdrightReadBody | fsdrightWriteBody | fsdrightAppendMsg | fsdrightReadProperty | fsdrightWriteProperty | fsdrightExecute | fsdrightReadAttributes | fsdrightWriteAttributes | fsdrightViewItem | fsdrightWriteSD | fsdrightDelete | fsdrightWriteOwner | fsdrightReadControl | fsdrightSynchronize | 0xC000
SID
User: (no domain)\(no name)
Textual SID: S-1-5-21-124525095-708259637-1543119021-754602
Revision: 0x01
SubAuthorityCount: 0x05
IdentifierAuthority: SECURITY_NT_AUTHORITY
SubAuthority[0]: 21 = 0x00000015
SubAuthority[1]: 124525095 = 0x076C1A27
SubAuthority[2]: 708259637 = 0x2A372F35
SubAuthority[3]: 1543119021 = 0x5BFA20AD
SubAuthority[4]: 754602 = 0x000B83AA
57 changes: 47 additions & 10 deletions UnitTest/SmartViewTestData/Out/FBSECURITYDESCRIPTOR-out-1.dat
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
Security Descriptor
Security Info
0x0
Security Version: 0x0003 = SECURITY_DESCRIPTOR_TRANSFER_VERSION
Descriptor
Account: \Everyone
SID: S-1-1-0
Access Type: 0x00000000 = ACCESS_ALLOWED_ACE_TYPE
Access Flags: 0x00000002 = CONTAINER_INHERIT_ACE
Access Mask: 0x00000001 = fsdrightFreeBusySimple
PR_NT_SECURITY_DESCRIPTOR
Padding: 0x0008
Version: 0x0003 = SECURITY_DESCRIPTOR_TRANSFER_VERSION
Security Information: 0x00000000 = 0x0
Security Descriptor
Revision: 0x01
Sbz1: 0x00
Control: 0x8004
OffsetOwner: 0x00000014
OffsetGroup: 0x00000020
OffsetSacl: 0x00000000
OffsetDacl: 0x0000002C
OwnerSid
SID
User: NT AUTHORITY\SYSTEM
Textual SID: S-1-5-18
Revision: 0x01
SubAuthorityCount: 0x01
IdentifierAuthority: SECURITY_NT_AUTHORITY
SubAuthority[0]: 18 = 0x00000012
GroupSid
SID
User: NT AUTHORITY\SYSTEM
Textual SID: S-1-5-18
Revision: 0x01
SubAuthorityCount: 0x01
IdentifierAuthority: SECURITY_NT_AUTHORITY
SubAuthority[0]: 18 = 0x00000012
Dacl
ACL
Revision: 0x02
Sbz1: 0x00
AclSize: 0x001C
AceCount: 0x0001
Sbz2: 0x0000
ACE
Type: 0x00 = ACCESS_ALLOWED_ACE_TYPE
Flags: 0x02 = CONTAINER_INHERIT_ACE
Size: 0x0014
Mask: 0x00000001 = fsdrightReadBody
SID
User: \Everyone
Textual SID: S-1-1-0
Revision: 0x01
SubAuthorityCount: 0x01
IdentifierAuthority: SECURITY_WORLD_SID_AUTHORITY
SubAuthority[0]: 0 = 0x00000000
Loading

0 comments on commit 4908661

Please sign in to comment.