Which area of focus do public facing servers workstations WIFI networks and personal devices fall under?

Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Best practices for securing Active Directory Federation Services

  • Article
  • 05/19/2022
  • 13 minutes to read

In this article

This document provides best practices for the secure planning and deployment of Active Directory Federation Services [AD FS] and Web Application Proxy. It contains recommendations for additional security configurations, specific use cases, and security requirements.

This document applies to AD FS and WAP in Windows Server 2012 R2, 2016, and 2019. These recommendations can be used for either an on-premises network or in a cloud hosted environment such as Microsoft Azure.

Standard deployment topology

For deployment in on-premises environments, we recommend a standard deployment topology consisting of:

  • one or more AD FS servers on the internal corporate network
  • one or more Web Application Proxy [WAP] servers in a DMZ or extranet network.

At each layer, AD FS and WAP, a hardware or software load balancer is placed in front of the server farm, and handles traffic routing. Firewalls are placed, in front of the external IP address, of the load balancer as needed.

Note

AD FS requires a full writable Domain Controller to function as opposed to a Read-Only Domain Controller. If a planned topology includes a Read-Only Domain controller, the Read-Only domain controller can be used for authentication but LDAP claims processing will require a connection to the writable domain controller.

Hardening your AD FS servers

The following is a list of best practices and recommendations for hardening and securing your AD FS deployment.

  • Ensure only Active Directory Admins and AD FS Admins have admin rights to the AD FS system.
  • Reduce local Administrators group membership on all AD FS servers.
  • Require all cloud admins use Multi-Factor Authentication [MFA].
  • Minimal administration capability via agents.
  • Limit access on-network via host firewall.
  • Ensure AD FS Admins use Admin Workstations to protect their credentials.
  • Place AD FS server computer objects in a top-level OU that doesn’t also host other servers.
  • All GPOs that apply to AD FS servers should only apply to them and not other servers as well. This limits potential privilege escalation through GPO modification.
  • Ensure the installed certificates are protected against theft [don’t store these on a share on the network] and set a calendar reminder to ensure they get renewed before expiring [expired certificate breaks federation auth]. Additionally, we recommend protecting signing keys/certificates in a hardware security module [HSM] attached to AD FS.
  • Set logging to the highest level and send the AD FS [& security] logs to a SIEM to correlate with AD authentication as well as AzureAD [or similar].
  • Remove unnecessary protocols & Windows features
  • Use a long [>25 characters], complex password for the AD FS service account. We recommend using a Group Managed Service Account [gMSA] as the service account, as it removes the need for managing the service account password over time by managing it automatically.
  • Update to the latest AD FS version for security and logging improvements [as always, test first].

Ports required

The below diagram depicts the firewall ports that must be enabled between and amongst the components of the AD FS and WAP deployment. If the deployment does not include Azure AD / Office 365, the sync requirements can be disregarded.

Note that port 49443 is only required if user certificate authentication is used, which is optional for Azure AD and Office 365.

Note

Port 808 [Windows Server 2012R2] or port 1501 [Windows Server 2016+] is the Net.TCP port AD FS uses for the local WCF endpoint to transfer configuration data to the service process and PowerShell. This port can be seen by running Get-AdfsProperties | select NetTcpPort. This is a local port that will not need to be opened in the firewall but will be displayed in a port scan.

Communication between Federation Servers

Federation servers on an AD FS farm communicate with other servers in the farm and the Web Application Proxy [WAP] servers via HTTP port 80 for configuration synchronization. Make sure that only these servers can communicate with each other and no other is a measure of defense in depth.

Organizations can do achieve this state, by setting up firewall rules on each server. The rules should only allow inbound communication from the IP addresses of the servers in the farm and WAP servers. Note that some Network Load Balancers [NLB] use HTTP port 80 for probing the health on individual federation servers. Make sure that you include the IP addresses of the NLB in the configured firewall rules.

Azure AD Connect and Federation Servers/WAP

This table describes the ports and protocols that are required for communication between the Azure AD Connect server and Federation/WAP servers.

ProtocolPortsDescription
HTTP 80 [TCP/UDP] Used to download CRLs [Certificate Revocation Lists] to verify SSL certificates.
HTTPS 443[TCP/UDP] Used to synchronize with Azure AD.
WinRM 5985 WinRM Listener

