<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>luzhao</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/luzhao1/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/luzhao1/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 04:12:03 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Demystify extranet lockout feature in AD FS 3.0</title>
      <link>https://docs.microsoft.com/archive/blogs/luzhao1/demystify-extranet-lockout-feature-in-ad-fs-3-0</link>
      <pubDate>Wed, 24 Jun 2015 11:24:00 GMT</pubDate>
      <dc:creator><![CDATA[Lu Zhao - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/luzhao1/2015/06/24/demystify-extranet-lockout-feature-in-ad-fs-3-0/</guid>
      <description><![CDATA[In AD FS 3.0 (Windows Server 2012 R2), we introduced a security feature called Extranet...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: x-small;">In AD FS 3.0 (Windows Server 2012 R2), we introduced a security feature called <strong>Extranet Lockout</strong>.&nbsp;With this feature, AD FS will "stop" authenticating&nbsp;the "malicious" user account&nbsp;from outside&nbsp;for a period of time.&nbsp;Please note that this feature only applies to <strong>username and password authentication</strong>.</span></p>
<p><span style="font-size: x-small;">There are several advantages of enabling Extranet Lockout feature in AD FS.&nbsp;First of all,&nbsp;it protects your user accounts from <strong>brute force attacks</strong> where an attacker tries to guess a user's password by&nbsp;continuously sending authentication requests.&nbsp;In this case, AD FS will lock out the malicious user account for extranet access. Second of&nbsp;all,&nbsp;it protects your user accounts from&nbsp;<strong>malicious account lockout</strong> where an attacker wants to lock out a user account by sending authentication requests with wrong passwords.&nbsp;In this case,&nbsp;although the user account will be locked out by AD FS for extranet access, the actual user account in AD is not locked out and the user can still access corporate resources within the organization. We call it soft-lockout as compared to actual AD account lockout.</span></p>
<p><span style="font-size: x-small;">As the name of this feature suggests, this feature only works for <strong>extranet scenario</strong> where the authentication requests come through the Web Application Proxy. This feature works independently from AD Lockout policy but you do need to consider a few things when it comes to configuring extranet lockout setting to make sure this feature work as intended which I will explain later.</span></p>
<p><span style="font-size: small;"><strong><span style="color: #cc3256;">HOW DOES IT WORK</span></strong></span></p>
<p><span style="color: #000000; font-size: x-small;">There are 3 settings in AD FS that you need to configure&nbsp;to enable&nbsp;this feature: </span></p>
<ul>
<li><span style="color: #000000; font-size: x-small;"><span style="font-family: courier new,courier;">EnableExtranetLockout</span>: set&nbsp;this Boolean value to be True if you want to enable Extranet Lockout.</span></li>
<li><span style="color: #000000; font-size: x-small;"><span style="font-family: courier new,courier;">ExtranetObservationWindow</span>: this determines for how long&nbsp;the user account will be soft-locked out. AD FS will start to perform username and password authentication again when the window is passed.&nbsp;AD FS uses&nbsp;the AD attribute <span style="font-family: courier new,courier;">badPasswordTime <span style="font-family: arial,helvetica,sans-serif;">as the reference for determining whether the&nbsp;extranet observation window has passed or not. The window has passed if <span style="font-family: courier new,courier;">current time</span> &gt;&nbsp;<span style="font-family: courier new,courier;">badPasswordTime</span> + <span style="font-family: courier new,courier;">ExtranetObservationWindow.&nbsp;</span></span></span></span></li>
<li><span style="color: #000000; font-size: x-small;"><span style="color: #000000;"><span style="font-family: courier new,courier;">ExtranetLockoutThreshold</span>: this defines the maximum number of bad password attempts. Once the threshold is reached, AD FS will immediately rejects the requests from extranet without attempting to contact the domain controller for authentication, no matter whether password is good or bad, until the extranet observation window is passed. This means the value of badPwdCount attribute of an&nbsp;AD account&nbsp;will not increase while the account is soft-locked out.</span></span></li>
</ul>
<p><span style="font-size: x-small;">An example of enabling Extranet Lockout feature with maximum of 15 number of bad password attempts and 30 mins soft-lockout duration is as follows:</span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: x-small;">Set-AdfsProperties -EnableExtranetLockout $true -ExtranetLockoutThreshold 15 -ExtranetObservationWindow (new-timespan -Minutes 30) </span></p>
<p><span style="color: #000000; font-size: x-small;">These settings apply to all domains that the AD FS service can authenticate. The way&nbsp;that it works is that when AD FS receives an authentication request, it will access Primary Domain Controller (PDC) through LDAP call and perform a lookup for the <span style="font-family: courier new,courier;">badPwdCount</span> attribute for the user on the PDC. If AD FS finds the value of <span style="font-family: courier new,courier;">badPwdCount</span> &gt;= <span style="font-family: courier new,courier;">ExtranetLockoutThreshold</span> setting and the time defined in the Extranet Observation Window has not passed yet, AD FS will reject the request immediately,&nbsp;which means no matter whether user enters good or bad password from extranet, the logon will fail because AD FS does not send credentials to AD. AD FS does not maintain any state&nbsp;with regard to&nbsp;<span style="font-family: courier new,courier;">badPwdCount</span> or locked out user account. AD FS uses AD for all state tracking. </span></p>
<p><span style="color: #cc3256; font-size: small;"><strong>WORK TOGETHER WITH AD LOCKOUT POLICY</strong></span></p>
<p><span style="font-size: x-small;">One of the areas that people get most confused about is how this feature works together with AD lockout policy. As I mentioned earlier, Extranet Lockout feature in AD FS works independently from AD lockout policy. However, you do need to make sure the settings for Extranet Lockout is properly configured such that it can serve its security purpose with AD lockout policy.</span></p>
<p><span style="font-size: x-small;">Let's take a look at AD lockout policy first. There are three settings regarding lockout policy in AD:</span></p>
<ul>
<li><span style="font-size: x-small;"><span style="font-family: courier new,courier;">Account Lockout Threshold</span>: this setting is similar to ExtranetLockoutThreshold setting in AD FS. It determines the number of failed logon attempts that will cause a user account to be locked out. In order to protect your user accounts from malicious account lockout attack, you want to set the value of <span style="font-family: courier new,courier;">ExtranetLockoutThreshold</span> in AD FS &lt; <span style="font-family: courier new,courier;">Account Lockout Threshold</span> value in AD</span></li>
<li><span style="font-size: x-small;"><span style="font-family: courier new,courier;">Account Lockout Duration</span>: this setting determines for how long a user account is locked out. This setting does not matter much in this conversation as Extranet Lockout&nbsp;should always happen before AD lockout happens if configured properly</span></li>
<li><span style="font-size: x-small;"><span style="font-family: courier new,courier;">Reset Account Lockout Counter After</span>: this setting determines how much time must elapse from&nbsp;user's last logon failure before <span style="font-family: courier new,courier;">badPwdCount</span> is reset to&nbsp;0.&nbsp;In order&nbsp;for&nbsp;Extranet Lockout feature in AD FS to work well with AD lockout policy, you want to make sure&nbsp;the value of <span style="font-family: courier new,courier;">ExtranetObservationWindow</span> in AD FS&gt; <span style="font-family: courier new,courier;">Reset Account Lockout Counter After</span> value in AD. We will use examples below to explain why.&nbsp;&nbsp;</span></li>
</ul>
<p><span style="color: #000000; font-size: small;"><span style="color: #cc3256;"><strong>SEE IT WORK IN ACTION</strong></span></span></p>
<p><span style="font-size: x-small;"><span style="color: #000000;">Let's take a look at two examples and see how <span style="font-family: courier new,courier;">badPwdCount</span> changes over time based on different settings and states. Let's assume in both&nbsp;examples&nbsp;</span><span style="color: #000000;"><span style="font-family: courier new,courier;">Account Lockout Threshold</span> = 4 and </span><span style="color: #000000;"><span style="font-family: courier new,courier;">ExtranetLockoutThreshold</span> = 2. The <span style="color: #ff0000;">red</span> arrow represents bad password attempt, the <span style="color: #008000;">green</span> arrow represents good password attempt. </span><span style="color: #000000;">In example #1, <span style="font-family: courier new,courier;">ExtranetObservationWindow</span> &gt; <span style="font-family: courier new,courier;">Reset Account Lockout Counter After</span>. In example #2, <span style="font-family: courier new,courier;">ExtranetObservationWindow</span>&nbsp;&lt; <span style="font-family: courier new,courier;">Reset Account Lockout Counter After</span>.&nbsp;</span></span></p>
<p><span style="font-size: x-small;"><strong><span style="color: #000000;">Example #1</span></strong></span></p>
<p><span style="color: #000000;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/73/5482.bpc1.JPG" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-73/5482.bpc1.JPG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/73/5482.bpc1.JPG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-73/5482.bpc1.JPG" alt="" border="0" /></a></span></p>
<p><strong><span style="color: #000000; font-size: xx-small;">Example #2</span></strong></p>
<p><span style="color: #000000;"><span style="color: #000000; font-size: xx-small;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/73/7206.bpc1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-73/7206.bpc1.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/73/7206.bpc1.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-73/7206.bpc1.png" alt="" border="0" /></a></span></span></p>
<p><span style="color: #000000; font-size: x-small;">As you can see from the above, there are two conditions when <span style="font-family: courier new,courier;">badPwdCount</span> will be reset to 0. One is when there is a successful logon. The other is when it is time to reset this counter as defined in&nbsp;<span style="font-family: courier new,courier;">Reset Account Lockout Counter After</span> setting. When <span style="font-family: courier new,courier;">Reset Account Lockout Counter After</span> &lt; <span style="font-family: courier new,courier;">ExtranetObservationWindow</span>,&nbsp;an account does not have any risk of being locked out&nbsp;by AD. However, if <span style="font-family: courier new,courier;">Reset Account Lockout Counter After </span>&gt; Extranet Observation Window, there is a chance that an account may be locked out&nbsp;by AD but in a "delayed fashion". It may take a while to get an account locked out by AD depending on your configuration as AD FS will only allow one bad password attempt during its observation window until <span style="font-family: courier new,courier;">badPwdCount</span> reaches <span style="font-family: courier new,courier;">Account Lockout Threshold</span>.</span></p>
<p><span style="font-size: small;"><strong><span style="color: #cc3256;">Audits</span></strong></span></p>
<p><span style="font-size: x-small;"><span style="color: #cc3256;"><span style="color: #000000;">When Extranet Lockout feature is in effect, there are three audits will be written. Those audits include information&nbsp;such as&nbsp;user account, client IP address, bad password count and last bad password attempt. </span></span></span></p>
<p><span style="font-family: courier new,courier; font-size: x-small;"><span style="color: #cc3256;"><span style="color: #000000;">Meesage ID 512: ExtranetLockoutAccountThrottledAudit</span></span></span></p>
<p><span style="font-size: x-small;"><span style="color: #cc3256;"><span style="color: #000000;">This audit is written when AD FS allows a login attempt after extranet observation window has passed.&nbsp;</span></span></span></p>
<p><span style="font-family: courier new,courier; font-size: x-small;"><span style="color: #cc3256;"><span style="color: #000000;">Message ID 515: ExtranetLockoutUserThrottleTransitionAudit</span></span></span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: x-small;"><span style="color: #cc3256;"><span style="color: #000000;">This audit is written when there is a successful login after extranet observation windows has passed.</span></span></span></p>
<p><span style="font-family: courier new,courier; font-size: x-small;"><span style="color: #cc3256;"><span style="color: #000000;">Message ID516: ExtranetLockoutAccountRestrictedAudit</span></span></span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: x-small;"><span style="color: #cc3256;"><span style="color: #000000;">This audit is written when AD FS receives a login attempt and&nbsp;the&nbsp;user account&nbsp;has been locked out. This will happen for the first time when the account is locked out or after the account is locked out and extranet observation window has not passed.</span></span></span></p>
<p><span style="font-size: small;"><strong><span style="color: #cc3256;">KNOWN ISSUE</span></strong></span></p>
<p><span style="font-size: x-small;"><span style="color: #000000;"><span style="color: #000000;">There is a known issue where the AD user account cannot authentication with AD FS because the <span class="text-base" style="font-family: courier new,courier;">badPwdCount</span> attribute is not replicated to the domain controller that ADFS is querying. See <a href="https://support.microsoft.com/en-us/kb/2971171">2971171</a> for&nbsp;more details. </span></span><span style="color: #000000;"><span style="color: #000000;">You can find&nbsp;all AD FS QFEs that&nbsp;have been released so far at <a href="https://technet.microsoft.com/en-us/library/mt126278.aspx">https://technet.microsoft.com/en-us/library/mt126278.aspx</a>.</span></span></span></p>
<p><span style="font-size: small;"><strong><span style="color: #cc3256;">TAKEAWAYS</span></strong></span></p>
<ul>
<li><span style="color: #000000; font-size: x-small;"><span style="color: #000000;">Extranet Lockout&nbsp;feature only works for <strong>extranet scenario</strong> where the authentication requests come through the Web Application Proxy</span></span></li>
<li><span style="color: #000000; font-size: x-small;"><span style="color: #000000;">Extranet Lockout feature only&nbsp;applies to&nbsp;username &amp; password authentication</span></span></li>
<li><span style="color: #000000; font-size: x-small;"><span style="color: #000000;">AD FS does not keep any track of <span style="font-family: courier new,courier;">badPwdCount</span> or users&nbsp;that are soft-locked out. AD FS uses AD for all state tracking</span></span></li>
<li><span style="color: #000000; font-size: x-small;">AD FS performs a lookup for the <span style="font-family: courier new,courier;">badPwdCount</span> attribute through LDAP call for the user on the PDC for every authentication attempt&nbsp; </span></li>
<li><span style="color: #000000; font-size: x-small;">AD FS will fail if it cannot access the PDC. We are looking into making an improvement for the next version of AD FS that will allow AD FS to fall back to local DC in case of failure</span></li>
<li><span style="color: #000000; font-size: x-small;">AD FS will allow authentication requests from extranet if <span style="font-family: courier new,courier;">badPwdCount</span> &lt; <span style="font-family: courier new,courier;">ExtranetLockoutThreshold&nbsp;</span></span></li>
<li><span style="color: #000000; font-size: x-small;">If <span style="font-family: courier new,courier;">badPwdCount</span> &gt;= <span style="font-family: courier new,courier;">ExtranetLockoutThreshold</span> AND <span style="font-family: courier new,courier;">badPasswordTime</span> + <span style="font-family: courier new,courier;">ExtranetObservationWindow</span> &lt; Current time, AD FS will reject authentication requests from extranet</span></li>
<li><span style="font-size: x-small;"><span style="color: #000000;"><span style="color: #000000;">To avoid malicious account lockout, you should make sure <span style="color: #000000;"><span style="color: #000000;"><span style="font-family: courier new,courier;">ExtranetLockoutThreshold &lt; </span><span style="color: #000000;"><span style="color: #000000;"><span style="font-family: courier new,courier;">Account Lockout Threshold&nbsp;</span>AND </span></span></span></span></span></span><span style="color: #000000; font-family: courier new,courier;"><span style="color: #000000;">ExtranetObservationWindow &gt; Reset Account Lockout Counter</span></span></span></li>
</ul>
<p><span style="font-size: x-small;">Hope you found this blog post useful. Feel free to post comments on this blog post to ask questions or leave feedback.</span></p>
<p><span style="font-size: x-small;">&nbsp;--Lu</span></p>]]></content:encoded>
    </item>
  </channel>
</rss>