understanding policy tattooing

4
Understanding Policy "Tattooing" By Darren Mar-Elia on Tuesday, June 10, 2008 10:18 PM You've probably heard of registry tattooing as it relates to NT 4 system policy. Tattooing was the effect that you saw whenever you applied a registry policy to a computer or user and then removed that policy file. Even though the policy file was gone, those registry values that were set by the policy remained--tattooed into the registry until you explicitly removed them, either by setti ng the policy to the opposite value or manually going in and deleting the registry values. This wasn't very helpful when managing systems or users that changed roles. As a result, when Microsoft introduced Group Policy in Win2K, they sought to change this tattooing behavior, at least for registry values. NT 4 System Policy became Administrative Templates in Win2K, XP and Win200 3 Group Policy and with i t came a new capability to prevent registry tattooing. Policies & Preferences Basically, how Group Policy prevents registry tattooing is fairly simple. Microsoft has allocated 4 registry keys--2 under HKEY_LOCAL_MACHI NE and 2 under HKEY_CURRENT_USER which are considered "no-tattooing zones". Any registry values placed under one of these 4 keys will be removed when the policy no longer applies. These 4 keys are: HKEY_LOCAL_MACHINE\Software\Policies HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies HKEY_CURRENT_USER\Software\Policies HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies Most of the Admin. Template policies that you get out-of-the-box in Windows fall under one of these 4 keys. Microsoft has ensured that any applications that are part of Windows or built by Microsoft (e.g. Office) will look into one of these 4 keys to determine their behavior. So if you want to hide the Run command from a user's start menu, Explorer will l ook for a value called "NoRun" under HKCU\Software\Microsoft\Windows\Curren tVersion\Policies\Explorer , and if it finds it, and it's set to 1, the Run command will be hidden from the Start Menu. Registry values that fall under one of these above 4 keys are called, what else, Policies. Registry values that are controlled by Group Policy but do not fall under one of these 4 keys are called Preferences. Preferences don't benefit from the "no- tattooing zone" and thus if you set a preference within a GPO, and then remove that GPO, the preferences are not removed, just as in NT 4. Preferences are common when you create your own, custom ADM files, since in those cases you often have to set registry values that don't fall within these 4 "special" keys. Most irritatingly, by default the GPO Editor won't show you preferences, only policies. You can change this behavior by changing the view Filter on the GPO editor, as shown in the following figure. You need to un-check the box that says, "Only Show Policy Settings that can be Fully Managed", which is another way of saying only show Policies, not Preferences.

Upload: kiran312

Post on 06-Apr-2018

230 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Understanding Policy Tattooing

8/3/2019 Understanding Policy Tattooing

http://slidepdf.com/reader/full/understanding-policy-tattooing 1/4

Understanding Policy "Tattooing"

By Darren Mar-Elia on Tuesday, June 10, 2008 10:18 PM

You've probably heard of registry tattooing as it relates to NT 4 system policy. Tattooingwas the effect that you saw whenever you applied a registry policy to a computer or user and thenremoved that policy file. Even though the policy file was gone, those registry values that were set bythe policy remained--tattooed into the registry until you explicitly removed them, either by setting the

policy to the opposite value or manually going in and deleting the registry values. This wasn't veryhelpful when managing systems or users that changed roles. As a result, when Microsoft introducedGroup Policy in Win2K, they sought to change this tattooing behavior, at least for registry values. NT 4System Policy became Administrative Templates in Win2K, XP and Win2003 Group Policy and with itcame a new capability to prevent registry tattooing.

Policies & Preferences

Basically, how Group Policy prevents registry tattooing is fairly simple. Microsoft has allocated 4registry keys--2 under HKEY_LOCAL_MACHINE and 2 under HKEY_CURRENT_USER which are

considered "no-tattooing zones". Any registry values placed under one of these 4 keys will be removedwhen the policy no longer applies. These 4 keys are:

HKEY_LOCAL_MACHINE\Software\Policies

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies

HKEY_CURRENT_USER\Software\Policies

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies

Most of the Admin. Template policies that you get out-of-the-box in Windows fall under one of these 4keys. Microsoft has ensured that any applications that are part of Windows or built by Microsoft (e.g.Office) will look into one of these 4 keys to determine their behavior. So if you want to hide the Runcommand from a user's start menu, Explorer will look for a value called "NoRun" underHKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer, and if it finds it, and it's set to 1,the Run command will be hidden from the Start Menu. Registry values that fall under one of these

above 4 keys are called, what else, Policies. Registry values that are controlled by Group Policy but donot fall under one of these 4 keys are called Preferences. Preferences don't benefit from the "no-

tattooing zone" and thus if you set a preference within a GPO, and then remove that GPO, thepreferences are not removed, just as in NT 4. Preferences are common when you create your own,custom ADM files, since in those cases you often have to set registry values that don't fall within these4 "special" keys. Most irritatingly, by default the GPO Editor won't show you preferences, only policies.You can change this behavior by changing the view Filter on the GPO editor, as shown in the followingfigure. You need to un-check the box that says, "Only Show Policy Settings that can be FullyManaged", which is another way of saying only show Policies, not Preferences.

Page 2: Understanding Policy Tattooing

8/3/2019 Understanding Policy Tattooing

http://slidepdf.com/reader/full/understanding-policy-tattooing 2/4

 

How It Works Under the Covers

You might wonder how this all works--how Windows manages to "un-tattoo" these policies when theGPO no longer applies. Well, the mechanism is quite simple really. Each time a foreground or

background (see my whitepaper for a description of foreground and background processing) policyprocessing cycle kicks off, if Admin. Template policy is meant to be applied (that is, if the GPO haschanged since the last time it was processed), the first thing that Windows does is remove all registryvalues under our 4 magic keys. This is known as a ResetPolicies operation. You can see this behavior if you enable verbose userenv logging, as shown in the screenshot below:

Page 3: Understanding Policy Tattooing

8/3/2019 Understanding Policy Tattooing

http://slidepdf.com/reader/full/understanding-policy-tattooing 3/4

 

Once all registry values under these 4 keys are removed, policy processing occurs normally. If anyGPOs containing policies were removed since the last processing cycle, they won't exist anymore,since they were all removed by the Reset Policies operation. In this way, Windows guarantees that

policies don't tattoo the registry. A brute force but effective mechanism for cleaning things up thataren't used anymore.

Other Kinds of Tattooing

Registry policy is not the only area in Group Policy that is subject to tattooing. Basically any policyarea that does not have an option to explicitly remove itself if the GPO falls out of scope of thecomputer or user will leave a trail behind. Some obvious ones that come to mind include registry, filesystem and restricted groups security policy. These policy areas aren't undone if the GPO no longerapplies. In the case of registry and file system security, permissions are changed only when the GPOis applied, but since there is no easy "rollback" of file system or registry security, these permissionschanges linger after the policy is removed. Similarly restricted groups policy may be removed but theusers are not removed from the groups they've been added to. However, subsequent changes togroup membership will not be restricted since the policy no longer applies.

Page 4: Understanding Policy Tattooing

8/3/2019 Understanding Policy Tattooing

http://slidepdf.com/reader/full/understanding-policy-tattooing 4/4

 Similarly, Software Installation and Folder Redirection policy can be tricky in terms of its tattooingeffect. Both have options to "un-do" things that were done, like uninstalling software when themachine or user falls out of scope or redirecting My Documents back to the local user profile in thecase of Folder Redirection policy. However, in both cases this mechanism has proven problematic foradministrators and users alike. So, its important to never un-do one of these kinds of policies lightlywithout a good plan in place for dealing with the fallout.