<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="www.w3.org/2005/Atom" xmlns:sy="purl.org/rss/1.0/modules/syndication/" xmlns:dc="purl.org/dc/elements/1.1/" xmlns:content="purl.org/rss/1.0/modules/content/" xmlns:wfw="wellformedweb.org/CommentAPI/" xmlns:slash="purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Dubai Security Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/dubaisec/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/dubaisec/feed.xml</link>
    <description>Rafal Sosnowski Microsoft engineer blogging about security and PKI from sunny Dubai</description>
    <lastBuildDate>Wed, 05 Jun 2019 22:13:26 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Bitlocker Auto-unlock</title>
      <link>https://docs.microsoft.com/archive/blogs/dubaisec/bitlocker-auto-unlock</link>
      <pubDate>Wed, 11 Jul 2018 13:00:44 GMT</pubDate>
      <dc:creator><![CDATA[Rafal Sosnowski [MSTF]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/dubaisec/?p=3065</guid>
      <description><![CDATA[Hello Its Rafal Sosnowski from Dubai Microsoft Security PFE Team. I haven't posted much over the...]]></description>
      <content:encoded><![CDATA[<p>Hello <p>Its Rafal Sosnowski from Dubai <b>Microsoft Security PFE Team</b>. I haven't posted much over the past year so let’s roll. Today I want to explain Bitlocker protector called Auto-unlock.

<p><img width="378" height="186" title="" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/07/13.png" border="0">


<p>Auto-unlock feature allows a user to access the data and removable data drives without entering the password every time. It works only while OS drive is encrypted with Bitlocker.
<br>
<p>You can <strong>enable/disable Auto-unlock</strong> protector using:<p>Command line:<blockquote><p>Enable-BitLockerAutoUnlock<p>Disable-BitLockerAutoUnlock</p></blockquote><p>PowerShell:<blockquote><p>manage-bde -autounlock -enable D:<p>manage-bde -autounlock -disable D:</p></blockquote><p>When you enable Auto-unlock, <strong>another copy of Volume Master Key (VMK) gets created on the disk and is wrapped</strong> by this protector. <p>If we query status of the volume, Auto-unlock will be indicated by “<strong>External Key (Required for automatic unlock)</strong>”. It has the same structure as External Key (another protector which in fact might be placed on USB and loaded from there to unlock the drive – called USB startup key or USB Recovery Key). 

<p><img width="611" height="425" title="" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/07/23.png" border="0">
<br>
<p>That external key used for automatic unlock is stored in the registry of the Operating System. This explains why it requires Operating System drive to be encrypted (otherwise attacker could have offline access to these keys)<p><strong>Fixed data drives:</strong><p><em>HKLM\SYSTEM\CurrentControlSet\Control\FVEAutoUnlock\*</em> <p><strong>Removable drives:</strong><p><em>HKCU\Software\Microsoft\Windows\CurrentVersion\FveAutoUnlock\*</em><p>Keys are bound to specific user/computer, so we cannot copy them to another machine and allow access. Specifically, they are encrypted with DPAPI (Data Protection API) using the combination of user name and user password (or computer credentials). I believe there is additional entropy because I was not able to decrypt them using my DPAPI tools.<p><br><p>
<img width="673" height="350" title="" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/07/32.png" border="0"><p><br><p>Additionally Auto-unlock keys for fixed drives are stored in protected registry hive, so the only way to analyze them is to export them from the online registry editor and then take ownership of the key and modify ACLs.
<p><img width="690" height="266" title="" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/07/42.png" border="0"><p><br>

<p>If you want to disable BitLocker on C: drive – system will warn you that all drives that are using auto-unlock need to be decrypted:<p><img width="428" height="268" title="" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/07/51.png" border="0"><p>So, I recommend deleting these keys beforehand and adding another protector (password, smartcard certificate) so we are not left with Bitlocker Recovery Password only:<blockquote><p>Clear-BitLockerAutoUnlock.htm<p>manage-bde -autounlock -ClearAllKeys C:</p></blockquote><p>I hope it was informative.<p>Rafal]]></content:encoded>
    </item>
    <item>
      <title>TPM Owner Password</title>
      <link>https://docs.microsoft.com/archive/blogs/dubaisec/tpm-owner-password</link>
      <pubDate>Tue, 28 Feb 2017 23:55:40 GMT</pubDate>
      <dc:creator><![CDATA[Rafal Sosnowski [MSTF]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/dubaisec/?p=2835</guid>
      <description><![CDATA[Hello everyone. It’s Rafal Sosnowski from Microsoft Dubai Security PFE Team. Today we will focus on...]]></description>
      <content:encoded><![CDATA[<p align="justify">Hello everyone. It’s Rafal Sosnowski from Microsoft <b>Dubai Security PFE Team</b>. Today we will focus on TPM Owner Password – quite misunderstood secret that is usually linked to the Bitlocker.  <p align="justify">TPM (Trusted Platform Module) is a small chip on the motherboard (discrete TPM) or part of the CPU implementation (firmware TPM) where we can store secret information (private keys, virtual smartcards, Bitlocker keys etc.). TPM is also responsible for measuring integrity of the platform when used with Bitlocker, Measured Boot or Devide Health Attestation.  <p align="justify">To use TPM you need to enable it in the BIOS/UEFI. During this process, special <b>TPM Owner Password</b> gets generated. This password can be later used to reset TPM Lockout state. TPM can go into the lockout state when too many incorrect authorization attempts are made to get access to these secrets. For example, when user enters too many incorrect PINs when prompted by Bitlocker pre-boot authentication or by virtual smartcard.  <p align="justify">For older Operating Systems (Windows Vista/Windows 7) TPM had to be manually initialized from the tpm.msc (or from Bitlocker configuration wizard). During that process user had opportunity to save TPM Owner Password to a file.  <p align="justify">For never operating systems (Windows 8.1/10) TPM is auto-provisioned – that means TPM is automatically activated after OS installation and in case of failure in repetitive attempts during the OS lifetime (triggered by scheduled task). Windows uses the randomly-generated Lockout Auth to provision the TPM, then destroys the Lockout Auth without ever revealing it to the user. However, depending on the GPO settings shown below, TPM Owner Password can be stored additionally in the registry. This GPO is located under:  <p><em>Computer Configuration\Administrative Templates\System\Trusted Platform Module Services\</em>  <p>Configure the level of TPM owner authorization information available to the operating system  <p><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/03/clip_image0026.png" width="748" height="419">  <p>&nbsp; <p>When GPO is configured to store Full authentication data, TPM Owner password will be stored as “OwnerAuthFull” in the registry:  <p>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TPM\WMI\Admin  <p><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/03/clip_image0041.png" width="750" height="163">  <p>&nbsp; <p align="justify">When GPO is configured with option “Delegated” or “None” – TPM Owner Password will not be stored additionally in the registry during (auto)provisioning.  <p align="justify">Note: “LockoutHash” value has nothing to do with TPM Owner Password.  <p align="justify">As said before, TPM Owner Password can be useful when TPM got locked out and in some scenarios, it is important to store it in central and secure location for your computers.  <p align="justify">&nbsp; <p align="justify">There are 2 ways of doing this:  <p align="justify">1) <strong>MBAM Infrastructure</strong> – MBAM agent (Microsoft Bitlocker Administration and Monitoring) is capable of saving TPM Owner Password from the registry to the MBAM SQL Database. Of course this is for scenarios where we use Bitlocker on the machine and have MBAM infrastructure set up. This also assumes that:  <p align="justify">a. TPM Owner Password is stored as “Full” in the registry  <p align="justify">or  <p align="justify">b. MBAM agent is responsible for initializing and taking ownership of the TPM  <p align="justify">2) <strong>Active Directory</strong> – Windows Clients are capable of exporting TPM Owner Password to computer attributes in AD. This assumes that:  <p align="justify">a. Client has connectivity to AD during export  <p align="justify">b. GPO “Turn on TPM backup to Active Directory Domain Services” is enabled  <p align="justify">Note: In most cases when you install MBAM agent TPM is already initialized automatically by the system. You can disable this behavior via PowerShell cmdlet Disable-TpmAutoProvisioning, clear TPM and let MBAM take ownership of it. When MBAM agent initializes TPM, it will escrow TPM Owner PWD to the SQL Database and delete it from registry, despite of “OwnerAuthFull” value in the registry.  <p align="justify">&nbsp; <h3><font color="#0080c0">TPM Owner Password in AD</font></h3> <p>When you initialize TPM from tpm.msc or via Bitlocker wizard in Control Panel, process called tpminit.exe will communicate with TPM and initialize it. During this time, random TPM Owner Password gets generates by leveraging TPM RNG (Random Number Generator). </p> <p>&nbsp; <p>Now if the GPO “Turn on TPM backup to Active Directory Domain Services” is enabled, your TPM Owner password will be escrowed to one of the attributes in Active Directory:  <p><b>For Windows 7 </b> <p>TPM Owner password is stored in <b>msTPM-OwnerInformation</b> attribute of the Computer object.  <p><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/03/clip_image0062.png" width="463" height="335">  <p>&nbsp; <p><b>For Windows 8</b> and above:  <p>TPM Owner Password is stored in the <i>msTPM-OwnerInformation</i> attribute of the TPM object. This object is stored in the <b>TPM Devices </b>container located in the root of your domain.  <p>This attribute is back linked to the Computer object by using <i>msTPM-OwnerInformationForComputer</i> attribute.<i> </i> <p><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/03/clip_image008.png" width="471" height="334">  <p>&nbsp; <p><b>For Windows 10 1607</b> and above:  <p>TPM Owner Password is not stored in the AD at all. Even though you can configure GPO on previous operating system (Windows 8/Windows Server 2012 R2) “Turn on TPM backup to Active Directory Domain Services” or registry keys directly on the client machine:  <p>HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\TPM\ActiveDirectoryBackup = 1  <p>HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\TPM RequireActiveDirectoryBackup = 1  <p>Windows 10 1607 will ignore these values.  <p>&nbsp; <p>Another thing which is worth to mention that GPO  <p><em>Computer Configuration\Administrative Templates\System\Trusted Platform Module Services\Turn on TPM backup to Active Directory Domain Services</em>  <p>has been removed from ADMX templates in Windows 10 1607 and Windows Server 2016. Thus most of information provided in this article is for pre Windows 10 1607 editions.  <p>&nbsp; <h3><font color="#0080c0">TPM object and permissions</font></h3> <p>TPM Objects is unique for every machine and doesn’t change when you reinstall Operating system. This means when you rebuild/reinstall your machine you might encounter some issues while activating TPM.  <p>For example, very common error is <font color="#ff0000"><b>0x80070005</b> <b>E_ACCESSDENIED</b></font>  <p><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/03/clip_image0103.png" width="749" height="179">  <p><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/03/clip_image0121.png" width="532" height="417">  <p>&nbsp; <p>This error occurs because by default new Operating System (after reinstallation) cannot write TPM Owner Password to the old TPM object. Let’s have a look at the default permissions on msTPM-InformationObject:  <ol> <li>"Write all properties" for an SID: S-1-3-0 Creator Owner (original computer)  <li>"Read all properties" for "Domain Computers" (but no write)</li></ol> <p>&nbsp; <p>We can check this by going to the TPM object in “TPM Devices” container, select original computer (in our case TABLET) and check Special Permissions.  <p><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/03/clip_image014.png" width="641" height="509">  <p>&nbsp; <p>In order to fix this issue, you need to extend the schema by using LDF file published on the TechNet : “TPMSchemaExtensionACLChanges.ldf” which will change default TPM Object’s ACLs. Unfortunately, only new TPM Objects will be affected as we modify the AD schema but not the existing objects.  <p><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/03/clip_image01611.png" width="754" height="175">  <p>If you want to change ACLs of existing TPM objects you can just add "Write all properties" and "Read all properties" for "Domain Computers" to the specific or all msTPM-InformationObjects.  <p>&nbsp; <h3><font color="#0080c0">Using TPM Owner Password</font></h3> <p>If you want to change TPM Owner Password, you need to retrieve current password from the MBAM database or Active Directory and copy it to the XML file between <strong>&lt;ownerAuth&gt;</strong> and <strong>&lt;/ownerAuth&gt;</strong>. In example below, my TPM owner password is <font color="#ff0000">7O66EMj9LFFRhwfFsw+gVAIVkR8=</font>  <p><font color="#ff0000"></font>&nbsp; <p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;  <p>&lt;!--  <p>This page is a backup of TPM (Trusted Platform Module) owner authorization information. Upon request, use the authorization information to prove ownership of the computer's TPM. Please keep this file in a secure location away from your computer's local hard drive.  <p>--&gt;  <p>&lt;tpmOwnerData version="1.0" softwareAuthor="Microsoft Windows [Version 6.0.5461]" creationDate="2016-07-09T17:41:00-00:00" creationUser="contoso\user1" machineName="Laptop"&gt;  <p>&lt;tpmInfo manufacturerId="112233445566"/&gt;  <p><b>&lt;ownerAuth&gt;</b>7O66EMj9LFFRhwfFsw+gVAIVkR8=<b>&lt;/ownerAuth&gt;</b>  <p>&lt;/tpmOwnerData&gt;</p><p>&nbsp; <p>You don’t need to fill out all other details like computer or user name. TPM.msc will only validate password. So, it is fine if you use shorter syntax:  <blockquote> <p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;  <p><b>&lt;ownerAuth&gt;</b>7O66EMj9LFFRhwfFsw+gVAIVkR8=<b>&lt;/ownerAuth&gt;</b></p></blockquote> <p>&nbsp; <p>Save the file with .tpm extension and then go to the TPM.msc, select “Change Owner Password..”  <p><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/03/clip_image018.png" width="541" height="419">  <p>and then “I have the owner password file”.  <p><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/03/clip_image020.png" width="545" height="423">  <p>Once TPM.msc validates current password you will be able to generate new one.  <p>&nbsp; <h3><font color="#0080c0">Few tips:</font> </h3> <p>If you change TPM Owner password manually from tpm.msc this change will be reflected in AD if export is configured via GPO.  <p>If you apply GPO “Turn on TPM backup to Active Directory Domain Services” after TPM has been initialized, Owner Password will not be exported automatically. You will have to use scripts or manually change the password.  <p>Changing or entering TPM Owner Password have a tolerance of 1 failure. After that, option of using password will be locked for 24 hours. This is not the same as “TPM Lockout” which is part of TPM anti-hammering capability.  <p><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/03/clip_image0222.png" width="541" height="417">  <p>&nbsp; <p><strong>Remember:</strong> starting from Windows 10 1607 we dropped export of TPM Owner password to AD. This (change) is because TPM Owner Password could be retrieved from the registry in some scenarios and be used in offline attacks against TPM anti-hammering. Additionally, most lockouts of TPM come from Bitlocker thus you don’t even have access to tpm.msc to unlock your TPM. When TPM is completely locked by Bitlocker, you are stuck in preboot phase of Windows. So the workflow was not very convenient for both users and helpdesk people.  <p>As always I hope this was informative.  <p>Rafal]]></content:encoded>
    </item>
    <item>
      <title>Digest Authentication</title>
      <link>https://docs.microsoft.com/archive/blogs/dubaisec/digest-authentication</link>
      <pubDate>Tue, 31 Jan 2017 02:14:40 GMT</pubDate>
      <dc:creator><![CDATA[Rafal Sosnowski [MSTF]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/dubaisec/?p=2455</guid>
      <description><![CDATA[Hello again. It’s Rafal Sosnowski from Microsoft Dubai Security PFE Team. Today I will focus on...]]></description>
      <content:encoded><![CDATA[<p align="justify">Hello again. It’s Rafal Sosnowski from Microsoft <b>Dubai Security PFE Team</b>. Today I will focus on Digest Authentication.  <p align="justify">Digest Authentication is a challenge-response authentication protocol used to authenticate users over the network. Challenge/response protocols require an authenticating server to generate a challenge containing some amount of unpredictable data. A client then uses a key derived from the user’s password to encrypt the challenge and forms a response. The server, or a trusted service such as Active Directory, can verify that the user possesses the correct password by comparing the client’s encrypted response to a response generated by Domain Controller based on the credential associated with the user in Active Directory or by the server account database for local users. If the responses match, the user is authenticated.  <p align="justify">Digital authentication is very similar to NTLM protocol or basic authentication where a simple challenge-response paradigm is used. In the digest authentication mechanism, the client is presented with a nonce, a randomly generated value sent by the server to the client. The client proves knowledge of the password by computing a keyed hash over parameters sent by the server and parameters generated locally by the client.  <p align="justify">Once the server has validated the keyed hash by performing the same computation, it can authenticate itself to the client by computing another keyed hash and returning it to the client. Because the correct keyed hash results can only be created by someone who knows the password, the two parties are assured of the other knowing the password.  <p align="justify">The Digest Authentication protocol is designed for use with Hypertext Transfer Protocol (HTTP) and Simple Authentication Security Layer (SASL) exchanges.  <p align="justify">&nbsp; <h3 align="justify"><font color="#0080c0">HTTP example:</font></h3> <p align="justify">When you open the browser and attempt to connect to the website which requires Digest Authentication, your first connection which is anonymous (frame 58 below) will be refused. The server will send you the Challenge (frame 59) containing nonce, charset that can be used, information about algorithm and the realm name. Also, server signals that it supports channel binding by invoking the following 12 characters in the server nonce: "+Upgraded+v1"  <p align="justify">&nbsp; <p align="justify"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0017.png"><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0017_thumb.png" width="775" height="460"></a></p> <p align="justify">&nbsp;</p> <p align="justify">A valid response contains a checksum (by default, the MD5 checksum) of the username, the password, the given nonce value, the HTTP method, and the requested URI. In this way, the password is never sent in the clear.  <p align="justify">&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0037.jpg"><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0037_thumb.jpg" width="752" height="431"></a>  <p align="justify">&nbsp;</p> <p align="justify">In the response from the client we also can see cnonce - which is client nonce that contains 128 bits of entropy by using a random-number generator as well as a NC - nonce counter used for replay detection attacks.  <p align="justify">&nbsp; <p align="justify">Now the server needs to verify the challenge response. It will query the Domain Controller for a user password hash and compute the MD5 hash again on the user name, password hash and the nonce. This information will be encapsulated by the NRPC protocols while querying Domain Controller and will be using method netrLogonSamLogonEx. Once the computation is done, server will compare the result with the received challenge response from the client. If the keyed hash is the same – that means user is successfully authenticated. Note: server doesn’t have to have access to user cleat-text password.  <p align="justify">&nbsp; <p align="justify">Of course, your server should be configured to require Digest Authentication. For example default installation of Windows Server IIS role doesn’t contain Digest Authentication module. You should install it from the Server Manager first. Once it is installed you can go to the Authentication section in the IIS Management Console and enable it:  <p align="justify">&nbsp; <p align="justify"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0047.png"><img title="clip_image004[7]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image004[7]" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0047_thumb.png" width="773" height="150"></a></p> <p align="justify">&nbsp;</p> <p align="justify">If you don’t want to bother with UI, you can do it directly in web.config file by adding the section:  <p align="justify"><em>&lt;digestAuthentication enabled='true' /&gt;</em>  <p align="justify">The realm is set to the domain name of the server by default. This can be overridden at the server by configuration options. The user is prompted and has the chance to override the realm value sent by the server (that is, the user can enter a realm other than the one sent by the server).  <p align="justify">From now every request going to the digest.contoso.com will require authentication. User experience will be a little different for Internet Explorer and Edge:  <p align="justify">&nbsp; <h4 align="justify"><strong>Edge:</strong> </h4> <p align="justify"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0057.png"><img title="clip_image005[7]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image005[7]" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0057_thumb.png" width="543" height="361"></a></p> <p align="justify">&nbsp; <h4 align="justify"><strong>Internet Explorer:</strong> </h4> <p align="justify"><b><a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0067.png"><img title="clip_image006[7]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image006[7]" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0067_thumb.png" width="459" height="358"></a></b></p> <p align="justify"><strong></strong>&nbsp;</p><b></b> <h3 align="justify"><font color="#0080c0">SASL Example:</font></h3> <p align="justify">User opens the LDP.exe and perform a BIND to active directory with Digest Authentication.</p> <p align="justify">&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0077.png"><img title="clip_image007[7]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image007[7]" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0077_thumb.png" width="554" height="317"></a>  <p align="justify">&nbsp;</p> <p align="justify">First the user will initiate the connection without sending any credentials but with information that Digest Authentication should be used:  <p align="justify">&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0087.png"><img title="clip_image008[7]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image008[7]" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0087_thumb.png" width="727" height="353"></a>  <p align="justify">&nbsp;</p> <p align="justify">Server similarly to the HTTP example will send us challenge:  <p align="justify">&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0107.jpg"><img title="clip_image010[7]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image010[7]" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0107_thumb.jpg" width="754" height="350"></a>  <p align="justify">&nbsp;</p> <p align="justify">And then we need to answer to that challenge by sending our credentials with nonce and domain name to the server:  <p align="justify">&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0127.jpg"><img title="clip_image012[7]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image012[7]" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0127_thumb.jpg" width="750" height="497"></a>  <p align="justify">&nbsp;</p> <h3 align="justify"><font color="#0080c0">Logging:</font></h3> <p align="justify">Assuming proper auditing is configured we can expect following events in the Security Log: </p> <p align="justify"><b>Server side:</b> Event ID 4672  <p align="justify"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0137.png"><img title="clip_image013[7]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image013[7]" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0137_thumb.png" width="597" height="436"></a></p> <p align="justify">&nbsp;</p> <p align="justify"><b>Domain Controller side:</b>  <p align="justify">Success (Event ID 4776, error code 0x0):  <p align="justify"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0147.png"><img title="clip_image014[7]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image014[7]" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0147_thumb.png" width="639" height="256"></a></p> <p align="justify">&nbsp;</p> <p align="justify">Failure (Event ID 4776, error code 0xC000006A – bad user name or password)  <p align="justify"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0157.png"><img title="clip_image015[7]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image015[7]" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0157_thumb.png" width="633" height="247"></a></p> <p align="justify">&nbsp;</p> <p align="justify">There are some articles on the Internet that say if you want to use Digest Authentication you have to store your password in Active Directory by using reversible encryption.  <p align="justify">There are 2 settings for this:  <p align="justify">Global in the Domain Password Policy (GPO):  <p align="justify"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0167.png"><img title="clip_image016[7]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image016[7]" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0167_thumb.png" width="502" height="144"></a></p> <p align="justify">Or individually on the User account:  <p align="justify"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0177.png"><img title="clip_image017[7]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image017[7]" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0177_thumb.png" width="426" height="411"></a></p> <p align="justify">&nbsp;</p> <p align="justify">This configuration was required prior to Windows 2008 where IIS really required passwords in the clear text from Active Directory to verify the Challenge’s response from the client. However, since Advanced Digest Authentication has been introduced (now there is no differentiation) Web Server can use pre-computed MD5 Hashes of user credentials that are stored in AD.  <p align="justify"><strong>There are 29 variations of credentials</strong> stored as part of Suplemental-Credetntials attribute of user object in Active Directory:  <p align="justify">Below is an example of table with MD5 hash for credentials for user “u1” and password: “password”:  <p align="justify">1) u1:CONTOSO:password &gt;&gt; B57D463D9044A36BF3283CBEF5B76014  <p align="justify">2) u1:contoso:password &gt;&gt;EA3B92F0D84D212CC057E63A81E36244  <p align="justify">3) U1:CONTOSO:password &gt;&gt; A109619CE218D1DD95EA94A7D5BD466F  <p align="justify">&nbsp; <p align="justify"><a href="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0187.png"><img title="" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/02/clip_image0187_thumb.png" width="378" height="444"></a></p> <p align="justify">&nbsp;</p> <p align="justify">You can review the MD5 w-digest construction logic under: <a href="https://msdn.microsoft.com/en-us/library/cc245680.aspx">https://msdn.microsoft.com/en-us/library/cc245680.aspx</a>  <p align="justify">Kerberos and public key–based authentication offer stronger security guarantees both in terms of initial authentication and subsequent confidentiality and integrity of client/server traffic. The digest authentication mechanism can be used in environments where these stronger mechanisms are not available and can serve for interoperability purposes with multiple vendors, browsers, web servers, and directory services.]]></content:encoded>
    </item>
    <item>
      <title>Impersonation Level for MBAM</title>
      <link>https://docs.microsoft.com/archive/blogs/dubaisec/impersonation-level-for-mbam</link>
      <pubDate>Thu, 08 Dec 2016 11:18:06 GMT</pubDate>
      <dc:creator><![CDATA[Rafal Sosnowski [MSTF]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/dubaisec/?p=2155</guid>
      <description><![CDATA[Hello everyone. It’s Rafal Sosnowski from Microsoft Dubai Security PFE Team. Today, I am going to...]]></description>
      <content:encoded><![CDATA[<p align="justify">Hello everyone. It’s Rafal Sosnowski from Microsoft <b>Dubai Security PFE Team</b>. Today, I am going to solve one of the rare errors that can occur while implementing MBAM infrastructure.</p>
<p align="justify">My customer had a problem while accessing both MBAM websites: helpdesk portal and self-service portal. Opening any of them resulted in displaying only text version of the webpage without any graphical user interface:</p>
&nbsp;
<p align="justify"><img width="804" height="402" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/12/image226.png" border="0" /></p>
<p align="justify">(Sometimes entire webpage was not loading and showing HTTP error 500.)</p>
&nbsp;
<p align="justify">When we looked at the details in Fiddler and in Developers panel of Internet Explorer it appeared that all elements except index.html were getting <b>status code 500 – Internal Server Error.</b></p>
&nbsp;
<p align="justify"><strong></strong></p>
<p align="justify"><img width="758" height="287" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0031.png" border="0" /></p>
&nbsp;
<p align="justify"><b>HTTP status code 500</b> is very general (it means something on the server side went wrong but we don’t know yet what) so decided to install and enable “<b>Failed Request Tracing in IIS</b>” and then reproduced the error.</p>
&nbsp;
<p align="justify"><img width="445" height="261" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image005.png" border="0" /></p>
<p align="justify">Logs by default are stored in <b>%SystemDrive%\inetpub\logs\FailedReqLogFiles.</b></p>
&nbsp;
<p align="justify"><strong></strong></p>
<p align="justify">Our logs indicated clearly that there was a problem with impersonation of the account logging to the portal. (<strong><span style="color: #ff0000">0x80070542</span></strong>)</p>
<p align="justify"><img width="814" height="494" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/12/image227.png" border="0" /></p>
&nbsp;
<p align="justify">The problem was that customer applied GPO security hardening to their servers which removed IIS_IUSRS group from the “<b>Impersonate a client after authentication</b>” setting (internal name SeImpersonatePrivilege).</p>
<p align="justify">This policy setting determines which programs are allowed to impersonate a user or another specified account and act on behalf of the user. If this user right is required for this type of impersonation, an unauthorized user cannot cause a client to connect (for example, by remote procedure call (RPC) or named pipes) to a service that they have created to impersonate that client. (Such an action could elevate the unauthorized user's permissions to administrative or system levels.)</p>
<p align="justify">Impersonation is the ability of a thread to run in a security context that is different from the context of the process that owns the thread. Impersonation is designed to meet the security requirements of client/server applications. When running in a client's security context, a service "is" the client, to some degree. One of the service's threads uses an access token representing the client's credentials to obtain access to the objects to which the client has access. The primary reason for impersonation is to cause access checks to be performed against the client's identity. Using the client's identity for access checks can cause access to be either restricted or expanded, depending on what the client has permission to do.</p>
<p align="justify">Services that are started by the Service Control Manager have the built-in Service group added by default to their access tokens. COM servers that are started by the COM infrastructure and configured to run under a specific account also have the Service group added to their access tokens. As a result, these processes are assigned this user right when they are started.</p>
<p align="justify">IUSRS is a local, empty group that is populated automatically when IIS application pool starts. For example, all the build in AppPoolAccounts and custom accounts used to run the IIS application pools are added there when they start.</p>
&nbsp;
<p align="justify">Below you can see that my IIS_IUSRS group is empty</p>
<p align="justify"><img width="397" height="233" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0081.png" border="0" /></p>
&nbsp;
<p align="justify">but account used to run application pool “<i>contoso\mbam_iis</i>” has that group in its <b>Windows token</b>:</p>
&nbsp;
<p align="justify"><img width="444" height="566" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image0091.png" border="0" /></p>
&nbsp;
<p align="justify">Summary: In order to resolve the issue, add IIS_IUSRS group to “<b>Impersonate a client after authentication</b>” user right assignment.</p>
&nbsp;
<p align="justify"><img width="414" height="222" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/12/clip_image010.png" border="0" /></p>
&nbsp;
<p align="justify">And enjoy browsing fixed MBAM portals:</p>
<p align="justify"><img width="814" height="481" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/12/image228.png" border="0" /></p>
&nbsp;
<p align="justify">Rafal</p>]]></content:encoded>
    </item>
    <item>
      <title>EFS -  “Element not found” error</title>
      <link>https://docs.microsoft.com/archive/blogs/dubaisec/efs-element-not-found-error</link>
      <pubDate>Fri, 30 Sep 2016 23:19:25 GMT</pubDate>
      <dc:creator><![CDATA[Rafal Sosnowski [MSTF]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/dubaisec/?p=2065</guid>
      <description><![CDATA[Hello  It’s Rafal Sosnowski from Microsoft Dubai Security PFE Team. Today I will troubleshoot with...]]></description>
      <content:encoded><![CDATA[<p align="justify">Hello  <p align="justify">It’s Rafal Sosnowski from Microsoft <strong>Dubai Security PFE Team</strong>. Today I will troubleshoot with you one error related to EFS (Encrypting File System).  <p align="justify"><strong>EFS</strong> (Encrypting File System) is a component of the NTFS file system present in Windows starting from Windows 2000. EFS enables transparent encryption and decryption of files by using advanced, standard cryptographic algorithms. EFS uses hybrid cryptography: symmetric key is used to encrypt data; asymmetric key is used to protect the symmetric one. To take advantage of asymmetric cryptography EFS uses certificates: self-signed or issued by Certification Authority (CA). <p align="justify">To encrypt the file just right click on it, select Properties&gt; Advanced &gt; Encrypt contents to secure data <p align="justify">&nbsp; <p align="justify"><img title="" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/10/clip_image001.png" width="384" height="297"></p> <p align="justify">&nbsp; <p align="justify">On rare occasion when we try to encrypt file or folder, we might get an error “An error occurred applying attribute to the file: Element not found” <p align="justify">&nbsp; <p align="justify"><img title="" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/10/clip_image002.png" width="363" height="194"></p> <p align="justify">&nbsp; <h3 align="justify"><font color="#4f81bd">Troubleshooting:</font> </h3> <p align="justify">&nbsp;</p> <p align="justify">So let’s start with enabling verbose <b>EFS\Debug log</b> in Event Viewer. Go to the Eventvwr.msc and select Application and Services Logs &gt; Show Analytic and Debug Logs. This will add dozens of new and very interesting logs to your MMC, including EFS\debug log. <p align="justify">&nbsp; <p align="justify"><img title="" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/10/clip_image003.png" width="650" height="374"></p> <p align="justify">&nbsp; <p align="justify">Enable EFS\Debug log and try to encrypt file again to reproduce an error. <p align="justify">&nbsp; <p align="justify"><img title="" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/10/clip_image004.png" width="329" height="253"></p> <p align="justify">&nbsp; <p align="justify">Instantly in the log we will see repetitive errors: <p align="justify">event 277:&nbsp; try and locate the matching key based on cert hash <p align="justify">event 1:&nbsp; An API call failed at 2.93.&nbsp; Error code: <b>2148081668</b> <p align="justify"><b>2148081668</b> translates to - <b><font color="#ff0000">CRYPT_E_NOT_FOUND</font></b> <p align="justify"><strong><font color="#ff0000"></font></strong>&nbsp; <p align="justify">So at the first glance it looks like certificate or proper private key cannot be found. However, when we look at the personal store using command certmgr.msc we see that multiple EFS certificates are delivered from Certification Authority:  <p align="justify"><img title="clip_image005" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="clip_image005" src="https://msdnshared.blob.core.windows.net/media/2016/10/clip_image005.png" width="873" height="210"></p> <p align="justify">&nbsp; <p align="justify">Note: when you don’t see certificate delivered to the user personal store, you can take a look at “Failed Requests” container on the CA server to verify why the certificate request was denied: <p align="justify"><img title="clip_image006" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;margin: 0px;padding-right: 0px" border="0" alt="clip_image006" src="https://msdnshared.blob.core.windows.net/media/2016/10/clip_image006.png" width="938" height="119"></p> <p align="justify">&nbsp; <p align="justify">In our case certificate was successfully issued and delivered by the CA. Moreover we got more than one certificate because File Properties UI cannot find proper certificate and send additional requests to the CA. <p align="justify">&nbsp; <p align="justify">Now verify our certificate in the user store using command: <blockquote> <p align="justify">Certutil – verifystore -v -user my</p></blockquote> <p align="justify">Among the lines we see that certificate has been issued with next generation cryptographic provider called <b>Key Storage Provider </b>(KSP) and public/private key pair has been generated with <b>RSA</b> algorithm. The problem is that <u>EFS doesn’t support keys from KSP based on RSA.</u> <p align="justify"><u></u>&nbsp; <p align="justify">Provider = <b><font color="#ff0000">Microsoft Software Key Storage Provider</font></b> <p align="justify">ProviderType = 0 <p align="justify">Unique container name: a58f5c5c98486fdb30e11dee7877ce02_042a9558-f6ac-4d95-a6ab-6e99a8c2e2a7 <p align="justify"><b><font color="#ff0000">RSA</font></b> <p align="justify">UI Policy = 0 <p align="justify">CERT_KEY_PROV_INFO_PROP_ID(2): <p align="justify">Key Container = te-ContosoEFS-cc8788c8-f9bc-4ab1-a784-7266cb7cb673 <p align="justify">Unique container name: a58f5c5c98486fdb30e11dee7877ce02_042a9558-f6ac-4d95-a6ab-6e99a8c2e2a7 <p align="justify">Provider = Microsoft Software Key Storage Provider <p align="justify">ProviderType = 0 <p align="justify">Flags = 0 <p align="justify">KeySpec = 0 -- XCN_AT_NONE <p align="justify">&nbsp; <p align="justify">EFS will work with keys generated from KSP based on Diffie-Hellman Algorithm (ECDH): <p align="justify">&nbsp; <p align="justify">Provider = <b><font color="#00b050">Microsoft Software Key Storage Provider</font></b> <p align="justify">ProviderType = 0 <p align="justify">Unique container name: b0e837b6acbbb65ddf5142a288e107ef_042a9558-f6ac-4d95-a6ab-6e99a8c2e2a7 <p align="justify">ECDH_P521 <p align="justify"><b><font color="#00b050">ECDH</font></b> <p align="justify">UI Policy = 0 <p align="justify">CERT_KEY_PROV_INFO_PROP_ID(2): <p align="justify">Key Container = te-ContosoEFS-42d4a65d-e55f-411d-9f8e-a026bbbabcd3 <p align="justify">Unique container name: b0e837b6acbbb65ddf5142a288e107ef_042a9558-f6ac-4d95-a6ab-6e99a8c2e2a7 <p align="justify">Provider = Microsoft Software Key Storage Provider <p align="justify">ProviderType = 0 <p align="justify">Flags = 0 <p align="justify">KeySpec = 0 -- XCN_AT_NONE <p align="justify">&nbsp; <p align="justify">Also EFS will work fine with keys generated in legacy cryptographic providers (CSP) and using RSA algorithm. <p align="justify">&nbsp; <p align="justify">Provider = <b><font color="#00b050">Microsoft Strong Cryptographic Provider</font></b> <p align="justify">ProviderType = 1 <p align="justify">Simple container name: te-ContosoEFS-2adf345e-263e-490a-af3b-d1a86ce54018 <p align="justify"><b><font color="#00b050">RSA</font></b> <p align="justify">PP_KEYSTORAGE = 1 <p align="justify">CERT_KEY_PROV_INFO_PROP_ID(2): <p align="justify">Key Container = 4d85da42c5c12b17ccd2c4833db0e856_042a9558-f6ac-4d95-a6ab-6e99a8c2e2a7 <p align="justify">Simple container name: te-ContosoEFS-2adf345e-263e-490a-af3b-d1a86ce54018 <p align="justify">Provider = Microsoft Strong Cryptographic Provider <p align="justify">ProviderType = 1 <p align="justify">Flags = 0 <p align="justify">KeySpec = 1 -- AT_KEYEXCHANGE <p align="justify">&nbsp; <p align="justify">So where shall we configure proper cryptographic providers and algorithms for EFS? The answer is of course on the certificate template. Remember <strong>don’t select RSA while Key Storage Provider</strong> is your cryptography provider or you will face “<strong>Element not found</strong>” error. <p align="justify">&nbsp; <p align="justify"><img title="" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/10/image.png" width="412" height="565"></p> <p align="justify">&nbsp; <p align="justify">Hope this was informative for you and happy encrypting!]]></content:encoded>
    </item>
    <item>
      <title>TPM Lockout</title>
      <link>https://docs.microsoft.com/archive/blogs/dubaisec/tpm-lockout</link>
      <pubDate>Sun, 10 Jul 2016 02:47:52 GMT</pubDate>
      <dc:creator><![CDATA[Rafal Sosnowski [MSTF]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/dubaisec/?p=1995</guid>
      <description><![CDATA[Hello everyone. It’s Rafal Sosnowski from Microsoft Dubai Security PFE Team. Today, I am going to...]]></description>
      <content:encoded><![CDATA[<p align="justify">Hello everyone. It’s Rafal Sosnowski from Microsoft <b>Dubai Security PFE Team</b>. Today, I am going to talk about TPM Lockout state.</p>
<p align="justify">TPM (<b>Trusted Platform Module</b>) is a small chip on the motherboard <b>(discrete TPM)</b> or part of the CPU implementation <b>(firmware TPM) </b>which can be used to securely store small amount of information (certificates, private keys, virtual smartcards, Bitlocker keys etc.). That data is completely isolated from HDD and partially from OS thus giving it maximum protection.</p>
<p align="justify">To get access to that information from OS level user has to present some kind of authorization value. For example, <b>Bitlocker PIN</b> to get access to the Bitlocker Keys, <b>Virtual smart-card PIN</b> to get access to the certificates and private keys etc.</p>
&nbsp;
<p align="justify">However, <b>TPM</b> has special anti-hammering logic which prevents malicious user from guessing that authorization data indefinitely. Number of possible PIN failures varies across TPM specification:</p>

<ul>
 	<li>
<div align="justify"><b>For TPM 1.2</b> – each vendor has different lockout logic, even different TPM models from the same vendor might have different numbers implemented.</div></li>
 	<li>
<div align="justify"><b>For TPM 2.0</b> – specification created by TCG (Trusted Computing Group), clearly states that maximum number of failed attempts should be defined, after which TPM gets locked out. Microsoft defines that maximum number of failed attempts in Windows is 32 and every single attempt is forgotten after 2 hours. This is configured by the Operating System at the time of taking ownership of the TPM</div></li>
</ul>
&nbsp;
<p align="justify">Assuming you failed 32 times to enter correct Bitlocker PIN you will see message saying "Too many PIN entry attempts":</p>
<p align="justify"><img width="750" height="481" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/07/clip_image0023.jpg" border="0" /></p>
&nbsp;
<p align="justify">TPM can be locked out by any application / software component that uses <b>keys stored in the TPM</b> and protected by PIN/password. For example, we can produce secure data-blobs, encrypted by the <b>keys generated in the TPM</b>. Access to these keys depending on administrator’s configuration will require or request a PIN:</p>
<p align="justify"><img width="426" height="298" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/07/clip_image0032.png" border="0" /></p>
&nbsp;
<p align="justify">Other example is <b>use of Virtual Smartcards</b>, where certificate alongside with private key is stored in the TPM. <b>Starting from Windows 8.1 ,</b> Virtual Smartcards have their own lockout logic, where <b>user has only 5 possible tries</b>. Still, each attempt will increment the TPM counter by 1, but it is less possible that TPM gets locked out.</p>
<p align="justify"><img width="429" height="327" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/07/clip_image0044.png" border="0" /></p>
&nbsp;
<p align="justify">If your TPM got locked out, it means it will not accept any authorization data, even if it’s correct (correct PIN).</p>
<p align="justify"><b>Now you have 4 solutions:</b></p>
<p align="justify">1) Unlock the TPM using the TPM.msc and TPM Owner Password.</p>
<p align="justify">2) Wait some time and enter correct PIN (TPM 2.0 will forget 1 attempt every 2 hours)</p>
<p align="justify">3) Wait x hours to completely reset TPM lockout counter (for TPM 2.0: 64 hours)</p>
<p align="justify">4) Clear TPM (that means all your data stored in TPM will be lost)</p>
&nbsp;
<p align="justify">If your TPM is locked, you will see its status in the “<b>tpm.msc”</b> as "TPM is locked out" or “Ready for use with limited functionality”. The second status can appear on virtual TPMs and few hardware TPMs which is a glitch.</p>
<p align="justify"><img width="650" height="294" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/07/clip_image0052.png" border="0" /></p>
&nbsp;
<p align="justify">Note: “<b>Ready for use with limited functionality</b>” might also mean that TPM has been initialized by the previous operating system. So it is always better to check the status using PowerShell:</p>

<blockquote>
<p align="justify">Get-TPM</p>
</blockquote>
<p align="justify"><img width="282" height="221" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/07/clip_image0061.png" border="0" /></p>
<p align="justify">Since Windows 10 (1511) we have added also lockout counters (for TPM 2.0) shown in above screenshot.</p>
&nbsp;
<p align="justify">To unlock the TPM from <b>tpm.msc</b> you need to be an administrator of the machine and be in possession of the TPM Owner Password. We will talk about TPM Owner Password in details in one of the future posts.</p>
&nbsp;
<p align="justify">Of course this method will not work when TPM is locked out by Bitlocker PIN (before you get into the Windows). For Bitlocker related lockouts you need to wait as there is no working workflow to unlock the TPM in this scenario, except using other protector, for instance 48-digit Recovery Password to get into Windows.</p>
&nbsp;
<p align="justify">Some of you probably have already noticed <b>3 new GPO policies</b> (added in Windows 8) that supposed to <b>influence the TPM build-in anti-hammering logic</b> by introducing some kind of software layer that would accumulate failed PIN attempts before forcing TPM into hardware lockout. Idea is to reduce number of true, hardware lockouts. However, according to my tests these policies don’t work on any of the tested systems (Win8, Win8.1, Win10) so I am trying to get confirmation from our developers what’s going on. Once I get some information I will update this post.</p>
&nbsp;
<p align="justify">GPO I am talking about can be located in:</p>
<p align="justify"><b>Computer Configuration\Administrative Templates\System\Trusted Platform Module Services\</b></p>
<p align="justify">Standard User Individual Lockout Threshold (default: 4)</p>
<p align="justify">Standard User Total Lockout Threshold (default: 9)</p>
<p align="justify">Standard User Lockout Duration (default 8 hours)</p>
&nbsp;
<p align="justify">Hope this post was informative for you and I wish you good day.</p>]]></content:encoded>
    </item>
    <item>
      <title>MBAM version chart</title>
      <link>https://docs.microsoft.com/archive/blogs/dubaisec/mbam-version-chart</link>
      <pubDate>Mon, 23 May 2016 02:00:04 GMT</pubDate>
      <dc:creator><![CDATA[Rafal Sosnowski [MSTF]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/dubaisec/?p=1936</guid>
      <description><![CDATA[Hello
Its Rafal Sosnowski from Microsoft Dubai Security PFE Team. Some time ago I put together all...]]></description>
      <content:encoded><![CDATA[<p align="justify">Hello</p>
<p align="justify">Its Rafal Sosnowski from Microsoft <b>Dubai Security PFE Team</b>. Some time ago I put together all versions of MBAM (Microsoft Bitlocker Administration and Monitoring) tool into one table. Small disclaimer: It is based on what I have seen in the wild and is not official information from Product Group.</p>
&nbsp;
<div align="justify">
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="117" valign="top"><b>Version</b></td>
<td width="526" valign="top"><b>Product</b></td>
</tr>
<tr>
<td width="117" valign="top">1.0.1237.1</td>
<td width="526" valign="top">MBAM 1.0</td>
</tr>
<tr>
<td width="117" valign="top">1.0.2001.1</td>
<td width="526" valign="top">MBAM 1.0 R1</td>
</tr>
<tr>
<td width="117" valign="top">1.0.2010.1</td>
<td width="526" valign="top">MBAM 1.0 R1 with hotfix (KB2724074 for client)</td>
</tr>
<tr>
<td width="117" valign="top">2.0.5301.1</td>
<td width="526" valign="top">MBAM 2.0</td>
</tr>
<tr>
<td width="117" valign="top">2.1.117.0</td>
<td width="526" valign="top">MBAM 2.0 SP1</td>
</tr>
<tr>
<td width="117" valign="top">2.5.244.0</td>
<td width="526" valign="top">MBAM 2.5</td>
</tr>
<tr>
<td width="117" valign="top">2.5.252.0</td>
<td width="526" valign="top">MBAM 2.5 with Hotfix Package 1 (KB2975636 for client)</td>
</tr>
<tr>
<td width="117" valign="top">2.5.380.0</td>
<td width="526" valign="top">MBAM 2.5 with Hotfix Package 2 (KB3015477 for client)</td>
</tr>
<tr>
<td width="117" valign="top">2.5.1100.0</td>
<td width="526" valign="top">MBAM 2.5 SP1</td>
</tr>
<tr>
<td width="117" valign="top">2.5.1119.0</td>
<td width="526" valign="top">MBAM 2.5 SP1 with Hotfix Package 1 (KB3122998 for server)</td>
</tr>
<tr>
<td width="117" valign="top">2.5.1125.0</td>
<td width="526" valign="top">MBAM 2.5 SP1 with September 2016 package (KB3168628 for client and server)</td>
</tr>
<tr>
<td width="117" valign="top">2.5.1126.0</td>
<td width="526" valign="top">MBAM 2.5 SP1 with December 2016 package (KB3198158 for client and server)</td>
</tr>
<tr>
<td width="117" valign="top">2.5.1133.0</td>
<td width="526" valign="top">MBAM 2.5 SP1 with March 2017 package (KB4014009 for client and server)</td>
</tr>
<tr>
<td width="117" valign="top">2.5.1134.0</td>
<td width="526" valign="top">MBAM 2.5 SP1 with June 2017 package (KB4018510 for client and server)</td>
</tr>
<tr>
<td width="117" valign="top">2.5.1135.0</td>
<td width="526" valign="top">MBAM 2.5 SP1 with September 2017 package (KB4041137 for client and server)</td>
</tr>
<tr>
<td width="117" valign="top">2.5.1143.0</td>
<td width="526" valign="top">MBAM 2.5 SP1 with July 2018 package (KB4340040 for client and server)</td>
</tr>
<tr>
<td width="117" valign="top">2.5.1147.0</td>
<td width="526" valign="top">MBAM 2.5 SP1 with May 2019 package (KB4505175 for client)</td>
</tr>
</tbody>
</table>
</div>
&nbsp;
<p align="justify">As you can see in above table, some of the version numbers will apply only <b>to client side binaries</b>, some of them only to <b>server side binaries</b>. So it is fine to have client and server components on different version levels (within one major release: 1.0; 2.0; 2.5).</p>
<p align="justify">Also <b>older clients</b> (like MBAM 1.0)<b> can still talk to the latest MBAM server</b> (like MBAM 2.5 SP1) however we always suggest to upgrade both client and server side and keep them on most recent version.</p>
&nbsp;
<h3 align="justify"><span style="color: #0080c0">Version check:</span></h3>
<p align="justify">If you want to check what is the <b>current version of MBAM server</b> side components navigate to the registry:</p>
<p align="justify"><i>MBAM 2.5:</i></p>
<p align="left"><i>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MBAM Server</i></p>
<p align="left"><i>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MBAM Server\Version</i></p>
&nbsp;
<p align="justify"><i>MBAM 2.0:</i></p>
<p align="left"><i>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft BitLocker Administration And Monitoring\Setup</i></p>
<p align="justify"><img width="657" height="136" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/05/clip_image00115.png" border="0" /></p>
&nbsp;
<p align="justify">If you want to check what is the <b>current version of MBAM agent</b> navigate to the registry:</p>
<p align="left"><i>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MBAM</i></p>
<p align="justify"><img width="881" height="125" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/05/clip_image00218.png" border="0" /></p>
&nbsp;
<p align="justify">Or go directly to the filesystem and check properties of the agent service’s file which resides by default in:</p>
<p align="left"><i>C:\Program Files\Microsoft\MDOP MBAM</i></p>
<p align="justify"><img width="523" height="368" title="" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" alt="" src="https://msdnshared.blob.core.windows.net/media/2016/05/clip_image0037.png" border="0" /></p>
&nbsp;
<p align="justify">I hope this quick post was informative and if you have any MBAM version not listed here, please let me know and I will add it to the table.</p>]]></content:encoded>
    </item>
    <item>
      <title>ELAM Driver</title>
      <link>https://docs.microsoft.com/archive/blogs/dubaisec/elam-driver</link>
      <pubDate>Mon, 09 May 2016 23:50:02 GMT</pubDate>
      <dc:creator><![CDATA[Rafal Sosnowski [MSTF]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/dubaisec/?p=1907</guid>
      <description><![CDATA[Hello again. It’s Rafal Sosnowski from Microsoft Dubai Security PFE Team and today I will be...]]></description>
      <content:encoded><![CDATA[<p align="justify">Hello again. It’s Rafal Sosnowski from Microsoft <b>Dubai Security PFE Team</b> and today I will be explaining what is the ELAM driver.</p>
<p align="justify">ELAM – <b>Early Launch Anti-Malware</b> is a piece of code that is loaded in the pre-boot environment and is responsible for verification of other drivers before they are loaded into memory. ELAM driver is being called by the Kernel and it reports the status of the driver images: if they are safe or unsafe to load. ELAM driver has been introduced in Windows 8 and is not dependent on UEFI nor BIOS implementation.</p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="" src="https://msdnshared.blob.core.windows.net/media/2016/05/clip_image00213.jpg" alt="" width="752" height="442" border="0" /></p>
<p align="justify">The early launch AM drivers are started soon after the NTOS kernel starts.  For each subsequent boot driver, the AM driver receives a callback from the Kernel Plug and Play manager to determine whether the boot driver should be initialized.  The AM driver evaluates the boot driver and must return good, bad, or unknown status of the driver.  Based on the returned <b>classification</b> and <b>defined policy,</b> the PnP manager decides whether to initialize the boot driver.</p>

<h2 align="justify"><span style="color: #0080c0">Classification:</span></h2>
<p align="justify">ELAM driver can return status of the boot driver as good, bad, or unknown. This image evaluation is <b>based on the malware signature data</b> stored under: <b>HKLM\ELAM\&lt;VendorName&gt;\.</b> This registry hive is loaded by the winload.exe process at the same time as ELAM driver</p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="clip_image003" src="https://msdnshared.blob.core.windows.net/media/2016/05/clip_image003.png" alt="clip_image003" width="671" height="161" border="0" /></p>
<p align="justify">Within the key, the vendor will keep blacklists and/or whitelists of the drivers’ images and virus signatures. So far, ELAM cannot detect malware based on the heuristics or malware that has ability to polymorph so it relies on the image hashes and virus signatures.</p>
<p align="justify"><strong>Each ISV is responsible for updating and verifying its malware signature data</strong> for its ELAM driver. When the AM driver is initialized, it should verify the integrity of the malware signature data by validating a digital signature.</p>
<p align="justify">The ELAM hive is unloaded after its use by Early Launch Antimalware for performance reasons. If a user mode Antivirus service wants to update the signature data, it should mount the hive file from the c:\Windows\System32\config\ELAM. The storage and retrieval format of these data BLOBs is left up to the Antivirus Vendor, but the signature data must be signed so that the AM driver can verify the integrity of the data.</p>

<h2 align="justify"><span style="color: #0080c0">Defined Policy</span></h2>
<p align="justify">When the status of the drivers is returned (good, bad, unknown), system will decide whether load particular driver or not, based on the policy stored in:</p>
<p align="justify"><em>HKLM\SYSTEM\CurrentControlSet\Policies\EarlyLaunch\ DriverLoadPolicy</em></p>
<p align="justify">This Policy can be defined manually or via GPO under:</p>
<p align="justify"><b>Computer Configuration \ Administrative Templates\ System \ Early Launch Antimalware\ Boot-Start Driver Initialization Policy</b></p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="" src="https://msdnshared.blob.core.windows.net/media/2016/05/clip_image0054.jpg" alt="" width="752" height="407" border="0" /></p>
<p align="justify">If the policy is not configured or disabled the boot drivers determined to be <b>Good, Unknown or Bad but Critical</b> are initialized and the drivers determined to be Bad are skipped.</p>
<p align="justify">Driver is marked as <b>critical</b> if internal routine of ELAM driver determines that blocking this particular driver would cause system to halt / bluescreen.</p>
<p align="justify">An image is treated as <b>unknown</b> when an error is returned from the initialize image callback or when the signature data doesn’t exist in the registry.</p>
<p align="justify">After classification of drivers has been finished and malicious drivers were blocked,<b> </b>the ELAM driver will unload. Anti-Malware engine should be started prior to the early launch AM driver being unloaded. <b>This means that the runtime AM engine should be a boot driver that is verified by the early launch AM driver</b> not a user mode process.</p>
&nbsp;
<h2 align="justify"><span style="color: #0080c0">Default Windows ELAM driver:</span></h2>
<p align="justify">By default, ELAM driver is provided by Windows Defender and is registered as <b>WdBoot.sys</b> driver. You can find it in %systemroot%\system32\drivers folder.</p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="" src="https://msdnshared.blob.core.windows.net/media/2016/05/clip_image0074.jpg" alt="" width="751" height="228" border="0" /></p>
&nbsp;
<h2 align="justify"><span style="color: #0080c0">3<sup>rd</sup>party ELAM drivers:</span></h2>
<p align="justify">Microsoft requires that Early Launch Antimalware vendors be members of the Microsoft Virus Initiative (MVI). This membership ensures that the vendors are active antimalware community participants with a positive industry reputation and participate in antimalware initiatives.</p>
<p align="justify">For example, if we install <b>Symantec</b> Antivirus, it will register its own ELAM drive called <b>SymELAM.sys</b>:</p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="" src="https://msdnshared.blob.core.windows.net/media/2016/05/clip_image0081.png" alt="" width="712" height="171" border="0" /></p>
<p align="justify">If you want to register your own ELAM driver for testing purposes, use command:</p>

<blockquote>sc create Elam-Test binpath=%windir%\\system32\\drivers\\TEST-ELAM.sys type=kernel start=boot error=critical group=Early-Launch</blockquote>
<h2 align="justify"><span style="color: #0080c0">ELAM driver signing:</span></h2>
<p align="justify">Every ELAM driver has to be signed by Microsoft Code-signing certificate. This certificate has to have special <strong>EKU</strong> (Extended Key Usage) indicating Early Launch Anti-Malware driver. If the ELAM driver is not signed with such certificate it will fail to load.</p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="" src="https://msdnshared.blob.core.windows.net/media/2016/05/clip_image0091.png" alt="" width="466" height="390" border="0" /></p>
&nbsp;
<p align="justify">Winload checks the signatures of all boot drivers as they are loaded into memory. On 64-bit platforms all boot drivers must have valid signatures, their certificates must chain to a trusted root CA, and their certificates must contain the Codesigning enhanced key usage (EKU) extension. Signing is not required on 32-bit platforms. ELAM drivers are special in that they must be signed by Microsoft, and their signing certificates must also contain a special EKU indicating that it is an ELAM Driver (OID: 1.3.6.1.4.1.311.61.4.1). This is true for both 32-bit and 64-bit platforms.</p>
&nbsp;
<h2 align="justify"><span style="color: #0080c0">Additional considerations:</span></h2>
&nbsp;
<h4 align="justify"><b>Backup Driver Installation</b></h4>
<p align="justify">To provide a recovery mechanism in the event that the ELAM driver is inadvertently corrupted, the ELAM installer also installs a copy of the driver in a backup location. This will allow WinRE to retrieve the clean copy and recover the installation.</p>
<p align="justify">The installer reads the backup file location from the BackupPath key stored in</p>
<p align="justify">HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\EarlyLaunch\BackupPath</p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="" src="https://msdnshared.blob.core.windows.net/media/2016/05/clip_image0113.jpg" alt="" width="751" height="119" border="0" /></p>
&nbsp;
<h4 align="justify"><b>Disabling ELAM:</b></h4>
<p align="justify">Like Secure Boot, ELAM driver can be disabled by the owner of the platform. User can restart the machine and put it into Advanced Restart mode. Just restart your PC using combination of “Shift + Power &gt; Restart” or execute:</p>

<blockquote>
<p align="justify">Shutdown /r /o /t 0</p>
</blockquote>
<p align="justify">and follow the menu path: Troubleshoot &gt; Advanced Options &gt; start up Settings &gt; Restart</p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="" src="https://msdnshared.blob.core.windows.net/media/2016/05/clip_image012.png" alt="" width="409" height="413" border="0" /></p>
&nbsp;
<p align="justify">On next screen you can choose Disable early launch anti-malware protection:</p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="" src="https://msdnshared.blob.core.windows.net/media/2016/05/clip_image0131.png" alt="" width="498" height="445" border="0" /></p>
&nbsp;
<p align="justify">This has been implemented to remediate situations where ELAM blocks some important driver which prevent machine from botting. In this case you can disable ELAM, remove problematic driver and boot your PC normally. The <strong>next time you reboot your computer, Early Launch Anti-Malware Protection will automatically start again and continue protecting your computer</strong>. To remove the ELAM driver permanently you would have to unregister it from the system.</p>
<p align="justify">So to summarize: ELAM has antimalware capabilities and can block drivers from being loaded into memory before they are initialized. <strong>ELAM is part of the Microsoft Trusted Boot standard and can mark your drivers with status: good, bad or unknown and then allow or prevent from loading</strong>. ELAM can be disabled by the user that has physical access to the computer.</p>]]></content:encoded>
    </item>
    <item>
      <title>Special Groups Audit</title>
      <link>https://docs.microsoft.com/archive/blogs/dubaisec/special-groups</link>
      <pubDate>Tue, 19 Apr 2016 12:23:56 GMT</pubDate>
      <dc:creator><![CDATA[Rafal Sosnowski [MSTF]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/dubaisec/?p=1816</guid>
      <description><![CDATA[Hello
It's Rafal Sosnowski from Microsoft Dubai  Security PFE Team. Today I want to talk about...]]></description>
      <content:encoded><![CDATA[<p align="justify">Hello</p>
<p align="justify">It's Rafal Sosnowski from Microsoft <b>Dubai  Security PFE Team</b>. Today I want to talk about Special Groups – feature added back in Windows 2008/Vista but not rarely used by administrators. <b>Special Groups</b> feature lets you audit all logons of the user that belongs to certain group so called “Special Group”.</p>
<p align="justify">This is quite useful in environments where we want to be notified every time high privilege account logon to set of computers (for example Domain Admins somehow log on to servers or workstations). We generally recommend against using high privileged accounts on workstations and servers.</p>
<p align="justify">This feature assumes that you met two conditions: your user is part of the group you monitor and Audit Special Logon is enabled in Advanced Auditing.</p>
<p align="justify"></p> &nbsp;
<p align="justify">To enable Special Groups feature:</p>

<h4 align="justify"><span style="color: #0080c0"><b>1. </b><b>Obtain SID of the group you want to monitor:</b></span></h4>
<p align="justify">We can do it using different methods for example PowerShell:</p>

<blockquote>
<p align="justify">Get-ADGroup “name of your group”</p>
</blockquote>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-width: 0px" title="clip_image001" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image00114.png" alt="clip_image001" width="533" height="193" border="0" /></p>
<p align="justify"></p>
&nbsp;
<p align="justify">Or older combination of dsquery and dsget commands:</p>

<blockquote>
<p align="justify">Dsquery group -name “name of your group” | dsget group -sid</p>
</blockquote>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-width: 0px" title="clip_image002" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0029.png" alt="clip_image002" width="471" height="83" border="0" /></p>
<p align="justify">BTW: If you want to obtain SID of local user to group, you might execute:</p>

<blockquote>
<p align="justify">wmic useraccount where name="administrator" get sid</p>
<p align="justify">wmic group where name="administrators" get sid</p>
</blockquote>
<p align="justify">However, users SIDs (nor local, neither domain) cannot be used. This feature works only with group SIDs.</p>
<p align="justify"></p>
&nbsp;
<h4 align="justify"><span style="color: #0080c0"><b>2. </b><b>Add SID of the Group to the registry</b></span></h4>
<p align="justify">You need to add SID of the group you want to monitor to the registry by adding new String value (REG_SZ) under:</p>
<p align="justify"><i>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\Audit</i></p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-width: 0px" title="clip_image003" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0037.png" alt="clip_image003" width="712" height="92" border="0" /></p>
<p align="justify"></p>
&nbsp;
<p align="justify">This string value should be named <strong>SpecialGroups</strong> and include the <strong>SID</strong> of the group. If you want to add multiple groups you can separate them using a semicolon character (;). Below I have used Group Policy Preferences to deploy this to all Desktops/Servers but you can deploy it using startup script or SCCM\MDM.</p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-width: 0px" title="clip_image004" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0048.png" alt="clip_image004" width="807" height="168" border="0" /></p>
<p align="justify"></p>
&nbsp;
<p align="justify">Action type should be “Create” if value doesn’t exist or “Update” if value already exist:</p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-width: 0px" title="clip_image005" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0055.png" alt="clip_image005" width="411" height="463" border="0" /></p>
<p align="justify"></p>
&nbsp;
<h4 align="justify"><span style="color: #0080c0"><b>3. </b><b>Enable “Audit Special Logon” </b></span></h4>
<p align="justify">In group Policy editor go to the Advanced Security Audit Policy Settings and configure Logon-Logoff\Special Logon subcategory to Success or Success and Failure. You can verify it using auditpol command:</p>

<blockquote>
<p align="justify">Auditpol /get /category:”Logon/Logoff”</p>
</blockquote>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-width: 0px" title="clip_image006" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image00610.png" alt="clip_image006" width="518" height="244" border="0" /></p>
&nbsp;
<p align="justify"></p>
<p align="justify">From now all logon types: network, local, via RDP will be audited and event ID <b>4964</b> will be noted:</p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-width: 0px" title="clip_image007" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0074.png" alt="clip_image007" width="830" height="435" border="0" /></p>
<p align="justify"></p>
&nbsp;
<p align="justify">In most cases customers will be interested in monitoring high privileged groups like “Domain Admins” or “Enterprise Admins” as well as local group “Administrators”.</p>
&nbsp;
<p align="justify">If you <b>add SID of local administrators</b> group <b>S-1-5-32-544</b> to the registry and logon with local account, the event will be audited. However, if you use domain user account which is part of the local Administrators group– the event will not be audited.</p>
<p align="justify"></p>
<p align="justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" title="clip_image008" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0087.png" alt="clip_image008" width="836" height="437" border="0" /></p>
<p align="justify"></p>&nbsp;
<p align="justify">For your reference I have created a table that shows when <strong>event 4964</strong> will be audited:</p>

<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="125"><b>Type of group</b></td>
<td valign="top" width="169"><b>Type of account added to group</b></td>
<td valign="top" width="128"><b>Event audited?</b></td>
</tr>
<tr>
<td valign="top" width="125">local</td>
<td valign="top" width="169">local</td>
<td valign="top" width="128"><b><span style="color: #1ab040">yes</span></b></td>
</tr>
<tr>
<td valign="top" width="125">local</td>
<td valign="top" width="169">Domain</td>
<td valign="top" width="128"><b><span style="color: #ff0000">no</span></b></td>
</tr>
<tr>
<td valign="top" width="125">Domain</td>
<td valign="top" width="169">Domain</td>
<td valign="top" width="128"><b><span style="color: #1ab040">yes</span></b></td>
</tr>
</tbody>
</table>
&nbsp;
<p align="justify">You can collect this event ID 4964 using SIEM solution and use alerting to inform your Admins when user with high privileges log on to any computer. Also <b>above feature should be part of auditing strategy</b> in all enterprises.</p>
<p align="justify">Rafal</p>]]></content:encoded>
    </item>
    <item>
      <title>Bitlocker: Network Unlock</title>
      <link>https://docs.microsoft.com/archive/blogs/dubaisec/bitlocker-network-unlock</link>
      <pubDate>Thu, 14 Apr 2016 02:32:40 GMT</pubDate>
      <dc:creator><![CDATA[Rafal Sosnowski [MSTF]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/dubaisec/?p=1714</guid>
      <description><![CDATA[Hello everyone. It’s Rafal Sosnowski from Microsoft Dubai Security PFE Team. Recently I have been...]]></description>
      <content:encoded><![CDATA[<p style="text-align: justify">Hello everyone. It’s Rafal Sosnowski from Microsoft <b>Dubai Security PFE Team</b>. Recently I have been requested by my customers to explain Bitlocker Network Unlock. So here you go.</p>
<p style="text-align: justify"><b>Network Unlock</b> is a relatively <b>new Bitlocker protector</b> (added in Windows 8) that can be used to unlock computers after the <b>reboot without need of entering Bitlocker PIN</b>.</p>
<p style="text-align: justify">This is very helpful in scenarios where all workstations protected by Bitlocker with TPM+PIN need to be restarted due to monthly maintenance or after power outage. Another scenario is when you don’t want to bother your users in corporate network with PIN prompt but require it when user takes laptop home.</p>
<p style="text-align: justify">For Network Unlock to work you need to meet some prerequisites mentioned below including having DHCP Server, WDS Server, UEFI capable clients and special certificate deployed by the GPO. Network unlock uses MS-NKPU protocol encapsulated into DHCP packets.</p>
&nbsp;
<h3 style="text-align: justify"><span style="color: #0080c0">How Network Unlock Works:</span></h3>
<p style="text-align: justify">The whole process of unlocking the Operating System drive encrypted by Bitlocker with network unlock feature is split into three phases:</p>
<p style="text-align: justify"><b>Phase 1:</b></p>
<p style="text-align: justify">In first phase client that is configured to use network unlock has to obtain valid IP address from the DHCP server. This <b>DHCP request is sent from UEFI firmware</b> not from DHCP client service in the Operating System. We also assume that proper GPO is configured on the client which enables Network Unlock and delivers special certificate used to encrypt message sent in next phase.</p>
<p style="text-align: justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image00111.png" alt="" width="704" height="225" border="0" /></p>
&nbsp;
<p style="text-align: justify"><b>Phase 2:</b></p>
<p style="text-align: justify">In this phase clients will broadcast MS-NKPU request which is encapsulated into <b>DHCP INFORM</b> packet and is containing Bitlocker key material encrypted with the WDS certificate public key from the GPO. Also this packet will contain <b>256-bit session key</b> used later to protect the data exchange.</p>
<p style="text-align: justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border: 0px" title="clip_image002" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0026.png" alt="clip_image002" width="704" height="225" border="0" /></p>
&nbsp;
<p style="text-align: justify"><b>Phase 3:</b></p>
<p style="text-align: justify">When Network Unlock server receives the MS-NKPU Request, it will decrypt it with corresponding private key of WDS certificate and send back the Bitlocker Key material encrypted with the session key. Because client generated this session key in previous step, it will decrypt the Bitlocker key material easily. Client now will be able to unlock its drive and allow user to log on to the system.</p>
<p style="text-align: justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0035.png" alt="" width="704" height="264" border="0" /></p>
&nbsp;
<h3 style="text-align: justify"><span style="color: #0080c0">Prerequisites:</span></h3>
&nbsp;
<h4 style="text-align: justify"><span style="font-weight: bold">DHCP Server</span></h4>
<p style="text-align: justify">DHCP server provides IP address to the clients in the pre-OS boot environment. DHCP Server is required when you are using IPv4 and is optional if you are using Ipv6 due to auto configuration with link-local Ipv6 address. Network Unlock on the client uses its linked local address to create DHCPv6 request packet, so it works without configuring a DHCPv6 server. You can configure both DHCPv4 and DHCPv6 scopes on the same machine or on different machines/devices. If you have DHCP and client computers in different subnets you will have to configure DHCP Relay agent on your router.</p>
&nbsp;
<h4 style="text-align: justify"><span style="font-weight: bold">WDS Server</span></h4>
<p style="text-align: justify">WDS server as a separate server role or part of the SCCM and is required to provide PXE functionality (<b>Pre-boot Execution Environment</b>). PXE is mainly used to install or boot operating system from the network but in this case it will answer all <b>NKPU</b> requests arriving to the server. Indeed, WDS server is a hosts for special Network Unlock provider which answers these requests.</p>
<p style="text-align: justify">NKP Provider is added to the server during Network Unlock feature installation and is loaded to memory when WDS service starts. Corresponding event will be also logged in the: Applications and Services Logs\Microsoft\Windows\Deployment-Services-Diagnostics\Debug</p>
<p style="text-align: justify"><i>Event ID: 24577</i></p>
<p style="text-align: justify"><i>[WDSServer/WDSPXE] NKPPROV Provider initialized successfully.</i></p>
<p style="text-align: justify">Note: this log is disabled by default. You need to explicitly enable it in the Eventvwr.msc</p>
<p style="text-align: justify">Also you can verify if provider has been registered successfully under:</p>
<p style="text-align: justify"><i>HKLM\System\CurrentControlSet\Services\WDSServer\Providers\WDSPXE\Providers\</i></p>
<p style="text-align: justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0046.png" alt="" width="680" height="174" border="0" /></p>
<p style="text-align: justify">It is also possible to configure list of IPv4 or IPv6 subnets on WDS server, in classless inter-domain routing (CIDR) notation, from which clients are permitted to be unlocked.</p>
&nbsp;
<h4 style="text-align: justify"><span style="font-weight: bold">Network Unlock Feature</span></h4>
<p style="text-align: justify">On the WDS server you need to install Bitlocker Network Unlock feature using Server Manager or command line:</p>

<blockquote>Install-WindowsFeature BitLocker-NetworkUnlock</blockquote>
<p style="text-align: justify">This process will register small DLL (<strong>nkpprov.dll</strong>) as a separate PXE provider plugged into the WDS server. This provider listens to all DHCPv6/v4 broadcast packages on the network, and will only respond if the package is for Network Unlock. It will not respond to normal DHCP/PXE packets.</p>
<p style="text-align: justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border: 0px" title="clip_image005" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0053.png" alt="clip_image005" width="372" height="292" border="0" /></p>
&nbsp;
<h4 style="text-align: justify"><span style="font-weight: bold">Clients</span></h4>
<p style="text-align: justify">Clients have to be Windows 8 or above with support for UEFI spec 2.3.1. Clients also have to have TPM enabled, activated and with ownership taken by the system. NKPU protocol (which is used by Bitlocker Network Unlock) can work with both wired and wireless networks [ <a href="https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-NKPU/%5bMS-NKPU%5d.pdf">link</a> ], however there are not many platforms supporting PXE/DHCP over Wireless in pre boot environment. As per protocol specification: <p>

<p style="text-align: justify"><code> The security of this protocol assumes that only a physical local area network (LAN) connection is available when executing this protocol, and that physical connectivity to the LAN is an implicit built-in authentication factor. Note that wireless networks do not offer this security. However, WiFi usage with the NKPU Protocol is acceptable if the user is required to authenticate to the access point when establishing a connection to the NKPU server.</code> </p>

<p style="text-align: justify">From Bitlocker perspective, so far Microsoft doesn't support Network Unlock over WiFi. There are few reasons for that: </P>
<ul>
  <li>Wi-Fi signals can be spoofed and the process of provisioning server certificates to clients (laptops) and enabling such network unlock can be vulnerable to man-in-the-middle attack, where attacker can then collect all hard drives keys that unlock all laptop drives and later get access to any stolen/lost laptop from that enterprise.</li>
  <li>Increasing retry logic in the pre-boot process quickly gets into very limited high quality entropy (RNG) we have available to use for session keys to protect unlock traffic against replay attacks. If retries are increased we can expose network unlock to replay attacks.
</li>
  <li>Wi-Fi signals can easily spread outside of the physical building boundary and an attacker who stole or found lost laptop can walk to the building (without entering) and unlock it nearby, just by powering it on.</li>
</ul>

<p style="text-align: justify"> So again, according to Microsoft official protocol specification, NKPU can work over WiFi, however it is very challenging to secure such communication. For example I've never seen an 802.1x authentication implemented in UEFI WiFi network stack . Also, since it is almost impossible to limit boundary of the WiFi, even if we have Access Point authentication implemented, it would be impossible to defend against attacker unlocking stolen laptop just right to premises' fences. So, it might work but it's not supported </p>

<p style="text-align: justify">Client doesn’t have to have TPM+PIN nor TPM protector configured on the OS drive although it is best practice to use TPM+PIN protector. Network unlock protector is in fact combination of 2 protectors: TPM + certificate as shown in the picture below:</p>
<p style="text-align: justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border: 0px" title="clip_image006" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0067.png" alt="clip_image006" width="531" height="302" border="0" /></p>
<p style="text-align: justify">So yes it is possible to use Network Unlock protector without having TPM+PIN added to the OS drive, however in normal circumstances it is recommended to have it.</p>
&nbsp;
<h4 style="text-align: justify"><span style="font-weight: bold">Certificate</span></h4>
<p style="text-align: justify">Special certificate with OID 1.3.6.1.4.1.311.67.1.1 (Bitlocker Drive Encryption OID) has to be obtained from the Certification Authority Server* and imported into <b>FVENKP</b> computer store on the WDS server:</p>
<p style="text-align: justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border: 0px" title="clip_image007" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0072.png" alt="clip_image007" width="724" height="238" border="0" /></p>
<p style="text-align: justify">This certificate is used to encrypt Bitlocker Key Material sent by client to the WDS server. Only WDS server can decrypt it with its private key and send back to the client.</p>
<p style="text-align: justify">You can verify if certificate is present using certlm.msc or command line:</p>

<blockquote>Certutil -verifystore FVENKP</blockquote>
<p style="text-align: justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border: 0px" title="clip_image008" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0085.png" alt="clip_image008" width="768" height="392" border="0" /></p>
<p style="text-align: justify">*Self-signed certificates are also supported.</p>
&nbsp;
<h4 style="text-align: justify"><span style="font-weight: bold">GPO Configuration</span></h4>
<p style="text-align: justify">Above WDS certificate (public key) has to be deployed to all computers that will be using network unlock feature. Simplest way is to use GPO</p>
<p style="text-align: justify">Computer Configuration\Policies\Windows Settings\Security Settings\Public Key Policies\Bitlocker Drive Encryption Network Unlock Certificate:</p>
<p style="text-align: justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border: 0px" title="clip_image010" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image01013.jpg" alt="clip_image010" width="752" height="122" border="0" /></p>
<p style="text-align: justify">or registry: <i>HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\SystemCertificates\FVE_NKP</i></p>
<p style="text-align: justify">Also policy “<b>Allow network unlock at startup</b>” has to be configured on all client computers via GPO:</p>
<p style="text-align: justify">Computer Configuration\Administrative Templates\Windows Components\BitLocker Drive Encryption\Operating System Drives</p>
&nbsp;
<h3 style="text-align: justify"><span style="color: #0080c0">Network Trace:</span></h3>
<p style="text-align: justify">If we take a look at the network trace, we see that after obtaining IP address from the DHCP server <b>10.0.0.10</b> (DORA process) client <b>10.0.0.150</b> sends DHCP Inform packet with Vendor Class ID: Bitlocker. This is a request to Network Unlock Server containing session key, certificate thumbprint and Bitlocker key material encrypted with certificate public key deployed earlier by the GPO.</p>
<p style="text-align: justify">Bitlocker key materials is concatenated from Option 43 (0x2B) and Option 125 (0x7D) of that packet.</p>
<p style="text-align: justify"><img style="padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border: 0px" title="clip_image012" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0129.jpg" alt="clip_image012" width="751" height="467" border="0" /></p>
&nbsp;
<p style="text-align: justify">In the response server will send us Bitlocker Key which was decrypted by Network Unlock server private key. To protect this material server will encrypt it with the session key. This is encapsulated into DHCP reply with Opcode: BootReply:</p>
<p style="text-align: justify"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="clip_image014" src="https://msdnshared.blob.core.windows.net/media/2016/04/clip_image0146.jpg" alt="clip_image014" width="749" height="430" border="0" /></p>
After obtaining Bitlocker Key Material from the Network unlock server, client will use session key to decrypt it and unlock the volume.

&nbsp;
<h3 style="text-align: justify"><span style="color: #0080c0">Additional notes:</span></h3>
<p style="text-align: justify">DHCP v6 can be disabled in some of the UEFI implementations from the UI. If you want to make sure that Network unlock happens only via IPv4 you need to disable IPv6 on the network card of WDS server. <b>Bootmgr code on the client will first try to unlock via DHCPv6 and failover to DHCPv4</b>.</p>
<p style="text-align: justify">Network Unlock <b>still uses TPM to check integrity of the platform</b>. So if the values in the PCRs (Platform Configuration Registers) have changed due to, for instance: BIOS upgrade, replacement of motherboard, malware in the boot components etc. you will be still prompted for Bitlocker Recovery Password. Entering this password cannot be automated in any way.</p>]]></content:encoded>
    </item>
  </channel>
</rss>