{"id":120680,"date":"2022-08-24T10:00:00","date_gmt":"2022-08-24T17:00:00","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/?p=120680"},"modified":"2025-06-25T00:58:02","modified_gmt":"2025-06-25T07:58:02","slug":"magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/","title":{"rendered":"MagicWeb: NOBELIUM\u2019s post-compromise trick to authenticate as anyone"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>April 2023 update<\/strong> \u2013 Microsoft Threat Intelligence has shifted to a new threat actor naming taxonomy aligned around the theme of weather. NOBELIUM is now tracked as <strong><a href=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/tag\/midnight-blizzard-nobelium\/\">Midnight Blizzard<\/a><\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To learn about how the new taxonomy represents the origin, unique traits, and impact of threat actors, and to get a complete mapping of threat actor names, read this blog: <a href=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2023\/04\/18\/microsoft-shifts-to-a-new-threat-actor-naming-taxonomy\/\">Microsoft shifts to a new threat actor naming taxonomy<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Microsoft Detection and Response Team (DART) has been renamed to Microsoft Incident Response (Microsoft IR). For more information on IR services, go to&nbsp;<a href=\"https:\/\/www.microsoft.com\/en-us\/security\/business\/microsoft-incident-response\">Microsoft Incident Response<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>August 26, 2022 update<\/strong>: Added instructions to <a href=\"#AHQ\">enable collection of AD FS event logs<\/a> in order to search for Event ID 501, and added a new resource for <a href=\"#Sentinel\">AD FS audit logging in Microsoft Sentinel<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-thin\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Microsoft security researchers have discovered a post-compromise capability we\u2019re calling MagicWeb, which is used by a threat actor we track as NOBELIUM to maintain persistent access to compromised environments. NOBELIUM remains highly active, executing multiple campaigns in parallel targeting government organizations, non-governmental organizations (NGOs), intergovernmental organizations (IGOs), and think tanks across the US, Europe, and Central Asia. The Microsoft Threat Intelligence Center (MSTIC) assesses that MagicWeb was likely deployed during an ongoing compromise and was leveraged by NOBELIUM possibly to maintain access during strategic remediation steps that could preempt eviction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">NOBELIUM has used abuse of identities and credentialed access as a method for maintaining persistence, and a specialized capability like MagicWeb is not novel for the actor: in September 2021, Microsoft disclosed a post-exploitation capability named <a href=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2021\/09\/27\/foggyweb-targeted-nobelium-malware-leads-to-persistent-backdoor\/\">FoggyWeb<\/a> with methods and intent similar to MagicWeb. FoggyWeb was capable of exfiltrating the configuration database of compromised AD FS servers, decrypting&nbsp;<a href=\"https:\/\/docs.microsoft.com\/windows-server\/identity\/ad-fs\/design\/token-signing-certificates\">token-signing certificates<\/a> and <a href=\"https:\/\/docs.microsoft.com\/windows-server\/identity\/ad-fs\/design\/certificate-requirements-for-federation-servers\">token-decryption certificates<\/a>, and downloading and executing additional malware components. MagicWeb goes beyond the collection capabilities of FoggyWeb by facilitating covert access directly. MagicWeb is a malicious DLL that allows manipulation of the claims passed in tokens generated by an Active Directory Federated Services (AD FS) server. It manipulates the user authentication certificates used for authentication, not the signing certificates used in attacks like Golden SAML.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">NOBELIUM was able to deploy MagicWeb by first gaining access to highly privileged credentials and moving laterally to gain administrative privileges to an AD FS system. This is not a supply chain attack. The attacker had admin access to the AD FS system and replaced a legitimate DLL with their own malicious DLL, causing malware to be loaded by AD FS instead of the legitimate binary. The backdoor was discovered by Microsoft\u2019s Detection and Response Team (DART) in coordination with MSTIC and Microsoft 365 Defender Research during an ongoing incident response investigation. Microsoft is sharing this information with consent from the client. At the time of this investigation, MagicWeb appears to be highly targeted.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Like domain controllers, AD FS servers can authenticate users and should therefore be treated with the same high level of security. Customers can defend against MagicWeb and other backdoors by implementing a holistic security strategy including the <a href=\"https:\/\/docs.microsoft.com\/windows-server\/identity\/ad-fs\/design\/best-practices-for-secure-planning-and-deployment-of-ad-fs\">AD FS hardening guidance<\/a>. In the case of this specific discovery, MagicWeb is one step of a much larger intrusion chain that presents unique detection and prevention scenarios.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With all critical infrastructure such as AD FS, it is important to ensure attackers do not gain administrative access. Once attackers gain administrative access, they have many options for further system compromise, activity obfuscation, and persistence. We recommend that any such infrastructure is isolated, accessible only by dedicated admin accounts, and regularly monitored for any changes. Other security measures that can prevent this and other attacks include credential hygiene to prevent lateral movement. AD FS is an on-premises server, and as with all on-premises servers, deployments can get out of date and\/or go unpatched, and they can be impacted by local environment compromises and lateral movement. For these reasons, <a href=\"https:\/\/docs.microsoft.com\/azure\/active-directory\/manage-apps\/migrate-adfs-apps-to-azure\">migration to a cloud-based identity solution such as Azure Active Directory<\/a> for federated authentication is recommended for the robust security it provides. See the <a href=\"#mitigation\">mitigation section<\/a> below for more information. Though we assess the capability to be in limited use, Microsoft anticipates that other actors could adopt similar methodologies and therefore recommends customers review hardening and mitigation guidance provided in this blog.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-magicweb-subverts-authentication\">How MagicWeb subverts authentication<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">MagicWeb is a post-compromise malware that can only be deployed by a threat actor after gaining highly privileged access to an environment and moving laterally to an AD FS server. To achieve their goal of maintaining persistent access to an environment by validating authentication for any user account on the AD FS server, NOBELIUM created a backdoored DLL by copying the legitimate <em>Microsoft.IdentityServer.Diagnostics.dll<\/em> file used in AD FS operations. The legitimate version of this file is <a href=\"https:\/\/docs.microsoft.com\/windows-hardware\/drivers\/install\/catalog-files\">catalog signed<\/a> by Microsoft and is normally loaded by the AD FS server at startup to provide debugging capabilities. NOBELIUM\u2019s backdoored version of the file is unsigned. The threat actor\u2019s highly privileged access that allowed them to access the AD FS server meant they could have performed any number of actions in the environment, but they specifically chose to target an AD FS server to facilitate their goals of persistence and information theft during their operations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After gaining administrative access to an AD FS server via elevation of privilege and lateral movement, the loading of NOBELIUM\u2019s malicious <a><em>Microsoft.IdentityServer.Diagnostics.dll<\/em> <\/a>into the AD FS process is possible by editing <em>C:\\Windows\\AD FS\\Microsoft.IdentityServer.Servicehost.exe.config<\/em> to specify a different public token, which controls what loads into the AD FS process when it is started. Because AD FS is a .NET application, it loads the DLLs specified in the config file from the <a href=\"https:\/\/docs.microsoft.com\/dotnet\/framework\/app-domains\/gac\">Global Assembly Cache<\/a> (GAC). By changing the token in the configuration, the adversary directed AD FS to load in the malicious DLL. The interception and manipulation of claims by MagicWeb enables the actor to generate tokens that allow the adversary to bypass AD FS policies (role policies, device policies, and network policies) and sign in as any user with any claims, including multifactor authentication (MFA).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"959\" height=\"482\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig1-microsoft-identityserver-servicehost-exe.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120740\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig1-microsoft-identityserver-servicehost-exe.png 959w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig1-microsoft-identityserver-servicehost-exe-300x151.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig1-microsoft-identityserver-servicehost-exe-768x386.png 768w\" sizes=\"auto, (max-width: 959px) 100vw, 959px\" \/><figcaption class=\"wp-element-caption\">Figure 1. <em>C:\\Windows\\AD FS\\Microsoft.IdentityServer.Servicehost.exe.config<\/em> being set to load <em>Microsoft.IdentityServer.Diagnostics.dll<\/em><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"959\" height=\"444\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig2-nobelium-public-token.png\" alt=\"Screenshot of a section of a configuration file with the PublicKeyToken partially redacted.\" class=\"wp-image-120698\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig2-nobelium-public-token.png 959w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig2-nobelium-public-token-300x139.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig2-nobelium-public-token-768x356.png 768w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig2-nobelium-public-token-930x430.png 930w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig2-nobelium-public-token-767x355.png 767w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig2-nobelium-public-token-539x249.png 539w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig2-nobelium-public-token-465x215.png 465w\" sizes=\"auto, (max-width: 959px) 100vw, 959px\" \/><figcaption class=\"wp-element-caption\">Figure 2. NOBELIUM uses a different public token than the legitimate <em>Microsoft.IdentityServer.Diagnostics.dll<\/em>, telling AD FS to look for a different file in the GAC<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"460\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig3-magicweb-publickeytoken.png\" alt=\"Partial screenshot of a configuration file showing MagicWeb's malicious PublicKeyToken (partially redacted) and a legitimate one.\" class=\"wp-image-120701\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig3-magicweb-publickeytoken.png 800w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig3-magicweb-publickeytoken-300x173.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig3-magicweb-publickeytoken-768x442.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Figure 3. Close up from <em>Microsoft.IdentityServer.Servicehost.exe.config<\/em> showing MagicWeb\u2019s malicious <em>PublicKeyToken <\/em>compared to the <em>PublicKeyToken <\/em>of the legitimate version of the DLL<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"958\" height=\"199\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig4-gac-directories-infected-magicweb.png\" alt=\"Screenshot of Windows File Explorer showing the Microsoft.IdentityServer.Diagnostics. directory with two folders. The folder name related to the malicious file is partially redacted.\" class=\"wp-image-120704\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig4-gac-directories-infected-magicweb.png 958w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig4-gac-directories-infected-magicweb-300x62.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig4-gac-directories-infected-magicweb-768x160.png 768w\" sizes=\"auto, (max-width: 958px) 100vw, 958px\" \/><figcaption class=\"wp-element-caption\">Figure 4. The directories in the GAC on a server infected with MagicWeb; the malicious <em>Microsoft.IdentityServer.Diagnostics.dll<\/em> file and the legitimate one are located in different directories<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To understand how NOBELIUM can subvert the AD FS process with the MagicWeb malware, it\u2019s important to understand how AD FS claims work. AD FS extends the ability to use single sign-on functionality available within a single security or enterprise boundary to internet-facing applications to provide customers, partners, and suppliers a streamlined user experience while accessing an organization\u2019s web-based applications. AD FS relies on <a href=\"https:\/\/docs.microsoft.com\/dynamics365\/customerengagement\/on-premises\/deploy\/configure-the-ad-fs-server-for-claims-based-authentication\">claims-based authentication<\/a> to validate the identity of the user and their authorization claims. These claims are packaged into a token that can be used for authentication. MagicWeb injects itself into the claims process to perform malicious actions outside the normal roles of an AD FS server.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"255\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig5-how-ad-fs-claims-work.png\" alt=\"Diagram containing icons and arrows summarizing how AD FS claims work.\" class=\"wp-image-120707\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig5-how-ad-fs-claims-work.png 960w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig5-how-ad-fs-claims-work-300x80.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig5-how-ad-fs-claims-work-768x204.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><figcaption class=\"wp-element-caption\">Figure 5. How the AD FS claims pipeline issues a token for a user entering a federated application<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.microsoft.com\/en-us\/security\/business\/security-101\/what-is-security-assertion-markup-language-saml\">Security Assertion Markup Language (SAML)<\/a> uses x509 certificates to establish trust relationships between identity providers and services and to sign and decrypt tokens. These x509 certificates contain enhanced key usage (EKU) values that specify what applications the certificate should be used for. For instance, an EKU containing an Object Identifier (OID) value of 1.3.6.1.4.1.311.20.2.2 would allow for the use of a SmartCard logon. Organizations can create custom OIDs to further narrow certificate usage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">MagicWeb\u2019s authentication bypass comes from passing a non-standard Enhanced Key Usage OID that is hardcoded in the MagicWeb malware during an authentication request for a specified User Principal Name. When this unique hard coded OID value is encountered, MagicWeb will cause the authentication request to bypass all standard AD FS processes (including checks for MFA) and validate the user\u2019s claims. MagicWeb is manipulating the user authentication certificates used in SAML sign-ins, not the signing certificates for a SAML claim used in attacks like Golden SAML.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"896\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig6-user-certificated-created-by-magicweb.png\" alt=\"Screenshot of a user certificate's Details tab with the OID partially redacted.\" class=\"wp-image-120710\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig6-user-certificated-created-by-magicweb.png 800w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig6-user-certificated-created-by-magicweb-268x300.png 268w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig6-user-certificated-created-by-magicweb-768x860.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Figure 6. Example of a user certificate accepted by MagicWeb; the highlighted numbers under \u201cUnknown Key Usage\u201d is one of two OIDs hardcoded into MagicWeb<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"1020\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig7-sample-user-certificate-generated-via-magicweb.png\" alt=\"Screenshot of a user certificate's Certification Path tab.\" class=\"wp-image-120713\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig7-sample-user-certificate-generated-via-magicweb.png 800w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig7-sample-user-certificate-generated-via-magicweb-235x300.png 235w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig7-sample-user-certificate-generated-via-magicweb-768x979.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Figure 7. Example of a user certificate chain, which shows an invalid digital signature but still works for authentication<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">NOBELIUM uses unique tradecraft per target, so it\u2019s highly likely that the OIDs and public tokens are unique per target as well. We\u2019ve redacted these OIDs and tokens in this report. Please see the <a href=\"#hunting-guidance\">hunting guidance<\/a> section for information on how to look for variants related to this attack.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"mitigation\"><a id=\"_How_to_mitigate\"><\/a>How to mitigate this threat<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">NOBELIUM\u2019s ability to deploy MagicWeb hinged on having access to highly privileged credentials that had administrative access to the AD FS servers, giving them the ability to perform whatever malicious activities they wanted to on the systems they had access to.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It\u2019s critical to treat your AD FS servers as a <a href=\"https:\/\/docs.microsoft.com\/microsoft-identity-manager\/pam\/tier-model-for-partitioning-administrative-privileges\">Tier 0<\/a> asset, protecting them with the same protections you would apply to a domain controller or other critical security infrastructure. AD FS servers provide authentication to configured relying parties, so an attacker who gains administrative access to an AD FS server can achieve total control of authentication to configured relying parties (include Azure AD tenants configured to use the AD FS server). Practicing credential hygiene is critical for protecting and preventing the exposure of highly privileged administrator accounts. This especially applies on more easily compromised systems like workstations with controls like <a href=\"https:\/\/docs.microsoft.com\/microsoft-identity-manager\/pam\/tier-model-for-partitioning-administrative-privileges\">logon restrictions<\/a> and preventing lateral movement to these systems with controls like the Windows Firewall.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Migration to Azure Active Directory (Azure AD) authentication is recommended to reduce the risk of on-premises compromises moving laterally to your authentication servers. Customers can use the following references on migration:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\"><a href=\"https:\/\/docs.microsoft.com\/azure\/active-directory\/manage-apps\/migrate-adfs-application-activity\">Use the activity report to move AD FS apps to Azure AD<\/a><\/li>\n\n\n\n<li class=\"wp-block-list-item\"><a href=\"https:\/\/docs.microsoft.com\/azure\/active-directory\/manage-apps\/migrate-adfs-apps-to-azure\">Move application authentication to Azure AD<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"AHQ\">Advanced hunting queries<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"hunting-guidance\">Recommended hunting guidance<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">Have Inventory Certificate Issuance policies in your Public Key Infrastructure (PKI) environment, including all EKU attributes used in the environment and compare to known OID values.<\/li>\n\n\n\n<li class=\"wp-block-list-item\"><span style=\"color: initial;\">Hunt across Windows Event Logs by enabling AD FS <\/span><a href=\"https:\/\/docs.microsoft.com\/windows-server\/identity\/ad-fs\/troubleshooting\/ad-fs-tshoot-logging\">verbose logging<\/a><span style=\"color: initial;\">. Enable <\/span><a href=\"https:\/\/docs.microsoft.com\/en-us\/windows-server\/identity\/ad-fs\/troubleshooting\/ad-fs-tshoot-logging#security-auditing\">security auditing<\/a><span style=\"color: initial;\"> to allow collection of the <\/span><a href=\"https:\/\/adfshelp.microsoft.com\/AdfsEventViewer\/GetAdfsEventList\">AD FS event logs<\/a><span style=\"color: initial;\">, and specifically look for <\/span><strong style=\"color: initial;\">Event ID 501<\/strong><span style=\"color: initial;\">. This event specifies all the EKU attributes on a claim. Hunt across these logs to look for EKU values which your PKI infrastructure isn\u2019t configured to issue.<\/span><\/li>\n\n\n\n<li class=\"wp-block-list-item\">Look for portable executable files in the GAC or AD FS directories on your systems that aren\u2019t signed by Microsoft and inspect these files or <a href=\"https:\/\/www.microsoft.com\/wdsi\/filesubmission\">submit them for analysis<\/a>.<\/li>\n\n\n\n<li class=\"wp-block-list-item\">Perform an audit of your exclusion settings to be sure that the AD FS and GAC are included in scans. Many organizations exclude the AD FS directories from security software scanning because of performance degradation concerns.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Sentinel\">Microsoft Sentinel<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Microsoft Sentinel customers who have <a href=\"https:\/\/docs.microsoft.com\/windows-server\/identity\/ad-fs\/troubleshooting\/ad-fs-tshoot-logging\">enabled verbose mode logging<\/a> for ADFS can use this query to look for suspicious OIDs: <a href=\"https:\/\/github.com\/Azure\/Azure-Sentinel\/tree\/master\/Detections\/SecurityEvent\/ADFSAbnormalEnhancedKeyUsageAttribute-OID.yaml\">https:\/\/github.com\/Azure\/Azure-Sentinel\/tree\/master\/Detections\/SecurityEvent\/ADFSAbnormalEnhancedKeyUsageAttribute-OID.yaml<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">NOTE: It&#8217;s important to enable the proper connector in Sentinel with the correct Event collection. Refer to this <a href=\"https:\/\/techcommunity.microsoft.com\/t5\/microsoft-sentinel-blog\/enabling-ad-fs-security-auditing-and-shipping-event-logs-to\/ba-p\/3610464\">post<\/a> for more details on AD FS Audit logging collection in Sentinel.  <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"searching-for-unsigned-files-in-the-gac\">Searching for unsigned files in the GAC<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The legitimate <em>Microsoft.IdentityServer.Diagnostics.dll<\/em> is <a href=\"https:\/\/docs.microsoft.com\/windows-hardware\/drivers\/install\/catalog-files\">catalog signed<\/a> by Microsoft. Catalog signing is a method Windows uses for validating code integrity different from <a href=\"https:\/\/docs.microsoft.com\/windows-hardware\/drivers\/install\/authenticode\">Authenticode<\/a>, and is used for offline validation rather than runtime enforcement of running only signed code. The catalog signing on this file means the file may appear to be unsigned on the file properties pane and in file integrity checkers, security tools, and online malware repositories. The scripts below allow you to look for unsigned binaries and understand both catalog-signed binaries and Authenticode-signed binaries.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Surface unsigned DLLs in GAC using Microsoft 365 Defender<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This query surfaces unsigned DLLs in the GAC folder created within the last 60 days. <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\nDeviceImageLoadEvents\n\n     | where FolderPath has @\"C:\\Windows\\Microsoft.NET\\assembly\\GAC_MSIL\\Microsoft.IdentityServer.\" and FileName endswith \".dll\" and not(isempty(SHA1))\n\n     | join kind = leftanti (DeviceFileCertificateInfo) on SHA1\n\n     | distinct DeviceName, FolderPath, FileName, SHA1, SHA256\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Enumerate non-Microsoft signed DLLs in the GAC using PowerShell<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Below is an example script that could be used to enumerate non-Microsoft signed DLLs in the relevant GAC folder, where <em>servers.txt<\/em> is a list of servers you wish to scan. Because the legitimate <em>Microsoft.IdentityServer.Diagnostics.dll<\/em> is catalog signed, signing won\u2019t appear when viewing file properties, but it will show in PowerShell querying and on load of the DLL.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\n$servers = get-content -Path (path to file)\\servers.txt \nForeach ($server in $servers) { \nWrite-Output \"Processing server: $server\" \nInvoke-Command -ComputerName $server {Get-ChildItem -Filter \"*.dll\" -Recurse \"C:\\Windows\\Microsoft.NET\\assembly\\GAC_MSIL\\\" | get-authenticodesignature | ft} \n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"detections\">Detections<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"microsoft-defender-antivirus\">Microsoft Defender Antivirus<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Microsoft Defender Antivirus provides detection for this threat under the following malware name:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">Trojan:MSIL\/MagicWeb.A!dha<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"microsoft-defender-for-endpoint\">Microsoft Defender for Endpoint<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Microsoft Defender for Endpoint customers may see the following alert as an indication of possible attack:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">ADFS persistent backdoor detected<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"indicators-of-compromise-iocs\">Indicators of compromise (IOCs)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Microsoft isn\u2019t sharing IOCs on this NOBELIUM activity at this time. However, NOBELIUM frequently customizes infrastructure and capabilities per campaign, minimizing operational risk should their campaign specific attributes be discovered. If MagicWeb is identified in your environment, it\u2019s unlikely to match any static IOCs from other targets such as a SHA-256 value. It\u2019s recommended to use the hunting guidance provided above to investigate your environment.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"technical-analysis-of-magicweb\">Technical analysis of MagicWeb<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">NOBELIUM has modified the legitimate <em>Microsoft.IdentityServer.Diagnostics.dll<\/em> by adding malicious code to the TraceLog class from the <em>Microsoft.IdentityServer.Diagnostics<\/em> namespace\/type.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The header section of the TraceLog class from the <strong><em>legitimate<\/em><\/strong><em> Microsoft.IdentityServer.Diagnostics.dll<\/em> is shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"914\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig8-tracelog-class.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120716\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig8-tracelog-class.png 960w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig8-tracelog-class-300x286.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig8-tracelog-class-768x731.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><figcaption class=\"wp-element-caption\">Figure 8. The header section of the TraceLog class of <em>Microsoft.IdentityServer.Diagnostics <\/em>namespace\/type from the legitimate <em>Microsoft.IdentityServer.Diagnostics.dll<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Meanwhile, the header section of the TraceLog class from NOBELIUM\u2019s <strong><em>backdoored<\/em><\/strong>version of <em>Microsoft.IdentityServer.Diagnostics.dll<\/em> is shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"959\" height=\"773\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig9-tracelog-class-header-section.png\" alt=\"Screenshot of a section of a configuration file with the TraceLog() class highlighted.\" class=\"wp-image-120719\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig9-tracelog-class-header-section.png 959w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig9-tracelog-class-header-section-300x242.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig9-tracelog-class-header-section-768x619.png 768w\" sizes=\"auto, (max-width: 959px) 100vw, 959px\" \/><figcaption class=\"wp-element-caption\">Figure 9. The header section of the TraceLog class of <em>Microsoft.IdentityServer.Diagnostics <\/em>namespace from NOBELIUM\u2019s backdoored version of <em>Microsoft.IdentityServer.Diagnostics.dll<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In the backdoored version of the code, as shown above, NOBELIUM has added a static constructor for the TraceLog class. A <a href=\"https:\/\/docs.microsoft.com\/dotnet\/csharp\/programming-guide\/classes-and-structs\/static-constructors\">static constructor<\/a> is used to initialize any static data, or to perform a particular action that needs to be performed only once. It\u2019s called automatically before the first instance is created or any static members are referenced.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The malicious static constructor gets executed once before the first instance of the TraceLog class is created. Given that new instances of the TraceLog class is created in various locations in this DLL, the execution of the malicious static constructor is guaranteed to occur as soon as the DLL is loaded for the first time (which would be upon startup of the AD FS server after the malicious changes to <em>Microsoft.IdentityServer.Servicehost.exe.config <\/em>described above).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">NOBELIUM\u2019s malicious static constructor contains a reference to the <em>Initialize()<\/em> method from a class named <em>AuthLog<\/em><strong>.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"959\" height=\"348\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig10-reference-initialize-method.png\" alt=\"Screenshot of a section of a configuration file with the Initialize() method highlighted.\" class=\"wp-image-120722\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig10-reference-initialize-method.png 959w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig10-reference-initialize-method-300x109.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig10-reference-initialize-method-768x279.png 768w\" sizes=\"auto, (max-width: 959px) 100vw, 959px\" \/><figcaption class=\"wp-element-caption\">Figure 10. Reference to the <em>Initialize()<\/em> method from a class named <em>AuthLog<\/em> in the malicious static constructor<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The <em>AuthLog<\/em> class is a brand-new and malicious class that\u2019s been added to the DLL by NOBELIUM.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"958\" height=\"206\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig11-initialize-method-authlog-class.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120725\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig11-initialize-method-authlog-class.png 958w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig11-initialize-method-authlog-class-300x65.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig11-initialize-method-authlog-class-768x165.png 768w\" sizes=\"auto, (max-width: 958px) 100vw, 958px\" \/><figcaption class=\"wp-element-caption\">Figure 11. The <em>Initialize()<\/em> method of the <em>AuthLog<\/em> class<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As shown above, the <em>Initialize()<\/em> method references a class named <em>RuntimeHelper<\/em>, yet another class added to the DLL by the actor. The primary purpose of the <em>RuntimeHelper<\/em> class and its <em>OverloadMethod()<\/em> method is to hook legitimate AD FS related methods at runtime. By hooking the legitimate AD FS methods, the backdoor is capable of intercepting calls to the legitimate methods to instead invoke its own custom methods.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The screenshot above shows the following legitimate AD FS methods being hooked by MagicWeb:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Target assembly\/DLL<\/strong><\/td><td><strong>Target type<\/strong><\/td><td><strong>Target method to hook<\/strong><\/td><td><strong>Malicious hook method (actor introduced)<\/strong><\/td><\/tr><tr><td><em>Microsoft.IdentityServer.IdentityModel.dll<\/em><\/td><td><em>Microsoft.IdentityModel.X509CertificateChain<\/em><\/td><td><em>Build<\/em><\/td><td><em>BeginBuild<\/em><\/td><\/tr><tr><td><em>Microsoft.IdentityServer.WebHost.dll<\/em><\/td><td><em>Microsoft.IdentityServer.WebHost.WrappedHttpListenerRequest<\/em><\/td><td><em>GetClientCertificate<\/em><\/td><td><em>BeginGetClientCertificate<\/em><\/td><\/tr><tr><td><em>Microsoft.IdentityServer.WebHost.dll<\/em><\/td><td><em>Microsoft.IdentityServer.WebHost.Proxy.ProxyConfigurationData<\/em><\/td><td><em>EndpointConfiguration<\/em><\/td><td><em>BeginEndpointConfiguration<\/em><\/td><\/tr><tr><td><em>Microsoft.IdentityServer.Service.dll<\/em><\/td><td><em>Microsoft.IdentityServer.Service.IssuancePipeline.PolicyEngine<\/em><\/td><td><em>ProcessClaims<\/em><\/td><td><em>BeginProcessClaims<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"hook-method-beginbuild\">Hook method: <em>BeginBuild()<\/em><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">MagicWeb\u2019s <em>BeginBuild()<\/em> method is used to hook the legitimate target method <em>Build()<\/em> (from <em>Microsoft.IdentityServer.IdentityModel.dll<\/em>).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"462\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig12-magicweb-begin-build-method.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120728\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig12-magicweb-begin-build-method.png 800w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig12-magicweb-begin-build-method-300x173.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig12-magicweb-begin-build-method-768x444.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Figure 12. MagicWeb\u2019s <em>BeginBuild()<\/em> method<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The<em> BeginBuild() <\/em>method first calls the MagicWeb\u2019s helper method <em>ValidateX509Extensions()<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the helper method <em>ValidateX509Extensions() <\/em>returns true, <em>BeginBuild()<\/em> returns true.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If <em>ValidateX509Extensions()<\/em> returns false, or an exception is thrown by calling <em>ValidateX509Extensions()<\/em>, <em>BeginBuild() <\/em>invokes and returns the value returned by the legitimate <em>Build()<\/em> method from <em>Microsoft.IdentityServer.IdentityModel.dll<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This means that before the legitimate target method&nbsp;<em>Build()<\/em> from the legitimate <em>Microsoft.IdentityServer.IdentityModel.dll<\/em> gets an opportunity to inspect\/build a certificate, MagicWeb\u2019s hook method first inspects the certificate and returns true if the helper method <em>ValidateX509Extensions()<\/em> returns true.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This allows the attacker to subvert the normal certificate inspection\/build process by introducing a custom certificate inspection\/build method that\u2019s invoked before the legitimate <em>Build()<\/em> method is invoked.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"helper-method-validatex509extensions\">Helper Method: <em>ValidateX509Extensions()<\/em><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">MagicWeb\u2019s helper method <em>ValidateX509Extensions()<\/em> is called by <em>BeginBuild()<\/em> and other methods.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"423\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig13-helper-method-ValidateX509Extensions.png\" alt=\"Screenshot of a section of a configuration file with partially redacted hash values.\" class=\"wp-image-120731\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig13-helper-method-ValidateX509Extensions.png 800w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig13-helper-method-ValidateX509Extensions-300x159.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig13-helper-method-ValidateX509Extensions-768x406.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Figure 13. Helper method <em>ValidateX509Extensions()<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><em>ValidateX509Extensions()<\/em> returns false if the X509 certificate passed to the method is null or the Microsoft Cryptographic API certificate context handle\/pointer isn\u2019t set.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next, the method enumerates the extensions in the X509 certificate passed to the method. If an enumerated extension is of type <em>X509EnhancedKeyUsageExtension<\/em>, the method iterates the OIDs of the extension, calculating the MD5 hash of each OID (using a custom hash computation helper method <em>ComputeHash()<\/em> that leverages the .NET <em>MD5<\/em> class).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the MD5 hash value of the OID matches one of the two following hardcoded MD5 values, the method returns true (this methodology is used to check if one of the two OID values below are present in the extension):<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\"><em>67F5BD28A842A1C9[REDACTED]<\/em> (MD5 hash value corresponding to the OID value&nbsp;<em>1.3.6.1.4.1.311.21.8.868518.12957973.4869258.12250419.[REDACTED].[REDACTED].[REDACTED].[REDACTED]<\/em>)<\/li>\n\n\n\n<li class=\"wp-block-list-item\"><em>6E3466296D2F63D[REDACTED]<\/em>&nbsp;(MD5 hash value corresponding to the OID value <em>1.3.6.1.4.1.311.21.8.868518.12957973.4869258.12250419.[REDACTED].[REDACTED].[REDACTED].[REDACTED]<\/em>)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If none of the OID values are present, the method returns false.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This helper method returns true if the certificate passed to the method contains one of the two magic OID values listed above.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"hook-method-begingetclientcertificate\">Hook method: <em>BeginGetClientCertificate()<\/em><\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"332\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig14-BeginGetClientCertificate-hooking-legitimate-target-method.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120734\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig14-BeginGetClientCertificate-hooking-legitimate-target-method.png 960w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig14-BeginGetClientCertificate-hooking-legitimate-target-method-300x104.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig14-BeginGetClientCertificate-hooking-legitimate-target-method-768x266.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><figcaption class=\"wp-element-caption\">Figure 14. MagicWeb\u2019s <em>BeginGetClientCertificate()<\/em> method, used to hook the legitimate target method <em>GetClientCertificate()<\/em> (from <em>Microsoft.IdentityServer.WebHost.dll<\/em>)<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To retrieve the client\u2019s X509 certificate, this method first calls the legitimate <em>GetClientCertificate()<\/em> method from <em>Microsoft.IdentityServer.WebHost.dll<\/em>. Next, the hook method calls the helper method <em>ValidateX509Extensions()<\/em> to determine whether the client certificate contains one of the two \u201cmagic\u201d OID values. If the client certificate contains one of the two OID values, the hook method:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">Obtains the <em>_adapter<\/em> field from the current object<\/li>\n\n\n\n<li class=\"wp-block-list-item\">Obtains the <em>_request<\/em> field from the <em>_adapter<\/em> object<\/li>\n\n\n\n<li class=\"wp-block-list-item\">Sets the value of the <em>m_ClientCertificateError<\/em> field (from the <em>_request<\/em> object) to 0<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This means that regardless of what the legitimate method <em>GetClientCertificate()<\/em> (from <em>Microsoft.IdentityServer.WebHost.dll<\/em>) sets the <em>m_ClientCertificateError<\/em> field to, if a client certificate contains one of the magic OID values, the hook method overwrites or sets the <em>m_ClientCertificateError<\/em> field to 0.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By using this technique, the hook method appears to be influencing the normal behavior of the application to treat or accept a non-valid client certificate as a valid certificate.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"hook-method-beginprocessclaims\">Hook method: <em>BeginProcessClaims()<\/em><\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"361\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig15b-BeginProcessClaims-magicweb.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-121043\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig15b-BeginProcessClaims-magicweb.png 960w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig15b-BeginProcessClaims-magicweb-300x113.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig15b-BeginProcessClaims-magicweb-768x289.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><figcaption class=\"wp-element-caption\">Figure 15. The <em>BeginProcessClaims()<\/em> method of MagicWeb, used to hook the legitimate target method <em>ProcessClaims() <\/em>(from <em>Microsoft.IdentityServer.Service.dll<\/em>)<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The hook method first indirectly invokes the legitimate <em>ProcessClaims()<\/em> method by invoking the <em>ProcessClaims()<\/em> method of the <em>AuthLog<\/em> class.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On line 198 in figure 16, the hook method calls MagicWeb\u2019s helper method <em>GetClaims()<\/em>, passing in the <em><u>processed<\/u><\/em> identity object returned by invoking the legitimate <em>ProcessClaims()<\/em> method.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"355\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig16-getclaims-helper-method.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120743\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig16-getclaims-helper-method.png 960w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig16-getclaims-helper-method-300x111.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig16-getclaims-helper-method-768x284.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><figcaption class=\"wp-element-caption\">Figure 16. The <em>GetClaims()<\/em> helper method<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As shown above, the <em>GetClaims()<\/em> method accepts an identity object as a parameter. The method then initializes three variables named <em>type<\/em>, <em>type2<\/em>, and <em>type3<\/em> with values obtained from the <em>RuntimeHelper<\/em>\u2019s static field\/array named <em>types<\/em>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"108\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig17-initialized-values.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120746\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig17-initialized-values.png 600w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig17-initialized-values-300x54.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption class=\"wp-element-caption\">Figure 17. The three variables initialized with values<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The <em>types<\/em> field contains the following values:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"194\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig18-values-in-types-field.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120749\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig18-values-in-types-field.png 956w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig18-values-in-types-field-300x61.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig18-values-in-types-field-768x156.png 768w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><figcaption class=\"wp-element-caption\">Figure 18. Values in the <em>types<\/em> field<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The <em>assemblyByName2<\/em> variable above contains an assembly object representing the legitimate assembly <em>Microsoft.IdentityServer.IdentityModel.dll<\/em> (if not already loaded, the <em>RuntimeHelper<\/em> class loads the assembly into the current application domain). By calling the <em>GetType()<\/em> method, <em>RunHelper<\/em> initializes the member of the <em>types<\/em> field\/array with .NET types from the <em>Microsoft.IdentityServer.IdentityModel.dll<\/em> assembly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Returning to the <em>GetClaims()<\/em> method and the initialization of <em>type<\/em>, <em>type2<\/em>, and <em>type3<\/em> the variables <em>type<\/em>, <em>type2<\/em>, and <em>type3<\/em> get initialized with the following type objects from <em>Microsoft.IdentityServer.IdentityModel.dll<\/em>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">type:&nbsp;<em>Microsoft.IdentityModel.Claims.IClaimsIdentity<\/em> type object<\/li>\n\n\n\n<li class=\"wp-block-list-item\">type2:&nbsp;<em>Microsoft.IdentityModel.Claims.ClaimCollection<\/em> type object<\/li>\n\n\n\n<li class=\"wp-block-list-item\">type3:&nbsp;<em>Microsoft.IdentityModel.Claims.Claim<\/em> type object<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Next, the <em>GetClaims()<\/em> method retrieves the <em>Claims<\/em> property of the <em>Microsoft.IdentityModel.Claims.IclaimsIdentity<\/em> identity object. It also retrieves the number of claims (of type <em>Microsoft.IdentityModel.Claims.ClaimCollection<\/em>) present in the <em>Claims<\/em> property:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"793\" height=\"51\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig19-getclaims-retrieving-claims-property.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120752\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig19-getclaims-retrieving-claims-property.png 793w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig19-getclaims-retrieving-claims-property-300x19.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig19-getclaims-retrieving-claims-property-768x49.png 768w\" sizes=\"auto, (max-width: 793px) 100vw, 793px\" \/><figcaption class=\"wp-element-caption\">Figure 19. <em>GetClaims()<\/em> retrieving the Claims property<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><em>GetClaims()<\/em> then enumerates the claims (of type <em>Microsoft.IdentityModel.Claims.Claim<\/em>), retrieving the string containing each claim and the corresponding claim type:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"959\" height=\"208\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig20-getclaims-enumerating-claims.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120755\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig20-getclaims-enumerating-claims.png 959w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig20-getclaims-enumerating-claims-300x65.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig20-getclaims-enumerating-claims-768x167.png 768w\" sizes=\"auto, (max-width: 959px) 100vw, 959px\" \/><figcaption class=\"wp-element-caption\">Figure 20. <em>GetClaims()<\/em> enumerating the claims, retrieving the strings, and storing in list<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As shown above, the claim string and claim type string are then stored in a list named <em>list<\/em>. This list of claims and their corresponding claim types is then returned to the caller of the <em>GetClaims()<\/em> method, <em>BeginProcessClaims()<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Returning to the <em>BeginProcessClaims()<\/em> method, after retrieving the claims using the <em>GetClaims()<\/em> method, the hook method <em>BeginProcessClaims()<\/em> searches the claims list for presence of a claim with claim type of <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences:<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"945\" height=\"46\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig21-BeginProcessClaims-searching-claims-list.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120758\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig21-BeginProcessClaims-searching-claims-list.png 945w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig21-BeginProcessClaims-searching-claims-list-300x15.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig21-BeginProcessClaims-searching-claims-list-768x37.png 768w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig21-BeginProcessClaims-searching-claims-list-930x46.png 930w\" sizes=\"auto, (max-width: 945px) 100vw, 945px\" \/><figcaption class=\"wp-element-caption\">Figure 21. <em>BeginProcessClaims()<\/em> searching the claims list for a specific claim<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As shown on line 198 above, the claim(s) of type <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences<\/em> (if any) is stored in a list named <em>list<\/em>. If claim of type <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences<\/em> is present and its value is set to <em>http:\/\/schemas.microsoft.com\/claims\/multipleauthn<\/em>, the hook method returns the&nbsp;<em>IclaimsIdentity<\/em> object returned by the legitimate target method <em>ProcessClaims()<\/em> (from <em>Microsoft.IdentityServer.Service.dll<\/em>) on line 191 of the hook method.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This behavior ensures that if MFA is already satisfied, then the hook method simply acts as a pass-through method and doesn\u2019t affect the normal behavior of the claim processing pipeline.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If a claim of type <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences<\/em> is <em>not <\/em>present or its value is <em>not <\/em>set to <em>http:\/\/schemas.microsoft.com\/claims\/multipleauthn<\/em>, the hook method proceeds to perform additional checks on the <em><u>unprocessed<\/u> <\/em>claims (that is, the claims contained in the unprocessed identity object <em>identity<\/em> passed to the hook method). Once again, the hook method obtains a list of claims by calling the <em>GetClaims()<\/em> helper method. As mentioned above, instead of calling the <em>GetClaims()<\/em> helper method with the processed identity object returned by invoking the legitimate <em>ProcessClaims()<\/em> method (stored in the <em>result<\/em> variable on line 191), the hook method calls the <em>GetClaims()<\/em> helper method with the unprocessed identity object <em>identity<\/em> passed to the hook method:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"948\" height=\"59\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig22-hook-method-calling-GetClaims.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120761\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig22-hook-method-calling-GetClaims.png 948w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig22-hook-method-calling-GetClaims-300x19.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig22-hook-method-calling-GetClaims-768x48.png 768w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig22-hook-method-calling-GetClaims-930x59.png 930w\" sizes=\"auto, (max-width: 948px) 100vw, 948px\" \/><figcaption class=\"wp-element-caption\">Figure 22. The hook method calling <em>GetClaims()<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">On line 204, the hook method enumerates the value of each claim and uses the <em>ComputeHash()<\/em> helper method to calculate the MD5 hash value of each claim value (from the <em><u>unprocessed <\/u><\/em>identity object). It then checks if the MD5 value of any of the claims equals the MD5 hash value <em>6E3466296D2F63DE[REDACTED]<\/em>. This hash value is the only element of a hardcoded hash list named <em>oidMFAHashes<\/em> (that is, this list can be expanded to include other hash values of interest):<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"115\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig23-hardcoded-hash-list-containing-md5-hash.png\" alt=\"Screenshot of a section of a configuration file with a partially redacted hash value.\" class=\"wp-image-120764\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig23-hardcoded-hash-list-containing-md5-hash.png 802w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig23-hardcoded-hash-list-containing-md5-hash-300x43.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig23-hardcoded-hash-list-containing-md5-hash-768x110.png 768w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><figcaption class=\"wp-element-caption\">Figure 23. Hardcoded hash list containing the MD5 hash value of a magic OID valuea<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If none of the claims have a value with MD5 hash value of <em>6E3466296D2F63DE[REDACTED]<\/em>, on line 206, the method simply returns the <em><u>processed <\/u><\/em>identity object returned by the legitimate target method <em>ProcessClaims()<\/em> (from <em>Microsoft.IdentityServer.Service.dll<\/em>) on line 191 of the hook method. As previously discussed, the hash value <em>6E3466296D2F63DE[REDACTED]<\/em> corresponds to the OID value <em>1.3.6.1.4.1.311.21.8.868518.12957973.4869258.12250419.[REDACTED].[REDACTED].[REDACTED].[REDACTED]<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hence, the hook method enumerates the claims and if a claim with value <em>1.3.6.1.4.1.311.21.8.868518.12957973.4869258.12250419.[REDACTED].[REDACTED].[REDACTED].[REDACTED]<\/em> isn\u2019t present on the claim list, the hook method simply acts as a pass-through method and doesn\u2019t affect the normal behavior of claim processing pipeline.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If by this point in the execution cycle the hook method hasn\u2019t returned yet, it means one of the claims contains the OID value <em>1.3.6.1.4.1.311.21.8.868518.12957973.4869258.12250419.[REDACTED].[REDACTED].[REDACTED].[REDACTED]<\/em> (otherwise, according to the logic described in the paragraph above, the hook method would\u2019ve returned).&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Proceeding with confirmation that one of the claims contains the OID value <em>1.3.6.1.4.1.311.21.8.868518.12957973.4869258.12250419.[REDACTED].[REDACTED].[REDACTED].[REDACTED]<\/em>, the hook method proceeds to the section that represents the main purpose of MagicWeb, to perform claim injection.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"169\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig24-main-section-of-code-responsible-for-claims-injection.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120767\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig24-main-section-of-code-responsible-for-claims-injection.png 960w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig24-main-section-of-code-responsible-for-claims-injection-300x53.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig24-main-section-of-code-responsible-for-claims-injection-768x135.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><figcaption class=\"wp-element-caption\">Figure 24. Main section of the code responsible for the claim injection process<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Before describing the code responsible for the claim injection process, it\u2019s important to revisit what\u2019s already stored in the <em>list<\/em> and <em>claims<\/em> variables:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\"><em>list<\/em>: As mentioned before, the hook method invokes the legitimate method <em>ProcessClaims()<\/em> to process the incoming identity object. The processed identity object (stored in <em>result<\/em> on line 191) is then passed to the <em>GetClaims()<\/em> helper method to obtain a list of claim type\/value pairs extracted from the processed identity object (line 198). After obtaining the claim type\/value pairs, the claim(s) of type <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences<\/em> (if any) are stored in a list named <em>l<\/em><em>ist<\/em> (line 198).<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"961\" height=\"75\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig25-list-variable.png\" alt=\"Screenshot of a section of a configuration file with a partially redacted hash value.\" class=\"wp-image-120770\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig25-list-variable.png 961w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig25-list-variable-300x23.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig25-list-variable-768x60.png 768w\" sizes=\"auto, (max-width: 961px) 100vw, 961px\" \/><figcaption class=\"wp-element-caption\">Figure 25. The <em>list<\/em> variable<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><em>claims<\/em>: As mentioned above, this variable is used to store a list of claim type\/value pairs extracted from the unprocessed identity object:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"959\" height=\"22\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig26-claims-variable.png\" alt=\"Screenshot of a line in a configuration file.\" class=\"wp-image-120773\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig26-claims-variable.png 959w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig26-claims-variable-300x7.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig26-claims-variable-768x18.png 768w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig26-claims-variable-930x22.png 930w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig26-claims-variable-900x22.png 900w\" sizes=\"auto, (max-width: 959px) 100vw, 959px\" \/><figcaption class=\"wp-element-caption\">Figure 26. The <em>claims <\/em>variable<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">With this information in mind (and the fact that one of the claims contains the OID value <em>1.3.6.1.4.1.311.21.8.868518.12957973.4869258.12250419.<\/em><em>[REDACTED]<\/em><em>.<\/em><em>[REDACTED]<\/em><em>.<\/em><em>[REDACTED]<\/em><em>.<\/em><em>[REDACTED]<\/em>), once again here\u2019s the first part of the claim injection code:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"175\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig27-part-of-claim-injection-code.png\" alt=\"Screenshot of a section of a configuration file with specific lines highlighted.\" class=\"wp-image-120797\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig27-part-of-claim-injection-code.png 956w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig27-part-of-claim-injection-code-300x55.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig27-part-of-claim-injection-code-768x141.png 768w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><figcaption class=\"wp-element-caption\">Figure 27. Part of the claim injection code<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As shown above, if <em>list<\/em> is empty (that is, the <span style=\"text-decoration: underline;\">processed<\/span> identity object contained no claim type\/value pairs of type <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences<\/em>), the hook method instead turns to <em>claims<\/em> (containing the list of all claim type\/value pairs extracted from the&nbsp;<span style=\"text-decoration: underline;\">unprocessed<\/span>&nbsp;identity object) and searches for claim type\/value pairs of type <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences<\/em> in the <em>claims<\/em> list. If the <em>claims<\/em> list contains one or more claim type\/value pairs of type <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences<\/em>, the hook method uses the claim information to add an identical claim of type <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences<\/em> to the <span style=\"text-decoration: underline;\">processed<\/span> identity object (line 213 above).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using this method, if after passing the identity object to the legitimate <em>ProcessClaims()<\/em> method, no claim of type <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences<\/em> is returned by the legitimate method, the hook method manually adds a fraudulent&nbsp;claim of type <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences<\/em> to the list of claims returned to the caller of the hooked legitimate method <em>ProcessClaims()<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As shown above, to add the fraudulent claim to the list of claims, the hook method calls a helper method named <em>AddClaim()<\/em>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"299\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig28-helper-method.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120776\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig28-helper-method.png 960w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig28-helper-method-300x93.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig28-helper-method-768x239.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><figcaption class=\"wp-element-caption\">Figure 28. The helper method<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Like the code in the helper method <em>GetClaims()<\/em>, <em>AddClaims()<\/em> initializes two variables with the following type objects:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\"><em>type<\/em>: <em>Microsoft.IdentityModel.Claims.IClaimsIdentity<\/em> type object<\/li>\n\n\n\n<li class=\"wp-block-list-item\"><em>type2<\/em>: <em>Microsoft.IdentityModel.Claims.ClaimCollection<\/em> type object<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">On line 235, <em>AddClaims()<\/em> gets the constructor for type <em>Microsoft.IdentityModel.Claims.Claim<\/em> and invokes the constructor (passing in the claim type and value from the caller of <em>AddClaim()<\/em>) to instantiate a new <em>Claim<\/em> object.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"945\" height=\"45\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig29-legitimate-internal-constructor.png\" alt=\"Screenshot of a line in a configuration file.\" class=\"wp-image-120782\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig29-legitimate-internal-constructor.png 945w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig29-legitimate-internal-constructor-300x14.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig29-legitimate-internal-constructor-768x37.png 768w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig29-legitimate-internal-constructor-930x45.png 930w\" sizes=\"auto, (max-width: 945px) 100vw, 945px\" \/><figcaption class=\"wp-element-caption\">Figure 29. The&nbsp;legitimate&nbsp;internal constructor from&nbsp;<em>Microsoft.IdentityModel.Claims.Claim<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The <em>legitimate <\/em>internal constructor from <em>Microsoft.IdentityModel.Claims.Claim<\/em>, retrieved and invoked by <em>AddClaim()<\/em>, invokes the internal constructor <em>Claim<\/em> (overloaded method) with the following method parameters:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"959\" height=\"333\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig30-internal-constructor-claim.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120785\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig30-internal-constructor-claim.png 959w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig30-internal-constructor-claim-300x104.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig30-internal-constructor-claim-768x267.png 768w\" sizes=\"auto, (max-width: 959px) 100vw, 959px\" \/><figcaption class=\"wp-element-caption\">Figure 30. The internal constructor Claim<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After instantiating a new <em>Claim<\/em> object, <em>AddClaim()<\/em> uses the <em>Add()<\/em> method from type <em>Microsoft.IdentityModel.Claims.ClaimCollection<\/em> to add the new claim to the identity object passed to <em>AddClaim()<\/em> by its caller (in this case, the new claim is added to the <em>identity<\/em> object containing the list of claims returned by the call to the legitimate method <em>ProcessClaims()<\/em>).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"347\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig31-legitimate-method-add.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120788\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig31-legitimate-method-add.png 800w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig31-legitimate-method-add-300x130.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig31-legitimate-method-add-768x333.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Figure 31. The legitimate method <em>Add()<\/em> from type <em>Microsoft.IdentityModel.Claims.ClaimCollection<\/em>, invoked by <em>AddClaim()<\/em> (line 245)<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Revisiting the claim injection code in the hook method <em>BeginProcessClaims()<\/em> (and recalling the fact that one of the claims contains the OID value <em>1.3.6.1.4.1.311.21.8.868518.12957973.4869258.12250419.[REDACTED].[REDACTED].[REDACTED].[REDACTED]<\/em>), here&#8217;s the second part of the claim injection code:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"175\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig32-second-part-claim-injection.png\" alt=\"Screenshot of a section of a configuration file with specific lines highlighted.\" class=\"wp-image-120791\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig32-second-part-claim-injection.png 956w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig32-second-part-claim-injection-300x55.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig32-second-part-claim-injection-768x141.png 768w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><figcaption class=\"wp-element-caption\">Figure 32. Second part of the claim injection code<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Recall that <em>list<\/em> contains claim type\/value pairs of type <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences<\/em> extracted from the processed identity object. If none of the claims in <em>list<\/em> have the value <em>http:\/\/schemas.microsoft.com\/claims\/multipleauthn<\/em>, the hook method proceeds to call <em>AddClaim()<\/em> to add a fraudulent claim of type <em>http:\/\/schemas.microsoft.com\/claims\/authnmethodsreferences<\/em> and value <em>http:\/\/schemas.microsoft.com\/claims\/multipleauthn<\/em> to the list of claims returned to the caller of the hooked legitimate method <em>ProcessClaims()<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using the fraudulent claim injection techniques described above, if a claim with the Magic OID value <em>1.3.6.1.4.1.311.21.8.868518.12957973.4869258.12250419.<\/em><em>[REDACTED]<\/em><em>.<\/em><em>[REDACTED]<\/em><em>.<\/em><em>[REDACTED]<\/em><em>.<\/em><em>[REDACTED]<\/em> is presented to AD FS, regardless of how the legitimate hooked method <em>ProcessClaims()<\/em> handles the claim, the <em>BeginProcessClaims()<\/em> hook function ensures that a claim with value <em>http:\/\/schemas.microsoft.com\/claims\/multipleauthn<\/em> is returned to the caller of the legitimate hooked method <em>ProcessClaims()<\/em>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"hook-method-beginendpointconfiguration\">Hook method:<strong> <\/strong><em>BeginEndpointConfiguration()<\/em><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The backdoor <em>BeginEndpointConfiguration()<\/em> method, used to hook the legitimate target method <em>EndpointConfiguration()<\/em> (from <em>Microsoft.IdentityServer.WebHost.dll<\/em>) is shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"959\" height=\"351\" src=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig33-BeginEndpointConfiguration-method.png\" alt=\"Screenshot of a section of a configuration file.\" class=\"wp-image-120794\" srcset=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig33-BeginEndpointConfiguration-method.png 959w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig33-BeginEndpointConfiguration-method-300x110.png 300w, https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/fig33-BeginEndpointConfiguration-method-768x281.png 768w\" sizes=\"auto, (max-width: 959px) 100vw, 959px\" \/><figcaption class=\"wp-element-caption\">Figure 33. <em>BeginEndpointConfiguration()<\/em> method<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The enumType variable is initialized with <em>RuntimeHelper.types[0]<\/em> which is a <em>Microsoft.IdentityServer.WebHost.Proxy.CertificateValidation<\/em> type object. The <em>PropertyInfo<\/em> variables <em>propertyInfo<\/em>, <em>propertyInfo2<\/em>, and <em>propertyInfo3<\/em> are initialized with property objects retrieved from &#8216;properties&#8217; field\/array of <em>RuntimeHelper<\/em>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\"><em>propertyInfo<\/em>: <em>CertificateValidation<\/em> property from type <em>Microsoft.IdentityServer.WebHost.Proxy.ProxyEndpoint<\/em> of <em>Microsoft.IdentityServer.WebHost.dll<\/em><\/li>\n\n\n\n<li class=\"wp-block-list-item\"><em>propertyInfo2<\/em>: Path property from type <em>Microsoft.IdentityServer.WebHost.Proxy.ProxyEndpoint<\/em> of <em>Microsoft.IdentityServer.WebHost.dll<\/em><\/li>\n\n\n\n<li class=\"wp-block-list-item\"><em>propertyInfo3: <\/em>Endpoints property from type <em>Microsoft.IdentityServer.WebHost.Proxy.ProxyEndpointConfiguration<\/em> of <em>Microsoft.IdentityServer.WebHost.dll<\/em><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Next, the hook method retrieves the value of the <em>Endpoint<\/em> property of the <em>value<\/em> object that the legitimate <em>EndpointConfiguration()<\/em> method was called with. The <em>Endpoint<\/em> property holds a collection of <em>ProxyEndpoint<\/em> objects. The hook method enumerates the <em>ProxyEndpoint<\/em> objects and for each object, it checks if the value of the <em>CertificateValidation<\/em> enum is set to \u20181\u2019 which signifies \u2018<a href=\"https:\/\/docs.microsoft.com\/en-us\/openspecs\/windows_protocols\/ms-adfspip\/e54f1e02-800b-45b1-8a3e-818b4a7368c3\">SSL<\/a>\u2019. If the <em>CertificateValidation<\/em> enum for a <em>ProxyEndpoint<\/em> object is set to \u20181\u2019\/\u2019SSL\u2019, on line 165, the hook method overwrites the value of the <em>CertificateValidation<\/em> enum with \u20180\u2019 which signifies \u2018None\u2019. To ensure the change is reflected, the hook method then overwrites the <em>Endpoint<\/em> property of the <em>value<\/em> object with the updated <em>Endpoint<\/em> property containing the overwritten&nbsp;<em>CertificateValidation<\/em> enum values (that is, \u2018SSL\u2019 overwritten with \u2018None\u2019).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Behaving as a true hook method, on line 179, the method calls the legitimate <em>EndpointConfiguration()<\/em> method but with the modified &#8216;value&#8217; object.&nbsp;Hence, when the legitimate <em>EndpointConfiguration()<\/em> method is invoked during the normal operation of AD FS, this hook method intercepts the call and, before passing the object to the legitimate<em> EndpointConfiguration()<\/em> method was invoked with, it overwrites the&nbsp;<em>CertificateValidation<\/em> value of each <em>ProxyEndpoint<\/em> object and only then it calls the legitimate <em>EndpointConfiguration()<\/em> method but now with modified&nbsp;<em>CertificateValidation<\/em> value(s), changed from \u2018SSL\u2019 to \u2018None\u2019.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The purpose of overwriting <em>CertificationValidation<\/em> value to \u2018None\u2019 (wherever it&#8217;s \u2018SSL\u2019) is to allow WAP to pass the request with the specific malicious certificate to AD FS for further authentication processing. According to <em>Microsoft.IdentityServer.ProxyService\/TLSClientReqeustHandler<\/em>, WAP stops sending the current request from client to AD FS if <em>CertificateValidation<\/em> is \u20181\u2019 (\u2018SSL\u2019) and the client certificate has an error during validation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"references\">References<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\"><a href=\"https:\/\/www.youtube.com\/watch?v=5dj4vOqqGZw\">\u201cI am AD FS and so can you: Attacking Active Directory Federated Services\u201d<\/a>, Austin Baker and Douglas Bienstock, Troopers 2019<\/li>\n\n\n\n<li class=\"wp-block-list-item\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/windows-server\/identity\/ad-fs\/technical-reference\/understanding-key-ad-fs-concepts\">Understanding Key Active Directory Federation Services Concepts<\/a>, Microsoft documentation<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft security researchers have discovered a post-compromise capability we\u2019re calling MagicWeb, which is used by a threat actor we track as NOBELIUM to maintain persistent access to compromised environments.<\/p>\n","protected":false},"author":150,"featured_media":120800,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ms_queue_id":[],"ep_exclude_from_search":false,"_classifai_error":"","_classifai_text_to_speech_error":"","_alt_title":"","ms-ems-related-posts":[],"footnotes":""},"post_tag":[3918,3898,3828,3906],"threat-intelligence":[3727],"content-type":[3663],"job-role":[],"product":[],"topic":[3674,3687],"coauthors":[2064,3380],"class_list":["post-120680","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-blizzard","tag-elevation-of-privilege","tag-midnight-blizzard-nobelium","tag-non-governmental-organizations","threat-intelligence-attacker-techniques-tools-and-infrastructure","content-type-research","topic-incident-response","topic-threat-intelligence","review-flag-1694638272-264","review-flag-1694638265-576","review-flag-1694638271-781","review-flag-1-1694638265-354","review-flag-2-1694638266-864","review-flag-3-1694638266-241","review-flag-4-1694638266-512","review-flag-5-1694638266-171","review-flag-6-1694638266-691","review-flag-7-1694638266-851","review-flag-8-1694638266-352","review-flag-9-1694638266-118","review-flag-and-o-1694638265-458","review-flag-new-1694638263-340"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MagicWeb: NOBELIUM\u2019s post-compromise trick to authenticate as anyone | Microsoft Security Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MagicWeb: NOBELIUM\u2019s post-compromise trick to authenticate as anyone | Microsoft Security Blog\" \/>\n<meta property=\"og:description\" content=\"Microsoft security researchers have discovered a post-compromise capability we\u2019re calling MagicWeb, which is used by a threat actor we track as NOBELIUM to maintain persistent access to compromised environments.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/\" \/>\n<meta property=\"og:site_name\" content=\"Microsoft Security Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-24T17:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-25T07:58:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/magicweb-featured-image.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1199\" \/>\n\t<meta property=\"og:image:height\" content=\"800\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Microsoft Incident Response, Microsoft Threat Intelligence\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Microsoft Incident Response, Microsoft Threat Intelligence\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"29 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/\"},\"author\":[{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/author\/detection-and-response-team-dart\/\",\"@type\":\"Person\",\"@name\":\"Microsoft Incident Response\"},{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/author\/microsoft-security-threat-intelligence\/\",\"@type\":\"Person\",\"@name\":\"Microsoft Threat Intelligence\"}],\"headline\":\"MagicWeb: NOBELIUM\u2019s post-compromise trick to authenticate as anyone\",\"datePublished\":\"2022-08-24T17:00:00+00:00\",\"dateModified\":\"2025-06-25T07:58:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/\"},\"wordCount\":5299,\"publisher\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/magicweb-featured-image.jpg\",\"keywords\":[\"Blizzard\",\"Elevation of privilege\",\"Midnight Blizzard (NOBELIUM)\",\"Non-governmental organizations (NGOs)\"],\"articleSection\":[\"Cybersecurity\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/\",\"name\":\"MagicWeb: NOBELIUM\u2019s post-compromise trick to authenticate as anyone | Microsoft Security Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/magicweb-featured-image.jpg\",\"datePublished\":\"2022-08-24T17:00:00+00:00\",\"dateModified\":\"2025-06-25T07:58:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#primaryimage\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/magicweb-featured-image.jpg\",\"contentUrl\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/magicweb-featured-image.jpg\",\"width\":1199,\"height\":800,\"caption\":\"Ground-up view of a city\u2018s architecture and skyline\u200b.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MagicWeb: NOBELIUM\u2019s post-compromise trick to authenticate as anyone\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#website\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/\",\"name\":\"Microsoft Security Blog\",\"description\":\"Expert coverage of cybersecurity topics\",\"publisher\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#organization\",\"name\":\"Microsoft Security Blog\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2018\/08\/cropped-cropped-microsoft_logo_element.png\",\"contentUrl\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2018\/08\/cropped-cropped-microsoft_logo_element.png\",\"width\":512,\"height\":512,\"caption\":\"Microsoft Security Blog\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#\/schema\/person\/a303ddd903ee1f6bdb466c5613e13076\",\"name\":\"Paul Oliveria\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/13723d0cfef3eb38a618e30474c6973cc20e266c8cac695a2f692654c26036e0?s=96&d=microsoft&r=g44680d3eed0ec5805eb065531f84c245\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/13723d0cfef3eb38a618e30474c6973cc20e266c8cac695a2f692654c26036e0?s=96&d=microsoft&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/13723d0cfef3eb38a618e30474c6973cc20e266c8cac695a2f692654c26036e0?s=96&d=microsoft&r=g\",\"caption\":\"Paul Oliveria\"},\"url\":\"https:\/\/www.microsoft.com\/en-us\/security\/blog\/author\/v-poliveria\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MagicWeb: NOBELIUM\u2019s post-compromise trick to authenticate as anyone | Microsoft Security Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/","og_locale":"en_US","og_type":"article","og_title":"MagicWeb: NOBELIUM\u2019s post-compromise trick to authenticate as anyone | Microsoft Security Blog","og_description":"Microsoft security researchers have discovered a post-compromise capability we\u2019re calling MagicWeb, which is used by a threat actor we track as NOBELIUM to maintain persistent access to compromised environments.","og_url":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/","og_site_name":"Microsoft Security Blog","article_published_time":"2022-08-24T17:00:00+00:00","article_modified_time":"2025-06-25T07:58:02+00:00","og_image":[{"width":1199,"height":800,"url":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/magicweb-featured-image.jpg","type":"image\/jpeg"}],"author":"Microsoft Incident Response, Microsoft Threat Intelligence","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Microsoft Incident Response, Microsoft Threat Intelligence","Est. reading time":"29 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#article","isPartOf":{"@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/"},"author":[{"@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/author\/detection-and-response-team-dart\/","@type":"Person","@name":"Microsoft Incident Response"},{"@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/author\/microsoft-security-threat-intelligence\/","@type":"Person","@name":"Microsoft Threat Intelligence"}],"headline":"MagicWeb: NOBELIUM\u2019s post-compromise trick to authenticate as anyone","datePublished":"2022-08-24T17:00:00+00:00","dateModified":"2025-06-25T07:58:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/"},"wordCount":5299,"publisher":{"@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#organization"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#primaryimage"},"thumbnailUrl":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/magicweb-featured-image.jpg","keywords":["Blizzard","Elevation of privilege","Midnight Blizzard (NOBELIUM)","Non-governmental organizations (NGOs)"],"articleSection":["Cybersecurity"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/","url":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/","name":"MagicWeb: NOBELIUM\u2019s post-compromise trick to authenticate as anyone | Microsoft Security Blog","isPartOf":{"@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#primaryimage"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#primaryimage"},"thumbnailUrl":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/magicweb-featured-image.jpg","datePublished":"2022-08-24T17:00:00+00:00","dateModified":"2025-06-25T07:58:02+00:00","breadcrumb":{"@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#primaryimage","url":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/magicweb-featured-image.jpg","contentUrl":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2022\/08\/magicweb-featured-image.jpg","width":1199,"height":800,"caption":"Ground-up view of a city\u2018s architecture and skyline\u200b."},{"@type":"BreadcrumbList","@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2022\/08\/24\/magicweb-nobeliums-post-compromise-trick-to-authenticate-as-anyone\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/"},{"@type":"ListItem","position":2,"name":"MagicWeb: NOBELIUM\u2019s post-compromise trick to authenticate as anyone"}]},{"@type":"WebSite","@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#website","url":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/","name":"Microsoft Security Blog","description":"Expert coverage of cybersecurity topics","publisher":{"@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#organization","name":"Microsoft Security Blog","url":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2018\/08\/cropped-cropped-microsoft_logo_element.png","contentUrl":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-content\/uploads\/2018\/08\/cropped-cropped-microsoft_logo_element.png","width":512,"height":512,"caption":"Microsoft Security Blog"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/#\/schema\/person\/a303ddd903ee1f6bdb466c5613e13076","name":"Paul Oliveria","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/13723d0cfef3eb38a618e30474c6973cc20e266c8cac695a2f692654c26036e0?s=96&d=microsoft&r=g44680d3eed0ec5805eb065531f84c245","url":"https:\/\/secure.gravatar.com\/avatar\/13723d0cfef3eb38a618e30474c6973cc20e266c8cac695a2f692654c26036e0?s=96&d=microsoft&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/13723d0cfef3eb38a618e30474c6973cc20e266c8cac695a2f692654c26036e0?s=96&d=microsoft&r=g","caption":"Paul Oliveria"},"url":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/author\/v-poliveria\/"}]}},"bloginabox_animated_featured_image":null,"bloginabox_display_generated_audio":false,"distributor_meta":false,"distributor_terms":false,"distributor_media":false,"distributor_original_site_name":"Microsoft Security Blog","distributor_original_site_url":"https:\/\/www.microsoft.com\/en-us\/security\/blog","push-errors":false,"_links":{"self":[{"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/posts\/120680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/users\/150"}],"replies":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/comments?post=120680"}],"version-history":[{"count":3,"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/posts\/120680\/revisions"}],"predecessor-version":[{"id":140216,"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/posts\/120680\/revisions\/140216"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/media\/120800"}],"wp:attachment":[{"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/media?parent=120680"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/post_tag?post=120680"},{"taxonomy":"threat-intelligence","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/threat-intelligence?post=120680"},{"taxonomy":"content-type","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/content-type?post=120680"},{"taxonomy":"job-role","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/job-role?post=120680"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/product?post=120680"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/topic?post=120680"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/wp-json\/wp\/v2\/coauthors?post=120680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}