Deny-only SIDs not working on a shared drive

Ro Po 21 Reputation points
2021-10-11T11:34:41.113+00:00

Hi,

We are developing the windows executable and need to limit the executable’s access to folders on a shared drive.
We use the CreateRestrictedToken function (SidsToDisable parameter) to deny access to folders for specific groups.
Seems that the deny flag only works on local folders, but does not work on a shared folder.

Here is an example:
The shared folder vm62share has share permissions set to Everyone, full control and security permissions to active directory
group Team-b, full control. This effectively limits access to Users in group Team-b only.

We need to prevent access to a shared folder (vm62share) for the process who’s user is member of group Team-b.
We start the process with a restricted token by using the CreateRestrictedToken function. The
restricted token has a deny flag set on group Team-b. We check the process’s flags using the
Process Explorer:

  • The process has a deny flag set for group Team-b
  • Shared folder only allows access to members of group Team-b
  • The process can still read/write files in shared folder vm62share.
    This is not expected, the process should not have been allowed to read/write
    since it has a a deny flag set for group Team-b and there are no additional
    permissions allowing access.

If we create a local folder and limit access to group Team-b only, then
the deny flag works as expected (the process with the deny flag is not
able to read/write files in the folder).

Looks as if the deny flag does not have any effect on shared folders.

Can you please explain.

Windows 10 Security
Windows 10 Security
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
2,754 questions
0 comments No comments
{count} votes

Accepted answer
  1. Gary Reynolds 9,391 Reputation points
    2021-10-12T16:22:19.637+00:00

    Hi @Ro Po

    This is expected behaviour, the restricted token is only used in the context of the resources that are accessed locally by the process. As soon as you access a resource on a network share, kerberos authentication will be used, and a complete\unrestricted token will be used.

    I haven't try this but might be worth a trying, try accessing the share using the IP address rather than the name, kerberos won't be used and it will default to NTLM and it might pass the current process token instead.

    You might need to look at a different solution, but I not sure why you want to restrict the access of the exe, when the user will have access to the contents of the share anyway. If you could provide a bit more background I'm might be able to suggest an alternative approach.

    Gary.


1 additional answer

Sort by: Most helpful
  1. Limitless Technology 39,351 Reputation points
    2021-10-14T09:24:06.267+00:00

    Hello RoPo-7834,

    Thank you for your question.

    Are these SIDs from the local (target) domain or the source domain? If it is from the source domain, you will need to perform security translation using ADMT to update the SIDs.

    See the article below that deals precisely with a problem similar to yours, I believe it can be useful for you:

    https://social.technet.microsoft.com/Forums/windows/en-US/74ea4e62-5907-45ad-a8b6-7de7d2b92b66/share-permission-got-only-sid-and-not-user-friendly-name? forum=winserverDS

    You can also check out the article below that talks about "Some SIDs don't turn into friendly names":

    https://learn.microsoft.com/en-us/troubleshoot/windows-server/windows-security/sids-not-resolve-into-friendly-names

    ----------------------------------------------------------------------------------------------------------------------

    If the answer is helpful, please vote positively and accept as an answer.

    0 comments No comments