Cyber Security News

Custom Active Directory Extensions Create Stealthy Backdoors for Corporate Attacks

Active Directory (AD) Group Policy Objects (GPOs) are a cornerstone of centralized management for Windows environments, enabling administrators to configure operating systems, applications, and user settings across all domain-connected machines.

The real work of applying these policies on client machines is handled by Client-Side Extensions (CSEs)—specialized dynamic link libraries (DLLs) that interpret and enforce GPO settings.

Each CSE is uniquely identified by a Globally Unique Identifier (GUID) and registered in the Windows Registry under:

textHKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions

Administrators and attackers alike can enumerate CSEs using PowerShell:

powershellGet-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions" | 
    Select-Object @{Name='GUID';Expression={$_.PSChildName}}, @{Name='Name';Expression={$_.GetValue('')}}

The proper application of a GPO depends on the presence and correct registration of the CSE both on the client and within the GPO’s attributes (gPCMachineExtensionNames or gPCUserExtensionNames).

If these are misconfigured, policy enforcement fails.

Crafting and Registering a Malicious Custom CSE

While defenders are familiar with attacks leveraging built-in CSEs (such as those for Scheduled Tasks or File deployment), attackers can dramatically increase stealth by creating custom CSEs with unknown GUIDs.

This approach is not widely documented, making detection significantly harder1.

Minimal Malicious CSE DLL

A custom CSE can be created in C++ using Visual Studio.

The DLL must export a function named ProcessGroupPolicy, which the Group Policy engine will call.

Here’s a simplified code snippet:

cpp// advshcore.def
LIBRARY "advshcore"
EXPORTS
    ProcessGroupPolicy
    DllRegisterServer PRIVATE
    DllUnregisterServer PRIVATE
cpp// dllmain.cpp (partial)
DWORD CALLBACK ProcessGroupPolicy(
    DWORD dwFlags,
    HANDLE hToken,
    HKEY hKeyRoot,
    PGROUP_POLICY_OBJECT pDeletedGPOList,
    PGROUP_POLICY_OBJECT pChangedGPOList,
    ASYNCCOMPLETIONHANDLE pHandle,
    BOOL* pbAbort,
    PFNSTATUSMESSAGECALLBACK pStatusCallback)
{
    LogToFile(TEXT("ProcessGroupPolicy called"));
    LogExecutionContext();
    return ERROR_SUCCESS;
}

After compiling, the attacker registers the DLL with:

textregsvr32 "advshcore.dll"

The registry is updated to link the custom GUID to the DLL and associate it with the necessary GPO attributes.

Registry Settings for CSE

Registry KeyValue/SettingPurpose
(Default)“Group Policy Shell Config”Friendly name for the CSE
DllName“advshcore.dll”Path to the DLL
NoGPOListChanges0Always call ProcessGroupPolicy
ProcessGroupPolicy“ProcessGroupPolicy”Exported function to execute

Deployment, Detection, and Defense

Once registered and linked to a GPO, the custom CSE executes with SYSTEM privileges during every Group Policy refresh—every 5 minutes on domain controllers and every 90 minutes on member machines.

Attackers can distribute the DLL via SYSVOL shares or use Group Policy Preferences to copy and register the DLL on multiple endpoints.

However, this technique leaves traces that vigilant defenders can monitor:

  • Event ID 5145: Detects write access to SYSVOL, signaling potential DLL drops.
  • Event ID 4688: Monitors process creation, such as regsvr32 or startup scripts.
  • Event ID 5136: Flags unauthorized changes to GPO attributes like gPCMachineExtensionNames.

Detection Points for Custom CSE Abuse

Detection PointEvent IDWhat to Monitor
SYSVOL Write Access5145DLL copy or GPO file/script modification
Process Creation4688regsvr32, cmd.exe, or suspicious scripts
GPO Attribute Change5136Modifications to gPCMachineExtensionNames

The Need for Proactive Monitoring

Custom CSE abuse represents a stealthy and persistent backdoor method in AD environments.

Because these extensions run as trusted SYSTEM processes and use native Windows mechanisms, they are difficult to detect with traditional security tools.

Continuous monitoring of GPO changes, CSE registrations, and related event logs is essential for defending against this advanced attack vector.

Find this News Interesting! Follow us on Google News, LinkedIn, & X to Get Instant Updates!.

Anupriya

Any Priya is a cybersecurity reporter at GBHackers On Security, specializing in cyber attacks, dark web monitoring, data breaches, vulnerabilities, and malware. She delivers in-depth analysis on emerging threats and digital security trends.

Recent Posts

Hackers Use ConnectWise SkyKick Credentials to Access Microsoft 365, Halting Cloud Backups

Attackers abused compromised ConnectWise Cloud Backup credentials to access Microsoft 365 customer environments, prompting ConnectWise…

1 day ago

Anthropic’s Claude AI Uncovers Origins of NSA-Provided Cryptographic Keys After 25 Years

Anthropic says an internal Claude research model reconstructed how the National Security Agency generated seeds…

1 day ago

Critical WordPress Flaws Allow Attackers to Execute Remote Code Without Authentication

Two WordPress Core vulnerabilities can be chained to execute remote code without authentication, according to…

1 day ago

OpenBSD Kernel Flaw Dating Back 37 Years Enables Local Privilege Escalation to Root

A newly disclosed OpenBSD kernel exploitation chain combines a shared memory accounting flaw with a…

1 day ago

GhostAction Hackers Hide Credential-Stealing Malware in Fake Font Files Across 94 GitHub Repositories

GhostAction attackers have expanded their GitHub credential theft campaign with a second stage that disguises…

1 day ago

SideCopy Hackers Target Indian Organizations With ReverseRAT Malware to Steal Data

Indian authorities have warned that SideCopy hackers are targeting Indian organizations, including academic institutions, with…

1 day ago