Software Restriction Policy is deprecated by Microsoft (technet effectively claiming SRP is not supported), since Windows 7 Enterprise/Ultimate introduced AppLocker.
In practice SRP has certain pitfalls, for both false negatives and false positives. AppLocker has the advantage that it's still being actively maintained and supported. If AppLocker is an option then it could be the cheaper one - after accounting for your time and risks taken. It's also possible there's a suitable third-party alternative (but this question didn't include that option :).
Hopefully you'd gain perfect understanding of SRP's pitfalls before you fall into any of them
</sarcasm>. Some of them are described in a nice security article from Vadims Podāns.
By default, execution from the
\Windows folder is permitted. Some sub-folders can be written to by users. Applocker is the same, but at least official documentation mentions this limitation.
EDIT: "To enumerate all folders with users write access you can use, for example, AccessEnum utility from Sysinternals pack." (or AccessChk).
Technically the documentation also cautions you against overriding the default rules. EDIT: An NSA document gives 16 examples of folders to blacklist with SRP, and warns about a common over-broad blacklist entry.
The obvious question is why aren't we carefully whitelisting individual paths under
\Windows instead. (Including the
System32\*.exe, etc). I didn't notice any answers to this anywhere :(.
Using environment variables like
%systemroot%, SRP can be bypassed by users by clearing the environment variable. EDIT: These are not used in the suggested defaults. However they may be tempting to use. This footgun is fixed in AppLocker, because it never looks at environment variables.
- Using the more secure "registry paths", there are reports of false denials in random situations, which could easily be missed in testing. And so you end up hard-coding drive letters - apparently as an addition to the original whitelist. E.g. see comments on SpiceWorks SRP howto. I have no explanations on how this interacts with #1; for all I know you will need 2x as many rules for full security.
- The suggested defaults neglect to allow for the two different
\Program Files used on modern 64-bit installs.
- The default extensions neglect to forbid PowerShell scripts (*.PS1) supported by Windows. (See video). And APPX too... also according to Microsoft's comparison table, SRP can't manage "Packaged apps" in Windows 8, I have no idea what this means.
- Of the sources I found for SRP, none put the full list above together for you. And I only discovered Vadims Podāns' article by accident. What else is lurking out there?
- Many sources recommend simply removing LNK files from the list. (And Web Shortcuts to avoid breaking Favourites?!). Disturbingly, no sources seem to discuss LNK vulnerabilities... or getting script interpreters to run files with an unexpected extension e.g.
wscript /e... or maybe stuffing enough shellcode in an inline script parameter... etc.
- If you try to compromise by allowing LNK files on the desktop, and you leave users with write access to the desktop, they can now bypass your policy entirely. Lovely tip from Vadims Podāns again. Note that the explanation applies to using any extension in a path rule. Microsoft present multiple examples of this including
*.Extension, with no warning. So you can't trust the official documentation, and it seems unlikely to get fixed now.
- [Potential AppLocker disadvantage]. Vadims Podāns reports that SRP entries using mapped drives do not work. The UNC path must be used instead. Maybe they would then apply to access through a mapped drive? it's not 100% clear. Apparently AppLocker was different: it didn't work with either :(. "Due to unknown reason, UNC paths doesn’t work in Applocker! This means that if your application is installed in network, you have to create either hash or publisher rules."
Software whitelisting is potentially a very powerful defense. If we get cynical: this is exactly why Microsoft deprecates the lower-priced versions and invents more complex ones.
Maybe no other option is available (include 3rd-party solutions). Then a pragmatic approach would be to try configuring SRP as simply as possible. Treat it as an extra layer of defense, with known holes. Matching the pitfalls above:
- Start from the default rules (from the pre-Win7 era :).
- Prefer to not use environment variables, e.g.
- Add a second copy of each rule, such that 1 uses the "registry paths" to represent
\Program Files\ etc, and 1 uses hard-coded paths.
- Add rules to make sure both
\Program Files\ directories are permitted on modern 64-bit machines. The extra "registry path" you will need to add for
\Program Files\ on 64-bit computers is
- Add PS1 to the list of controlled extensions.
- Understand that a manageable SRP configuration is not secure against a user determined to defeat it. The aim is to help/encourage users to work within the policy, to protect them against attacks like "drive-by downloads".
- Allow LNK files. (Preferably by removing it from the extensions list, not through some path rule).
- See above :).
- Make sure your logon script folder is permitted. The NSA document suggests adding
\\%USERDNSDOMAIN%\Sysvol\. (See point #1, sigh, then see point #6).