WAP and Federation Servers

This table describes the ports and protocols that are required for communication between the Federation servers and WAP servers.

ProtocolPortsDescription
HTTPS 443[TCP/UDP] Used for authentication.

WAP and Users

This table describes the ports and protocols that are required for communication between users and the WAP servers.

ProtocolPortsDescription
HTTPS 443[TCP/UDP] Used for device authentication.
TCP 49443 [TCP] Used for certificate authentication.

For information on required ports and protocols required for hybrid deployments, see the document here.

For information about ports and protocols required for an Azure AD and Office 365 deployment, see the document here.

Endpoints enabled

When AD FS and WAP are installed, a default set of AD FS endpoints are enabled on the federation service and on the proxy. These defaults were chosen based on the most commonly required and used scenarios and it is not necessary to change them.

[Optional] Min set of endpoints proxy enabled for Azure AD / Office 365

Organizations deploying AD FS and WAP only for Azure AD and Office 365 scenarios can limit even further the number of AD FS endpoints enabled on the proxy to achieve a more minimal attack surface. Below is the list of endpoints that must be enabled on the proxy in these scenarios:

EndpointPurpose
/adfs/ls Browser based authentication flows and current versions of Microsoft Office use this endpoint for Azure AD and Office 365 authentication
/adfs/services/trust/2005/usernamemixed Used for Exchange Online with Office clients older than Office 2013 May 2015 update. Later clients use the passive \adfs\ls endpoint.
/adfs/services/trust/13/usernamemixed Used for Exchange Online with Office clients older than Office 2013 May 2015 update. Later clients use the passive \adfs\ls endpoint.
/adfs/oauth2 Used for any modern apps [on-prem or in cloud] you have configured to authenticate directly to AD FS [i.e. not through Azure AD]
/adfs/services/trust/mex Used for Exchange Online with Office clients older than Office 2013 May 2015 update. Later clients use the passive \adfs\ls endpoint.
/adfs/ls/federationmetadata/2007-06/federationmetadata.xml Requirement for any passive flows; and used by Office 365 / Azure AD to check AD FS certificates.

AD FS endpoints can be disabled on the proxy using the following PowerShell cmdlet:

Set-AdfsEndpoint -TargetAddressPath  -Proxy $false

For example:

Set-AdfsEndpoint -TargetAddressPath /adfs/services/trust/13/certificatemixed -Proxy $false

Extended protection for authentication

Extended protection for authentication is a feature that mitigates against man in the middle [MITM] attacks and is enabled by default with AD FS.

To verify the settings, you can do the following:

The setting can be verified using the below PowerShell cmdlet.

Get-ADFSProperties

The property is ExtendedProtectionTokenCheck. The default setting is Allow, so that the security benefits can be achieved without the compatibility concerns with browsers that do not support the capability.

Congestion control to protect the federation service

The federation service proxy [part of the WAP] provides congestion control to protect the AD FS service from a flood of requests. The Web Application Proxy will reject external client authentication requests if the federation server is overloaded as detected by the latency between the Web Application Proxy and the federation server. This feature is configured by default with a recommended latency threshold level.

To verify the settings, you can do the following:

  1. On your Web Application Proxy computer, start an elevated command window.
  2. Navigate to the AD FS directory, at %WINDIR%\adfs\config.
  3. Change the congestion control settings from its default values to .
  4. Save and close the file.
  5. Restart the AD FS service by running net stop adfssrv and then net start adfssrv. For your reference, guidance on this capability can be found here.

Standard HTTP request checks at the proxy

