EKUs in WDAC, App Control for Business, Policies #343
HotCakeX
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
EKUs in WDAC, App Control for Business, Policies
Introduction
EKU stands for Extended Key Usage, which is an extension of X.509 certificates that delineates the functions for which the public key of the certificate can be employed. EKUs are designated by Object Identifiers (OIDs), which are sequences of digits that distinctly characterize a kind of usage.
The EKUs extension can be either critical or non-critical. If the extension is critical, it implies that the certificate must be utilized solely for the functions indicated by the EKUs. If the extension is non-critical, it implies that the certificate can be employed for other functions as well, provided that they are not prohibited by other extensions or policies.
A Detailed Analysis of Object Identifiers and Their Usage
Let's consider
1.3.6.1.4.1.311.61.4.1as an example which is an OID accountable for ELAM EKU. An Object Identifier (OID) is a method of denominating distinguishing objects in a hierarchical fashion. OIDs are frequently employed in cryptography, security, and networking protocols to indicate various kinds of data or algorithms.Each cluster of digits in an OID is termed an arc. The arcs are separated by dots and constitute a tree structure. The first arc is the root of the tree, and the last arc is the leaf. The arcs in between are denoted as nodes. Each arc has a designation and a numeral, which are allocated by different authorities or standards organizations.
1: This is the root arc, and it is attributed to the International Organization for Standardization (ISO).3: This signifies that the object pertains to the identified-organization branch of the ISO tree, which encompasses OIDs attributed to various organizations.6: This is the third arc, and it is attributed to the US Department of Defense (DoD), which is the executive branch department accountable for the military and national security of the United States.1: This is the fourth arc, signifies that the object pertains to the internet sub-branch, which encompasses OIDs pertaining to internet protocols and standards.4: This is the fifth arc, signifies that the object pertains to the private sub-branch, which encompasses OIDs allocated to private enterprises and organizations.1: This signifies that the object pertains to the enterprise sub-branch, which encompasses OIDs assigned to specific enterprises by IANA (Internet Assigned Numbers Authority). Each enterprise can devise its own sub-tree under its assigned OID.311: This is the Microsoft arc, which is employed for Microsoft-specific purposes.61: This is the Windows System Component Verification arc, which is employed for Windows system components that necessitate special verification.4.1: This is the Early Launch EKU arc, which is employed for the Extended Key Usage (EKU) of Early Launch Anti-Malware (ELAM) drivers. ELAM drivers are special drivers that can load prior to other drivers and verify their integrity and signatures. They are mandated to be signed by Microsoft and have a certificate that contains this EKU.EKUs in WDAC Policies
EKUs are employed in WDAC policies to indicate the functions for which a certificate can be employed. Consider EKUs as a whitelist of permitted functions. If a certificate does not encompass any of the EKUs indicated in the WDAC policy, it will be discarded. They can be employed to confine the range of a certificate to a specific function.
For instance, if a certificate is issued to an individual or an organization solely for code signing functions, it cannot be employed for high-value operations such as Early Launch AntiMalware (ELAM) driver signing. To have the capacity to sign ELAM drivers, the certificate must encompass the ELAM EKU which is only attained by fulfilling specific requirements demonstrated by Microsoft.
We can readily verify this in the subsequent example. Let's assume you have deployed the DefaultWindows template policy on a machine, and now you want to enable a 3rd party application such as OBS to be allowed to run. You create a supplemental policy by scanning the components of the OBS software. If we now open the generated XML file, we can observe that there are signer rules in there.
And if we open the properties of one of those signed files, we can observe that they are signed by a certificate that was issued to an individual for Code Signing function only.
If we append an EKU that is not supported by this certificate, such as ELAM, to one of the signer rules in the supplemental policy, the OBS software will no longer be permitted by the Code Integrity to run because the certificate the components of the OBS software are signed with does not encompass the ELAM EKU.
How to Obtain the OID of an EKU by Knowing Its Friendly Name and Vice Versa
If you know the OID or the friendly name of an EKU, you can readily obtain the other one by using the following PowerShell command
How to Convert an OID to Hexadecimal Format for WDAC Policies
In a WDAC Policy XML file, each EKU must be defined in the
EKUsnode. For each EKU, there are 3 available attributes, 2 of which are mandatory and 1 is optional. The mandatory attributes areIDandValue, and the optional attribute isFriendlyName.IDattribute is a unique identifier for the EKU and should begin withID_EKU_.Valueattribute is the hexadecimal representation of the OID of the EKU.FriendlyNameattribute is a human-readable name for the EKU.We can convert the OID of an EKU to its hexadecimal representation by using the following PowerShell function:
How to Convert the Hexadecimal Format to an OID for WDAC Policies
The following PowerShell function does the exact opposite of the previous function. It converts the hexadecimal representation of an OID to the OID itself.
Common EKUs in WDAC Policies
OIDs for Common Microsoft EKUs
1.3.6.1.4.1.3111.3.6.1.4.1.311.10.3.221.3.6.1.4.1.311.10.3.231.3.6.1.5.5.7.3.3How EKUs Are Used by the WDAC Engine for Validation
Regarding the incorporation of EKUs in file validation, WDAC verifies that the file's leaf certificate (File's signer) possesses identical EKUs as the signer element's EKUs. Regardless of whether the Signer's CertRoot (TBS value) and name (CN of the certificate) match with file's root, intermediate or leaf certificates, the EKUs only need to match with the leaf certificate.
For example, in the Default Windows template policy, the
Kernel32.dllis authorized by the following signer:Microsoft Product Root 2010 Windows EKU: Matches the common name of the file's root certificate (Microsoft Root Certificate Authority 2010) through well known roots.CertRoot: Matches the TBS and Common name of the file's root certificate using well known roots.CertEKU: Only requires the file's signer, the leaf certificate, to have an EKU with the OID of1.3.6.1.4.1.311.10.3.6.You can see the details in the screenshots below
The Placement of the CertEKU Elements
In every Signer, the
CertEKUnode should only be placed directly afterCertRoot. It is against the Code Integrity schema for any other nodes to exist between them. Below is a example of such configurationContinue Reading
Beta Was this translation helpful? Give feedback.
All reactions