The machine Sid duplication myth (and why sysprep matters)

Source: Internet
Author: User
Tags ntfs permissions

On November 3 2009, sysinternals retired newsid,
A utility that changes a computers Machine Security Identifier(MACHINE Sid). I wrote newsid in 1997 (its original
Name was ntsid) because the only tool available at the time for changing machine SIDS was the Microsoft sysprep tool,
And sysprep doesn't support changing the SIDS of computers that have applications installed. A machine Sid is a unique identifier generated by Windows setup that Windows uses as the basis for the SIDS for administrator-defined local accounts and groups. after
A user logs on to a system, they are represented by their account and group SIDS with respect to object authorization (permissions checks ). if two machines have the same machine Sid, then accounts or groups on those systems might have the same SID. it's therefore
Obvious that having multiple computers with the same machine Sid on a network poses a security risk, right? At least that's been the conventional wisdom.

The reason that I began considering newsid for retirement is that, although people generally reported success with it on Windows Vista, I hadn't fully tested it myself and I got occasional reports that some windows component wowould fail after newsid was used.
When I set out to look into the reports I took a step back to understand how duplicate SIDS cocould cause problems, a belief that I had taken on faith like everyone else. the more I thought about it, the more I became convinced that machine Sid duplication-
Having multiple computers with the same machine Sid-doesn't pose any problem, security or otherwise. I took my conclusion to the Windows security and deployment teams and no one cocould come up with a scenario where two systems with the same machine Sid, whether
In a workgroup or a domain, wocould cause an issue. At that point the demo-to retire newsid became obvious.

I realize that the news that it's okay to have duplicate machine SIDS comes as a surprise to quit, especially since changing SIDS on imaged systems has been a fundamental principle of image deployment since Windows NT's inception. this blog post debunks
The myth with facts by first describing the machine Sid, explaining how Windows uses SIDS, and then showing that-with one exception-Windows never exposes a machine Sid outside its computer, proving that it's okay to have systems with the same machine Sid.
Note that sysprep resets other machine-specific state that, if duplicated, can cause problems for certain applications like Windows Server Update Services (WSUS ), so Microsoft's support policy will still require cloned systems to be made unique with sysprep.

 

SIDS

Windows uses SIDS to represent not just machines, but allSecurity principals.Security principals include machines, domain computer accounts, users and security groups. Names are simply user-friendly representations for SIDS, allowing you to rename
An account and not have to update access control lists (ACLs) that reference the account to reflect the change. A Sid is a variable-length numeric value that consists of a structure revision number, a 48-bit identifier authority value, and a variable number
Of 32-bit subauthority or relative identifier (RID) values. the Authority value identifies the agent that issued the Sid, and this agent is typically a Windows Local system or a domain. subauthority values identify trustees relative to the issuing authority,
And rids are simply a way for Windows to create unique SIDS based on a common base Sid.

You can use the sysinternals psgetsid tool to view a machine's
Sid by running it with no command-line arguments:

Here, the revision number is 1, the Authority is 5, and there are four subauthority values. at one point during the design of Windows NT, The Machine Sid might have been used for network identification, so in order to assure uniqueness, the SID that setup
Generates has one fixed subauthority value (21) and three randomly-generated subauthority values (the numbers following "S-1-5-21" in the output ).

Even before you create the first user account on a system, Windows defines several built-in users and groups, including the Administrator and guest accounts. instead of generating new random SIDS for these accounts, Windows ensures their uniqueness by simply
Appending a per-account unique number, calledRelative identifier(RID), to the machine Sid. The rids for these initial accounts are predefined, so the administrator user always has a rid of 500:

After installation, Windows assigns new local user and group accounts with RIDs starting at 1000. you can use psgetsid to view the name of the account for a specified Sid, and here you can see that the local Sid that has a rid of 1000 is for the Abby account,
The name of the Administrator account windows prompted me to name During setup:

In addition to these dynamically created SIDS, Windows defines a number of accounts that always have predefined SIDS, not just RIDS. one example is the Everyone group, which has the SID S-1-1-0 on every Windows System:

Another example, is the local system account (system), which is the account in which several system processes like Session Manager (smss.exe), the Service Control Manager (services.exe) and Winlogon (winlogon.exe) run:

SIDS and access control lists

When an account logs on to a Windows system, the Local Security Authority Subsystem (LSASS -lsass.exe) creates a logon session andTokenFor the session. A token is a data structure the Windows Kernel defines to represent the account and it contains
The account's Sid, the SIDS of the groups that the account belongs to at the time it authenticated, and the security privileges assigned to the account and the groups. when the last token that references a logon session is deleted, LSASS deletes the logon
Session and the user is considered logged off. Here you can see my interactive logon session, displayed with the sysinternals logonsessionsutility:

And here you can see a token LSASS has created for the session in process explorer's handle view. note that number following the account name, 7 fdee, matches the logon session ID shown by logonsessions:

By default, processes inherit a copy of their parent process's token. every process running in my interactive session, for example, has a copy of the token that they inherited originally from the userinit.exe process, the process Winlogon creates as
First of any interactive logon. You can view the contents of a process's token by double-clicking on the process in process
Explorer and switching to the Security page of the Process Properties dialog:

When one of my processes opens an operating system object, like a file or registry key, the security subsystem executes a permission check that evaluates entries in the object's access control list (ACL) that reference A Sid included in the process's token.

A similar check happens for remote logon sessions, which are the kind created by a "net use" of a remote computer's share. to successfully connect to a share you must authenticate to the remote system with an account known to that system. if the computer
Is part of a workgroup, then the credentials you specify must be for a local account on the remote system; for a domain-joined system, the credentials can be for a remote system's local account or a domain account. when you access a file on the share,
File Server Driver on that system uses the token from the logon session for the permission check, leveraging a mechanic calledImpersonation.

Sid duplication

The Microsoft-supported way to create a Windows installation that's ready for deployment to a group of computers is to install Windows on a reference computer and prepare the system for cloning by running the sysprep Tool. this is calledGeneralizingThe
Image, because when you boot an image created using this process, sysprepSpecializesThe installation by generating a new machine Sid, triggering plug-and-play hardware detection, resetting the product activation clock, and setting other configuration
Data like the new computer name.

However, some IT administrators install Windows on one of their systems, install and configure applications, then use deployment tools that don't reset the SIDS of the copies of the Windows installations. the best practice up to now has been to run a SID-resetting
Utility like newsid to change SIDS. these utilities generate a new machine Sid, try to find all the locations on a system, including all the file system and registry ACLs, that contain copies of the machine Sid, and update them to the new Sid. the reason that
Microsoft doesn't support systems modified in this way is that, unlike sysprep, these tools don't necessarily know about all the places where windows stashes away references to the machine Sid. the reliability and security of a system that has a mix of
Old and new machine Sid can't be guaranteed.

So is having multiple computers with the same machine Sid a problem? The only way it wocould be is if windows ever references the machine SIDS of other computers. For example, if when you connected to a remote system, the local machine Sid was transmitted
To the remote one and used in permissions checks, duplicate SIDS wocould pose a security problem because the remote system wouldn't be able to distinguish the SID of the inbound Remote account from a local account with the same SID (where the SIDS of both accounts
Have the same machine Sid as their base and the same RID ). however as we reviewed, Windows doesn' t allow you to authenticate to another computer using an account known only to the local computer. instead, you have to specify credentials for either an account
Local to the remote system or to a domain account for a domain the remote computer trusts. the remote computer retrieves the SIDS for a local account from its own security accounts Database (SAM) and for a domain account from the active directory database
On a domain controller (dc). The remote computer never references the machine SID of the connecting computer.

In other words, it's not the SID that ultimately Gates access to a computer, but an account's user name and password: simply knowing the SID of an account on a remote system doesn't allow you access to the computer or any resources on it. as further evidence
That a sid isn't sufficient, remember that built-in accounts like the local system account have the same Sid on every computer, something that wocould be a major security hole if it was.

As I said earlier, there's one exception to rule, and that's DCs themselves. Every domain has a uniqueDomain SIDThat's the machine SID of the system that became the domain's first DC, And all machine SIDS for the domain's DCS match
Domain SID. so in some sense, that's a case where machine SIDS do get referenced by other computers. that means domain member computers cannot have the same machine Sid as that of the DCS and therefore domain. however, like member computers, each DC also
Has a computer account in the domain, and that's the identity they have when they authenticate to remote systems.

Some articles on Sid duplication, including this KB article, warn that if multiple computers
Have the same SID, that resources on removable media like an NTFS-formatted FireWire disk can't be secured to a local account. what they fail to mention is that permissions on removable media provide no security regardless, because a user can connect them
To computers running operating systems that don't honor NTFS permissions. moreover, removable media tend to have default permissions that grant access to well-known SIDS, such as to the Administrators group, which are the same on all systems. that's the fundamental
Rule of physical security and why Windows 7 introduced bitlocker-to-go, which enables you to encrypt removable storage.

The final case where Sid duplication wocould be an issue is if a distributed application used machine SIDS to uniquely identify computers. no Microsoft software does so and using the machine Sid in that way doesn't work just for the fact that all DC's have
The same machine Sid. software that relies on unique computer identities either uses computer names or computer domain SIDS (the SID of the computer accounts in the domain ).

The new best practice

It's a little surprising that the SID duplication issue has gone unquestioned for so long, but everyone has assumed that someone else knew exactly why it was a problem. to my chagrin, newsid has never really done anything useful and there's no reason
Miss it now that it's retired. Note that sysprep resets other machine-specific state that, if duplicated, can cause problems for certain applications like Windows Server Update Services (WSUS), so
Microsoft's support policy will still require cloned systems to be made unique with sysprep

Http://blogs.technet.com/ B /markrussinovich/archive/2009/11/03/3291024.aspx? Pageindex = 2 # comments

Author: feiskyer published on 9:18:12 Original article link Read: 13 comment: 0 view comment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.