The proxy also performs the following standard checks against all traffic:

  • The FS-P itself authenticates to AD FS via a short lived certificate. In a scenario of suspected compromise of dmz servers, AD FS can "revoke proxy trust" so that it no longer trusts any incoming requests from potentially compromised proxies. Revoking the proxy trust revokes each proxy`s own certificate so that it cannot successfully authenticate for any purpose to the AD FS server
  • The FS-P terminates all connections and creates a new HTTP connection to the AD FS service on the internal network. This provides a session-level buffer between external devices and the AD FS service. The external device never connects directly to the AD FS service.
  • The FS-P performs HTTP request validation that specifically filters out HTTP headers that are not required by AD FS service.

Recommended security configurations

Ensure all AD FS and WAP servers receive the most current updates The most important security recommendation for your AD FS infrastructure is to ensure you have a means in place to keep your AD FS and WAP servers current with all security updates, as well as those optional updates specified as important for AD FS on this page.

The recommended way for Azure AD customers to monitor and keep current their infrastructure is via Azure AD Connect Health for AD FS, a feature of Azure AD Premium. Azure AD Connect Health includes monitors and alerts that trigger if an AD FS or WAP machine is missing one of the important updates specifically for AD FS and WAP.

Information on installing Azure AD Connect Health for AD FS can be found here.

When you federate your AD FS with Azure AD, it is critical that the federation configuration [trust relationship configured between AD FS and Azure AD] is monitored closely, and any unusual or suspicious activity is captured. To do so, we recommend setting up alerts and getting notified whenever any changes are made to the federation configuration. To learn how to setup alerts, see Monitor changes to federation configuration.

Additional security configurations

The following additional capabilities can be configured to provide more protection.

Extranet "soft" lockout protection for accounts

With the extranet lockout feature in Windows Server 2012 R2, an AD FS administrator can set a maximum allowed number of failed authentication requests [ExtranetLockoutThreshold] and an observation windows time period [ExtranetObservationWindow]. When this maximum number [ExtranetLockoutThreshold] of authentication requests is reached, AD FS stops trying to authenticate the supplied account credentials against AD FS for the set time period [ExtranetObservationWindow]. This action protects this account from an AD account lockout, in other words, it protects this account from losing access to corporate resources that rely on AD FS for authentication of the user. These settings apply to all domains that the AD FS service can authenticate.

You can use the following Windows PowerShell command to set the AD FS extranet lockout [example]:

Set-AdfsProperties -EnableExtranetLockout $true -ExtranetLockoutThreshold 15 -ExtranetObservationWindow [ new-timespan -Minutes 30 ]

For reference, the public documentation of this feature is here.

Disable WS-Trust Windows endpoints on the proxy i.e. from extranet

WS-Trust Windows endpoints [/adfs/services/trust/2005/windowstransport and /adfs/services/trust/13/windowstransport] are meant only to be intranet facing endpoints that use WIA binding on HTTPS. Exposing them to extranet could allow requests against these endpoints to bypass lockout protections. These endpoints should be disabled on the proxy [i.e. disabled from extranet] to protect AD account lockout by using following PowerShell commands. There is no known end user impact by disabling these endpoints on the proxy.

Set-AdfsEndpoint -TargetAddressPath /adfs/services/trust/2005/windowstransport -Proxy $false
Set-AdfsEndpoint -TargetAddressPath /adfs/services/trust/13/windowstransport -Proxy $false

Note

If your AD FS farm runs on Windows Internal Databases [WID] and has a secondary AD FS server, after disabling the endpoints on primary server, wait for the SYNC to occur on secondary nodes before restarting the AD FS service on them. Use the PowerShell command Get-AdfsSyncProperties on the secondary node to track last SYNC process.

Differentiate access policies for intranet and extranet access

AD FS has the ability to differentiate access policies for requests that originate in the local, corporate network vs requests that come in from the internet via the proxy. This differentiation can be done per application or globally. For high business value applications or applications with sensitive or personally identifiable information, consider requiring multi factor authentication. Multi factor authentication can be set up via the AD FS management snap-in.

Require Multi factor authentication [MFA]

AD FS can be configured to require strong authentication [such as multi factor authentication] specifically for requests coming in via the proxy, for individual applications, and for conditional access to both Azure AD / Office 365 and on premises resources. Supported methods of MFA include both Microsoft Azure MF and third party providers. The user is prompted to provide the additional information [such as an SMS text containing a one time code], and AD FS works with the provider specific plug-in to allow access.

Supported external MFA providers include those listed in this page, as well as HDI Global.

Enable protection to prevent by-passing of cloud Azure AD Multi-Factor Authentication when federated with Azure AD

Enable protection to prevent bypassing of cloud Azure AD Multi-Factor Authentication when federated with Azure AD and using Azure AD Multi-Factor Authentication as your multi factor authentication for your federated users.

Enabling the protection for a federated domain in your Azure AD tenant will ensure that Azure AD Multi-Factor Authentication is always performed when a federated user accesses an application that is governed by a conditional access policy requiring MFA. This includes performing Azure AD Multi-Factor Authentication even when federated identity provider has indicated [via federated token claims] that on-prem MFA has been performed. Enforcing Azure AD Multi-Factor Authentication every time assures that a compromised on-prem account cannot bypass Azure AD Multi-Factor Authentication by imitating that a multi factor authentication has already been performed by the identity provider, and is highly recommended unless you perform MFA for your federated users using a third party MFA provider.

The protection can be enabled using a new security setting, federatedIdpMfaBehavior which is exposed as a part of the Internal Federation MS Graph API or MS Graph PowerShell cmdlets. The federatedIdpMfaBehavior setting determines whether Azure AD accepts the MFA performed by the federated identity provider when a federated user accesses an application that is governed by a conditional access policy that requires MFA. Administrators can choose one of the following values:

Administrators can choose one of the following values:

PropertyDescription
acceptIfMfaDoneByFederatedIdp Azure AD accepts MFA if performed by identity provider. If not, performs Azure AD Multi-Factor Authentication.
enforceMfaByFederatedIdp Azure AD accepts MFA if performed by identity provider. If not, it redirects request to identity provider to perform MFA.
rejectMfaByFederatedIdp Azure AD always performs Azure AD Multi-Factor Authentication and rejects MFA if performed by identity provider.

You can enable protection by setting federatedIdpMfaBehavior to rejectMfaByFederatedIdp using the following command.

MS GRAPH API


 PATCH /domains/{domainsId}/federationConfiguration/{internalDomainFederationId} 

{ 

"federatedIdpMfaBehavior": "rejectMfaByFederatedIdp" 

} 

Example:

PATCH /domains/contoso.com/federationConfiguration/2a8ce608-bb34-473f-9e0f-f373ee4cbc5a 

{ 

"federatedIdpMfaBehavior": "rejectMfaByFederatedIdp" 

PowerShell

Update-MgDomainFederationConfiguration -DomainId  -InternalDomainFederationId  federatedIdpMfaBehavior "rejectMfaByFederatedIdp" 

Example:

Update-MgDomainFederationConfiguration -DomainId “contoso.com” -InternalDomainFederationId “2a8ce608-bb34-473f-9e0f-f373ee4cbc5a” federatedIdpMfaBehavior "rejectMfaByFederatedIdp" 

Hardware Security Module [HSM]

In its default configuration, the keys AD FS uses to sign tokens never leave the federation servers on the intranet. They are never present in the DMZ or on the proxy machines. Optionally to provide more protection, we recommend protecting these keys in a hardware security module [HSM] attached to AD FS. Microsoft does not produce an HSM product, however there are several on the market that support AD FS. In order to implement this recommendation, follow the vendor guidance to create the X509 certs for signing and encryption, then use the AD FS installation PowerShell commandlets, specifying your custom certificates as follows:

Install-AdfsFarm -CertificateThumbprint  -DecryptionCertificateThumbprint  -FederationServiceName  -ServiceAccountCredential  -SigningCertificateThumbprint 

where:

  • CertificateThumbprint is your SSL certificate
  • SigningCertificateThumbprint is your signing certificate [with HSM protected key]
  • DecryptionCertificateThumbprint is your encryption certificate [with HSM protected key]

Feedback

Submit and view feedback for

Which area of focus do public facing servers workstations Wi Fi networks and personal devices fall under?

Which area of focus do public-facing servers, workstations, Wi-Fi networks, and personal devices fall under? Public-facing servers, workstations, Wi-Fi networks, and personal devices are all examples of entry points for possible attacks.

Which type of boundary network hosts resource servers for the public Internet?

DMZs are also known as perimeter networks or screened subnetworks. Any service provided to users on the public internet should be placed in the DMZ network. External-facing servers, resources and services are usually located there.

Which classification of attack type does packet sniffing fall under?

Packet sniffing and port scanning are passive attacks. Active attacks are when perpetrators attempt to compromise or affect the operations of a system in some way. For example, trying to brute-force the root password on a web server is considered an active attack.

Which of the following is an example of an active attack?

Examples of active attacks include man-in- the middle [MitM], impersonation, and session hijacking. An attack on the authentication protocol where the attacker transmits data to the claimant, Credential Service Provider [CSP], verifier, or Relying Party [RP].

Chủ Đề