Professional Windows Server 1002003 Security A Technical Reference [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Professional Windows Server 1002003 Security A Technical Reference [Electronic resources] - نسخه متنی

Roberta Bragg

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







Controlling Access to Files and Folders Using NTFS Permissions


You do not have to use the Windows NTFS file system, but you should. If you do, different permissions can be applied to every file and folder. This is not usually necessary or practical. Instead, if data files are organized in folders according to data sensitivity and by ownership, permissions can be set at the folder level and applied carte blanche to all subfolders and files. If there is a need to modify permission settings within this hierarchy, it can easily be done. The hierarchical nature of the file system allows file permissions set on a top-level folder to be inherited by the files and folders below it. Permission inheritance reduces the burden on the administrator.Chapter 3, "AuthorizationLimiting System Access and Controlling User Behavior," introduced the basics of object permissions and inheritance. This chapter will provide the details.

New in Windows Server 2003 are more secure volume root permissions, more secure default share permissions, and a change in the location of security descriptors.

File and Folder Permissions


Configuring file permissions for files and folders is easy; determining the appropriate permissions you should set is not. Two problems exist: understanding the large number of permissions that can be set, and deciding which Windows groups should have which permissions. The latter must be determined in concert with the data owners. Administrators should not be deciding who should have access to specific folders, documents, and databases. Each department should inform IT of its needs. However, once an administrator understands the requirements, she can implement them within the framework of the permissions available. File and folder permissions are composed of generic permission sets, as shown in Figure 5-1 and defined in Table 5-1. Each generic permission is actually a permission set. Several special permissions are included in the permission set. Each special permission can be assigned individually. Figure 5-2 displays the special permissions that make up Full Control. These permissions are defined in Table 5-2. A permission can be set to either Allow or Deny. Some permissions are only used for files, and others are only used on folders (as indicated in the table).

Figure 5-1. Generic permissions sets.

Table 5-1. Generic File/Folder Permissions

Permission

Description

Composed of Special Permissions

Full Control

All permissions

All permissions

Modify

Change data

Cannot delete subfolders and files (can delete the files in this folder or this file). Can change permissions, take ownership

File: Read & Execute Folder: List Folder Contents

Read files, execute programs and scripts, see folder contents. Both permission sets are visible at the folder level, but the List Folder permission set is only inherited by subfolders, not files. You will never see the List Folder Contents permission applied to files.

Traverse folder/execute files, list folder and read data, read attributes and extended attributes, read permissions, synchronize

Read

Read files

List folder/read data, read attributes and extended attributes, read permissions, synchronize

Write

Write files, add files to folder

Create files and write data, create folders, append data, Write attributes and extended attributes, read permissions

Figure 5-2. Special permissions that make up Full Control.

Table 5-2. Special File/Folder Permissions

Permissions

Description

Folder/File

Traverse Folder/Execute File

If the Bypass traverse checking user right is not granted, this permission can be granted to allow programmatic traversal of a directory tree to get to files and folders.

Setting Traverse Folder permission on a folder does not set the Execute File permission on the files in that folder.

List Folder/Read Data

List Folder will allow or deny viewing of filenames and subfolder names within the folder. It only affects the contents of the folder on which it is granted, not the folder itself (The folder the permission is applied to may not be viewable.Read Data will grant or deny reading of file content.)

List Folder only applies to folders. Read Data only applies to files.

Read Attributes

Allows or denies viewing of attributes on a file or folder. Attributes are things such as read-only and hidden.

Applies to both.

Read Extended Attributes

Allows or denies viewing of attributes. Extended attributes are defined by programs and may vary.

Applies to both.

Create Files/Write Data

Create Files allows or denies adding files to the folder. Write Data allows or denies changes to the file or overwriting of contents.

Create Files only applies to folders. Write Data only applies to files.

Create Folders/Append Data

Create Folders allows or denies creating folders within the folder to which it is applied. Append Data allows or denies adding data to the end of the file. (It does not allow changing, deleting, or overwriting existing data.)

Create Folders only applies to folders. Append Data only applies to files.

Write Attributes

Allows or denies making changes to attributes of a file or folder.

Applies to properties of both files and folders.

Write Extended Attributes

Allows or denies changing the extended attributes of a file or folder.

Applies to both the extended properties of files and folders.

Delete Subfolders and Files

Allows or denies deleting subfolders and files.

Applies as stated.

Delete

Allows or denies deleting a file or folder.

Applies to both.

Read Permissions

Allows or denies reading permissions.

Applies to both files and folders.

Change Permissions

Allows or denies changing permissions.

Applies both to files and folders.

Take Ownership

Allows or denies taking ownership of a file or folder.

Applies to both files and folders.

Synchronize

Allows or denies threads (executable code running on a system) the ability to wait on the handle of the file or folder and synchronize with another thread that may signal it. Think of the handle of a file or folder as the connection point to it. If multiple threads in a program need access to the same file or folder, they must wait their turn and synchronize access to the object between them.

Applies to both files and folders.

WARNING: Full Control Implies Delete Permission

If the Full Control permission is granted on a folder to a user or group, then that group may delete files within the folder, even if the user or group is not provided explicit access to the file or folder. This is also true if permissions are explicitly set on the file to deny that user or group access to the file. This property is called Child File Delete and was originally implemented to give the Windows NT Posix subsystem compliance with Posix 1.1. Posix is a Unix standard. At one time, compliance with the Posix standard was necessary to sell computers to branches of the federal government. The permission Child File Delete is part of the Posix standard.

Default Permissions


By default, Windows Server 2003 applies stronger access controls than Windows 2000. During installation, Windows 2000 applies granular permission sets to its system files. However, the group Everyone is granted Full Control at the root of the system drive. One concern at the time of its release was that changing permissions on the root drive during an upgrade might interfere with currently installed applications. Weak root file system permissions, however, weaken the security of the entire computer. When new applications are installed, they inherit the same weak permissions.

Windows Server 2003 applies stronger root file system permissions. The installation process sets access control lists on the root of the system volume that are more secure.

Administrators and SYSTEM
Full Control

CREATOR OWNER
Full Control on subfolders and files

Users
Create folders, append data on folders and subfolders

Users
Create files and subfolders only


However, the default permission set should be reviewed, and stronger permissions should be applied in many cases.

First, for some servers, it may be best to limit administrative access. An Exchange server or database server may be a good candidate for this treatment. To restrict administrative access, create a custom Windows group and add administrators who are authorized to administer the specific server. Grant this custom group Full Control and remove the local Administrators group.

The CREATOR OWNER group represents the account that created the file or folder. Any permissions granted to this group are assigned to the file or folder creator. If applications create folders and files, these permissions will be granted to the account that provides the security context for the application. That account may be an account assigned to the service or a user running the program. The CREATOR OWNER permission is often used to ensure that the appropriate permissions are applied. For example, when an application creates a file, the permissions applied to the file might be less than Full Control, thereby denying the person running the application ownership of the file. This is important because only the owner of a file can change its permissions to provide himself more access; therefore, if as the creator of the file, the user is not given ownership, he will be restricted to the access assigned. (Administrators and those assigned the user right Take Ownership can always take ownership and assign themselves any permissions on the file, but ordinary users do not have this right by default.) The specific requirements of applications and security policies of the organization may be different from those granted by the default permissions. Therefore, adjusting the default CREATOR OWNER permissions may be necessary. Default user permissions may also grant excessive permission on the files and folders they are authorized to create and should be reviewed to determine if they are appropriate. To determine the permission sets required for users, determine if users should be able to create files and folders on the server and determine where this may be necessary. It's not typically a requirement for the root of the drive. In many cases, a preferred arrangement is to provide users no access at the root and assign custom permissions to server folders where user access is required.

In all cases, permission inheritance should be reviewed. Unless a subfolder is marked to prevent inheritance, subfolders will inherit the permissions set on the root.


Watch Out for Special Permissions


The CREATOR OWNER assignment at the root demonstrates an issue with the way that NTFS permissions are reported. When the CREATOR OWNER group is highlighted in the Security page of the root properties, as shown in Figure 5-3, it looks as if the group has no permissions assigned. However, when the Advanced button is used and the group permissions are opened in the editor, as shown in Figure 5-4, the special permissions are revealed. This combination of special permissions does not map to a task set and therefore is not displayed in the Security page. Take care to review special permissions on all groups and users assigned on the Security page.

Figure 5-3. CREATOR OWNER does not appear to have permissions applied.

Figure 5-4. Check for special permissions by editing the CREATOR OWNER assignment from the Advanced page.

Instead of granting the Everyone group Full Control, creating a new file share grants the Everyone group Full Control. In addition to strengthening default access to shares, Windows Server 2003 does not include the anonymous SID in the Everyone group. Therefore, even if an anonymous connection can be made to the server, the anonymous user has no default permissions via the shares.

Permission Interpretation


Permission interpretation explains how permissions are evaluated. In its simplest form, the permissions that a user or group has on a file or folder are the combination of the permissions assigned. Realistically, however, the ability of a user to do something with a file or folder depends on a number of factors. Basically, the user requests some form of access, and the operating system walks the access control list (ACL) assigned to the file or folder looking for a match. Both the user's account SID and his group membership SIDs are reviewed. If access is explicitly denied, then the processing stops, and access is denied. If access is not explicitly granted, then it is denied. This is the same algorithm used to determine access since Windows NT. However, there is one difference between the old algorithm and Windows 2000/Server 2003: Inheritance may break the old NT rule that any Deny would automatically override any Allows and stop processing of the ACLs. To understand this difference, you must learn more about the NTFS disk structure and the location of ACLs.

WARNING: Deny Does Not Always Override Allow

A different inheritance mode for NTFS means that old rules about access control permission may not be valid. This is true because of a change in ACL location and therefore in the manner in which permissions are evaluated. It is possible that a Deny permission may not be interpreted before the required Allow permission is processed. This is because permissions applied directly on the object are applied first, and the inherited permissions are not considered if the directly applied permissions grant the required access. More information is in the section "Permission Inheritance," later in this chapter.

NTFS Disk Structure


Knowledge of file system architecture is useful should you need to forensically examine a disk, but more importantly, it can help you understand much about how NTFS works and the relationship between DACLs and performance. (For the basics of object security-object permissions, access tokens, groups, permission assignment, ACEs, and DACLs, refer to Chapter 3.) A significant change in the NTFS file structure was made for Windows 2000, and it was tweaked for performance in Windows Server 2003. This architectural change can affect security because administrators may still be approaching NTFS without understanding the change. Worse, trainers and experienced Windows administrators may communicate misinformation and perpetuate the problem. The change in the file structure itself is not a plus or a minus security-wise, unless you are forensically examining a disk, but it is important to understand. The primary change involves the location of the security descriptors.

Windows NT, Windows Server 2003, and Windows 2000 NTFS file volumes use a small database, the Master File Table (MFT), to assist in the location of files. MFT includes file and directory records that store and index filenames and other attributes, such as reparse points (mounts points for additional disks), link tracking information (to help in the location of files when locations are moved), and security descriptors. This is different than it was in Windows NT 4.0, where security descriptors (the attributes of files and folders that contain access control lists) were stored as attributes of the file objects they protected. Instead, a pointer in the file's attributes points back to the location in the MFT where the file's security descriptor can be found. Within the MFT, each file and folder has a record. The MFT metadata includes the $Secure record, which contains security descriptors for all MFT records. This does not mean that the MFT is bloated with double the data of earlier versions of NTFS. Instead, it only contains one copy of each unique security descriptor, which, of course, means that instead of one security descriptor for each file and folder on the entire disk, only a few security descriptors are stored. This arrangement also means that if a file has a large security descriptor (if many groups or users are given specific Allows or Denies), the security descriptor will not be fragmented and won't cause excessive disk activity when the file is accessed.

Permission Inheritance


The easiest way to think about permission inheritance is to construct a logical model that aligns with the file, folder, and subfolder hierarchal model of the file system. While security descriptors are actually stored in the MFT, they are applied to physical files and folders, so it's okay to speak of them as if they actually were properties of the files and folders, instead of talking about pointers to records. In the file system model, the root of the volume is divided into multiple volume-level folders, each of which can be divided up into subfolders, and on and on. Files can be located at the root and within every folder. The identification of a specific file is presented in a path that starts at the root and then may be followed by any number of subfolders until the file itself is named. In the NTFS file system, not only can each file and folder have files directly assigned permissions, but through permission inheritance, permissions assigned to a folder in the hierarchy can also be applied to every subfolder and file in the path. Inheritance can also be blocked or limited. If a new file is added to a folder, by default, it inherits its security descriptor from the parent folder. The security descriptor may include a combination of inherited and directly applied permissions.

Results of Inherited and Directly Applied Permissions

On any specific file, a combination of both directly applied and inherited permissions may be assigned. Effective permissions are the resultant set of these permissionsthe actual result of interpreting them. To determine what the effective permissions will be, use the following formula:


1.

List the Deny permissions that are explicitly applied to the file.

2.

List the Allow permissions that are explicitly applied to the file.

3.

List the Deny permissions that are inherited.

4.

List the Allow permissions that are inherited.

5.

Review the requested access against each permission set in the order expressed above. Ask the following questions:

If the request is denied by an explicitly applied permission, then the access is denied, and processing stops.

If it is not denied, is it explicitly allowed by the set of explicitly applied permissions? If so, then it is allowed, and processing stops.

Is it denied explicitly by inherited permissions? Then access is denied, and processing stops.

Is it explicitly allowed by inherited permissions? Then access is granted, and processing stops.

Have all permissions been evaluated and access is not allowed? Then Access is denied and processing stops.


Windows Server 2003 also provides a report mechanism to evaluate permission combinations. To determine the effective permissions:


1.

Open the Properties page of the file or folder.

2.

Click the Advanced button.

3.

Select the Effective Permissions page.

4.

Click the Select button.

5.

Enter the user or group name desired, or use the object picker to select the user or group.

6.

Click OK and review the Effective permissions, as shown in Figure 5-5.

Figure 5-5. The effective permissions are those actually available for a user or group on the selected object.

[View full size image]


Impact of Copying and Moving NTFS Files and Folders

Copying and moving files or folders may change the permissions applied to them. The resulting permission set applied to either object is dependent on on the following:

The change is from and to folders on the same volume or to different volumes.

The object is copied or moved.

The object is marked to prevent inheritance.

Permissions on parent folders or the root are modified.

The inheritance mode of the objects is overridden.


The examples in this section can be reproduced on any Windows Server 2003 computer using the NTFS file system on which there are at least two volumes. The instructions listed were used to produce the results shown. Before proceeding, three top-level folderstest1, test2, and test3were created on drive C:\. Each folder inherits permissions from the root, as shown in Figure 5-6. In addition, two new Windows groups the Accountants group and the Sales groupwere created.

Figure 5-6. New top-level folders inherit permissions from the root.

[View full size image]

To prepare folders for testing, make the following changes:


1.

Open the security property page for the test2 folder.

2.

Click on the Advanced button and uncheck the Allow Inheritable Permissions from the Parent to Propagate check box.

3.

When prompted, copy all permissions and click OK. At this point, all three folders still have the same permission sets, but the test2 folder's permissions are directly applied, as shown in Figure 5-7.

Figure 5-7. Blocking inheritance will prevent changes made to the parent folder from propagating to this folder.

[View full size image]

4.

Change the permission set of test2 by granting the Accountants group the Modify permission, and remove the Users group, as shown in Figure 5-8.

Figure 5-8. Change permissions on the folder.

5.

Change to the second volume and change its root permissions to Everyone Full Control, as shown in Figure 5-9.

Figure 5-9. The second volume is set to different permissions to show inheritance issues in later examples.


Moving Files from Folder to Folder on the Same Volume

When existing files and folders are moved to a new location on the same volume, they do not immediately lose their current permissions.


1.

Create a file in the test2 folder called accountantsonly.txt.

2.

Create a copy of the accountantsonly.txt file and save it in the test2 folder.

3.

Create a copy of the copy of the accountantsonly.txt file and save it in the test2 folder.

4.

Change the permissions on accountantsonly.txt to prevent inheritance.

5.

Move both accountantsonly.txt and its copy of accountantsonly. txt to the test1 folder.

6.

The test1 folder inherits its permissions from the root of C:\. When new files are added, they will inherit these permissions. However, moved files do not immediately inherit their new folder's permissions. View the copy of the accountantsonly.txt file permissions, as shown in Figure 5-10. The permissions will show that they have retained the permissions that were set earlier. This is also true of the accountantsonly.txt file, as shown in Figure 5-11. (Note that the permissions here are not inherited as they are in Figure 5-10 because of step 4.)

Figure 5-10. Permissions are retained when a file is first moved from one folder to the next.

[View full size image]

Figure 5-11. When inheritance is blocked, permissions remain the same when a file is moved.

[View full size image]

7.

Change the permissions on the test1 folder to provide the Modify permission to the Sales group.

8.

View the permissions on each file. The copy of the accountantsonly.txt file will have been modified via inheritance to provide access to the Sales group and to remove access from the Accountants group, as shown in Figure 5-12. This is because files moved from one folder on a drive to another will inherit the permissions of the new folder if and when the permission set is modified. This is not true of the accountantsonly.txt file because inheritance was blocked, so the permission set remains the same.

Figure 5-12. When permissions on the parent object are changed, the moved file will inherit its permissions unless inheritance is blocked.

[View full size image]


Copying Files from Folder to Folder on the Same Volume


1.

Create a text file in the test3 folder called forall.txt.

2.

Open the forall.txt security properties page and note the permission inheritance, as shown in Figure 5-13.

Figure 5-13. The Forall.txt file inherits its permissions from the folder it is created in.

[View full size image]

3.

Copy the forall.txt file to the test1 folder.

4.

Open the security properties page of the forall.txt file and note that the file has inherited new permissions from the test1 folder, as shown in Figure 5-14.

Figure 5-14. Files copied from folder to folder inherit the permissions of the new folder.

[View full size image]


Moving Files from One Volume to Another

When files are moved between folders on the same volume, they retain their permissions until the parent permissions are changed. However, when moved between volumes, moved files inherit the permissions set in the new volume.


1.

Move the copy of accountantsonly.txt from C:\test1 to the second volume.

2.

Open the security properties page and note that permissions are now inherited immediately from the new volume, as shown in Figure 5-15.

Figure 5-15. Files moved between volumes immediately inherit the permissions from the new volume.

[View full size image]


Overriding Blocked Inheritance

If copied or moved files have inheritance blocked, the files will not inherit permissions from the new folder. However, blocked inheritance can be overridden.


1.

Open the advanced security page of the test1 folder.

2.

Check the box Replace permission entries on all child objects with entries shown here that apply to all objects, as shown in Figure 5-16.

Figure 5-16. Inheritance blocking can be overridden.

[View full size image]

3.

Open the advanced security property page of the accountantsonly.txt file, as shown in Figure 5-17. You should recall that this file had inheritance blocking turn on. Note that the permissions have now been inherited from the folder, and the inheritance blocking is turned off.

Figure 5-17. When inheritance blocking is overridden, permissions will be inherited, and inheritance blocking will be turned off.

[View full size image]


Copying DACLs with Xcopy

If the xcopy command and its /O switch are used for copying, existing permissions are retained, and permissions are inherited from the new location.


1.

Open a command prompt.

2.

Enter the command:


xcopy /O C:\test1 E:\test1

3.

When prompted, enter a D to indicate that the test1 name represents a folder name.

4.

Open the advanced security property page, as shown in Figure 5-18, and note that the Sales group still retains its permission and is not inherited. Other permissions are inherited from E:\.

Figure 5-18. Xcopy can be used to copy ACLs.

[View full size image]


Permission Summary

Be sure to determine if moving and copying files will have the correct effect on file access. As demonstrated previously, permissions may change. Prevent unexpected improper access control settings by keeping in mind that the permissions that are applied to moved or copied files and folders may change depending on these factors:

Where they were created

Whether they were moved or copied to a new location

Whether xcopy or Windows Explorer was used

Whether the new location was on the same volume or a different one

Whether they had their own security descriptor or an inherited one

Whether inheritance was blocked

What the inheritance settings were on the folder moved or copied to


NTFS Attributes and Performance Versus Security


Using a more complex file system and adding security may impact performance. The benefits of granular security must be weighed against any performance losses. Before making any configuration choices intended to improve performance, the new features and the security implications of making changes should be evaluated.

NTFS Performance ImprovementLocation of File Descriptors

Each file and directory contains a number of attributes. The file property $Standard_Information contains the regular file attributes, such as Read-Only, Hidden, System, Archive, Timestamps, and a pointer to the security descriptor in the $Secure record in the MFT. Locating the security descriptor in the MFT does aid file system performance and to some degree refute the argument that we should not add security information because it will hinder performance. (When discussing file system security, Windows NT 4.0 users often heard the argument that many large ACLs would reduce performance because the ACLs might become fragmented, or because when ACLs are changed in Windows NT 4.0, all subfolders and files would inherit the new ACL. Because the assignment of ACLs is now handled using pointers to the new ACL, and because all ACLs exist only in the MFT, the old argument is no longer valid.)

The file system can quickly figure out whether a new security descriptor is unique and must be stored, or whether it already exists and just needs to be pointed to. To do so, the file system stores a hash of each security descriptor in the MFT. When a new ACL is created on a file or folder, the new security descriptor is hashed by the system and then compared to those that already exist in the MFT. If no match is found, then the security descriptor must be stored; if a match is found, then it does not need to be stored. As you may already know, many hash algorithms exist for which it is statistically infeasible that two different pieces of data can produce the same result when hashed. This is why a match with an existing hash means no new security descriptor needs to be stored.

Timestamp Performance Issues

Another potential performance issue concerns timestamps. Timestamps stored in file attributes indicate record creation, attribute modification, and data or index modification in addition to the time of last access. Updating timestamps does require disk activity. On a large disk with a large number of files that are frequently accessed, this could be significant enough that reducing the timestamp activity might provide some small gain in performance. However, be wary of advice that calls for eliminating the "update to last access" timestamp. The last access time stamp, of course, indicates when a file was last changed and can be useful forensics information, as a simple indication of possible tampering, or as proof that a file has not been affected by an attempted attack.

Administrators may eliminate last access update timestamps in an attempt to improve performance, but they should not. Accurate timestamps are necessary to obtain accurate audit and forensic information and to comply with policies that require it. You can determine if last access update has been modified by inspecting the REG_DWORD value NtfsDisableLastAccessUpdate at HKEY_LOCAL_MACHINE\SYSTEM\ Current Control Set\Control\filesystem. Protect this value from change by using registry permissions, and turn on auditing to capture any change that might be performed by administrators.


/ 194