Mandatory Profiles – Insecure by Default?

by Helge Klein on 12/13/2010 | 10 Comments | 3,243 Views

Mandatory profiles are generally considered fast and secure because they usually are small in size and cannot be modified by the user. While that is true – mandatory profiles stay pristine indefinitely – there is more to security than read-only access.

Mandatory profiles (MP) are a variant of roaming profiles: a master copy on a file server is copied to the RDS session host during logon. The resulting local copy is secured with file system ACLs that grant full access to the user, but no one else (plus administrators and SYSTEM). All is safe and secure – except in the case of mandatory profiles.
A user profile consists not only of file system data, but also of a registry hive (stored in the file NTUSER.MAN) that is mounted to HKU\<SID> and accessible from within a session via the well-known name HKCU. In contrast to the file system, registry permissions are not changed during logon because that is not necessary – at least with roaming profiles where the master copy of each hive already has the correct permissions.
Not so with mandatory profiles. As per the KB article How to customize default user profiles in Windows 7 (and older similar articles) the creation of a mandatory profile involves changing registry permissions on the master copy to full access for “Everyone”. Since many users are logged on simultaneously to an RDS session host, each server’s registry is comprised of many users’ hives that are read- and writeable by anyone, not just the owner of the individual user profile as it should be.
So on a RDS session host where mandatory profiles are used, a user can simply open Regedit, navigate to HKU\<Some other user’s SID> and read/write at will.

Consequences

Users being able to read/write somebody else’s HKCU hive poses a potentially grave security problem. At least two types of attacks can be envisioned: eavesdropping and damaging. Here are some simple examples:

  • Many applications store a list of most recently used (MRU) files in HKCU (e.g. Microsoft Word: HKCU\Software\Microsoft\Office\12.0\Word\File MRU). By reading such lists, attackers can gain information on which documents another user is editing.
  • Applications and the operating system itself need and expect write access to HKCUy. Since a user always has write access to HKCU, programs do not handle the absence of such permissions well. By changing permissions on another user’s hive an attacker could effectively break the other guy’s session.

How to Fix

The following workarounds can help fix this security vulnerability:

  1. Do not use mandatory profiles on multi-user systems. On single-user systems make sure that remote registry editing is limited to administrators.
  2. Block access to the registry via software restriction policies. This includes, but is not limited to, Regedit.exe, Cmd.exe, Reg.exe, scripts and batch files, custom (downloaded) tools. In essence, in order to fix this problem exclusive white-listing is required.
  3. Re-ACL each registry hive after it is loaded and replace “Everyone” with the current user.

About This Article

I originally wrote this text for the Windows Server 2008 R2 Remote Desktop Services Resource Kit by Christa Anderson and Kristin L. Griffin.

+++ Profile Migrator 2 - Ein neuer Desktop, ein frisches Benutzerprofile und alle bewährten Einstellungen und Daten. Jetzt kostenlos und unbefristet testen!

10 responses for "Mandatory Profiles – Insecure by Default?"

Good point although the risk

Good point although the risk will be a little less if you consider that usually starting regedit is denied for users. Unless the user is smart enough to use my patched regedit (http://www.remkoweijnen.nl/blog/2008/08/12/registry-editing-has-been-dis...) or an alternative registry editor...

OK, Great point! This truly

OK, Great point!

This truly was the last nail in my preference for mandatory profiles.
Up until now I was upset that CUPM left mandatory profiles but now I think I'll swallow the pill and have each user have his own profile... sigh... I hope I won't miss the consistently blazing performance of MAN...

Actually the security problem

Actually the security problem described here was one of several reasons to move from mandatory to local in Citrix Profile Management.

Hi Helge, yeah I figured

Hi Helge,

yeah I figured that from reading your post, thanks for the confirmation.
Maybe you can help me close the "thought gap" on this subject further - For me, the main issue of concern in moving away from mandatory is that instead of having a single master copy of the profile to 1. have it copied for each new user and 2. To maybe have the user bloat their profiles as time goes by and even introduce problems (such as defective printer data, app settings, etc.). What is your take on those matters?

Hi Ron, let's try to get MP

Hi Ron,

let's try to get MP out of your head ;-)

1) With Citrix Profile Management you can use a template profile which is used as a basis for new user profiles. You can customize the template to your liking.
2) With MPs you effectively need a profile management product or else the MP can only be used on kiosk and similar systems. Once a profile management product is in place, the possibililty of profile bloat is given. I know there are products like Flex that only include what you tell them to in the synchronization process. But that has the big disadvantage of having to configure the product for every application you install or upgrade to.

One thing you cannot easily do with Citrix Profile Management is distribute new links (or make other small changes) by simply adding them to the MP's desktop. As an alternative I recommend Group Policy Preferences or an ESD product if already in place. If you have a custom script-based solution, that is fine, too.

I hope this helps. Of course there are many other pros and cons I do not have time and room to list in detail here.

@Remko - There are a lot of

@Remko - There are a lot of different ways to access the registry other than regedit you know...

I think you put too much

I think you put too much stock in Microsofts documentation. You do not have to use the "Everyone" group. You can use an alternate group allowing only those users access to the MP. This will reduce, not elimnate, the risk you brought up.

You still need to give all

You still need to give all those users full control that use the mandatory profile. On terminal servers, that is every user allowed to log on.

No matter how - still each user on a terminal server can mess with the profiles of the coworkers sharing the same machine with him.

Helge, why can't or why

Helge, why can't or why doesn't Windows re-ACL the downloaded NTUSER.MAN file before mounting it at HKU\ ?
That is, why doesn't the local machine do you fix #3 ?

I guess nobody at Microsoft

I guess nobody at Microsoft thinks the topic is important enough to warrant spending developer time on it.