S 4.284 Handling of services under Windows Server 2003 and higher

Initiation responsibility: Head of IT

Implementation responsibility: Administrator

Under Windows, services are executed in the security context of certain accounts (referred to as service accounts). Resources are accessed through the service account in the same manner as a user accesses resources through his user account. Once a service is started, it remains active, which means the corresponding service is logged in to the service account permanently or the central service controller logs the service in again at regular intervals. The services on servers are usually central services that are critical to operation. Service accounts are therefore subject to more risks than normal user accounts. If there are any dependencies between the services, then a compromised, apparently unimportant service can cause a service that is critical to operation to crash. For these reasons, services and service accounts should be administered according to special rules.

A compromised service account with high level of authorisation is easier to isolate when it is not used to run several services. In practice, server applications may operate a group of services in the context of a single account. It must be decided on a case-by-case basis if this is compatible with the protection requirements of the system and to what extent it is possible to use different service accounts without affecting the desired functionality.

Exceptions to this rule are the special, predefined NT AUTHORITY\LocalService and NT AUTHORITY\NetworkService accounts. These accounts are administered by the internal service controller and provide each service with an isolated security context. Authentication is performed internally in the system by the service controller. Password entries are ignored.

For this reason, you should consider giving priority to using the predefined accounts NT AUTHORITY\LocalService for services operating locally and NT AUTHORITY\NetworkService for services with access to a network. These accounts have the same authorisations as the predefined Authenticated Users group (normal users) by default.

Under Windows Server 2008 R2, two special types of account were introduced - the Managed Service Account and the Virtual Account.

Contrary to the accounts previously used for management of services such as Local Service, Network Service or Local System, the managed service account can be managed centrally as it is stored in the organisational unit "Managed Service Accounts" within the Active Directory.

It must be noted that the new function of the service accounts requires presence of Windows Server 2008 R2 on the managed system. Only one managed service account can be used per system. Furthermore, for complete use of functions the domain must be in the co-called Windows Server 2008 R2 mode (domain function level). For domains in the Windows Server 2003 or 2008 mode, further configuration steps should be performed, if required.

Up to and including Windows Server 2008, local accounts should be preferred over the domain accounts. If domain accounts are used, then they should be granted as few domain authorisations as possible, and the availability of the corresponding domain controllers must be ensured. Service accounts should deny local login attempts (Start | Control Panel | Administrative Tools | Local Security Policy | Local Policies | User Rights Assignment | Deny Logon Locally or in a domain group policy). Under Windows Server 2008 R2 and higher, the accounts already stated above - Managed Service Account and the Virtual Account should be used for administration of service accounts.

A service account password should have a password length of at least 10 characters (up to 127 characters are possible). The password must not be allowed to expire automatically (Password never expires option in the Properties of the account), but should be changed during regular maintenance cycles instead. A method for changing passwords should be defined, and the passwords should be stored safely, see S 2.22 Escrow of passwords. When there is a large number of services and servers, storing and changing the passwords (including the function tests of the services) can become very complicated so that gain of security may be lost under some circumstances. Utility programs used to manage the passwords of service accounts can be a valuable aid when changing passwords, but their use also entails certain risks. The maximum age of the passwords and the method used to administer them should be specified depending on the protection requirement and the effort required for administration, and then documented in a policy.

Documentation

The service accounts and authorisations for all services not running in one of the predefined accounts must be documented.

Review questions: