I'm using ConvertStringSecurityDescriptorToSecurityDescriptor to create a security descriptor that I can then use with CreateFile as it is much easier and much more readable.
My intent is for the file to be fully controllable by its owner/creator and readable only by elevated processes.
I thus came up with the following SSDL string:
SSDL :=
'O:'+ SIDAsString + // owner is user
'D:' + // Discretionary ACL
'P' + // protected
'(A;NP;FA;;;' + SIDAsString + ')' + // Full control to owner
// Read only access to administrators
'(A;NP;FR;;;LA)' +
'(A;NP;FR;;;BA)';
SIDAsString contains a valid SID, such as S-1-5-18 for instance.
ConvertStringSecurityDescriptorToSecurityDescriptor returns a valid security descriptor and the file gets created with the rights that I expected.
However, elevated processes (such as an uninstaller for instance) cannot read the file, they get an access denied error.
If the process that tries to read the file is started via the run as administrator option, it receives access as expected.
I tried looking for the elevated user SID, but I could not find any mention of it, which leads me to believe that there is no such thing.
Short of giving read access to everyone, is there a way to specify a SSDL string that gives read access to a process running with elevated privileges?
SE_BACKUP_NAMEpermission for itself and then open the file with theFILE_FLAG_BACKUP_SEMANTICSflag enabled. That might grant the read access you are looking for. - Remy LebeauAdministrators(S-1-5-32-544) but withSE_GROUP_USE_FOR_DENY_ONLYattribute. when process started elevated - he haveAdministrators(S-1-5-32-544) withSE_GROUP_ENABLED- so really exist different with group associations. if we let access only forAdministrators(S-1-5-32-544) - elevated process will be have access but not elevated - no - RbMm(A;NP;FR;;;LA)or may be need(A;NP;FRFX;;;LA)for enable execute access on file too ? - RbMmSE_GROUP_USE_FOR_DENY_ONLYandSE_GROUP_ENABLEDare not users/groups that a security descriptor can refer to. They are simply token attributes that control how SIDs are compared to a security descriptor's ACEs. So you still cannot tailor a security descriptor to grant/reject access based on the elevated status of a user/group using attributes. - Remy Lebeauc:\windowsfolder - elevated user can create/change files in this folder when not elevated can not. becauseAdministratorshave write permission for write, but not elevated user have this SID in token, but it used for Denny only - RbMm