GPOs and OUs

What are OUs?

In Windows 2000 and AD, groups have the same function that they have in Windows NT or other OSs: You put a user in a group to control that user's access to resources. You put a user in an OU to control who has administrative authority over that user.

To understand the difference between groups and OUs, consider this: Objects with SIDs (i.e., users, groups, and computers) can act on objects and be granted authority. Groups have a SID, and OUs don't.

Enumerate GPO locally

Output:

GPO Location

  • \\DOMAIN.COM\SysVol\dev-studio.com\Policies{7E1E1636-1A59-4C35-895B-3AEB1CA8CFC2}\Machine\Registry.pol

Contents of .pol file:

Reading contents of registry key:

Logging

Requires advanced auditing configs to be enable. Found in security.evtx

Event ID
Description

5136

A directory service object was successfully modified

5136

A directory service object was successfully created

5138

A directory service object was successfully undeleted

5139

A directory service object was successfully moved

5141

A directory service object was successfully deleted

Event Viewer (default config?)

Microsoft-Windows-GroupPolicy/Operational

Investigate

When a scheduled task or file execution is seen on multiple machines, it indicates remote execution or the use of Group Policy. When system logs indicating the use of software deployment tools or Windows Management Instrumentation are not present, it serves as an indication that Group Policy was likely compromised.

Case Study

Look for last modified in GPO policies:

  • C:\Windows\sysvol\miko.local\Policies\

PowerShell query to get last modified/created GPOs.

Output:

Get .pol file and parse locally.

  • C:\Windows\SysVol\DOMAIN.com\Policies{7E1E1636-1A59-4C35-895B-3AEB1CA8CFC2}\Machine\Registry.pol

Output report and download/parse locally. Look for startup scripts.

HTML File Example

Startup scripts:

  • Computers|Users\Policies\Windows Settings\Scripts\Startup

Scheduled Task:

  • Computers|Users\Preferences\Control Panel Settings\Scheduled Tasks

Registry

GPO History:

  • HKLMSoftware\Microsoft\Windows\CurrentVersion\Group Policy\History

To list child OUs, you can run this command:

get GPO linked to OU and its child OU

ADMX Files:

ADMX (and their associated, language-specific ADML files) are XML files that allow Group Policy to render UI within the Group Policy Editor, in the Administrative Templates namespace.

What is rendered:

Hijacking ADMX:

Changing the location of the of the registry key will essentially hijack a registry key. If one were to change the location of the below "SyncForegroundPolicy" key to another location like "EnableLUA", then whenever the "SyncForegroundPolicy" key is disabled, then it would actual disable the "EnableLUA" key instead.

Gotcha's:

  • If one were to replace the ADMX files, you would need to manually modify the status of the GPO for it to take affect.

  • Once an ADMX file is hijacked there is no visual notification of it for the administrator who’s in GP Editor

Example:

  • key="Software\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon" valueName="SyncForegroundPolicy">

  • key="Software\Microsoft\Windows\CurrentVersion\Policies\System" valueName="EnableLUA">

ADMX Central Store Locations:

  • Workstations:

    • C:\Windows\PolicyDefinitions

  • Domain Controllers:

    • C:\Windows\SYSVOL\domain\Policies\PolicyDefinitions

    • \\contoso.com\SYSVOL\contoso.com\policies\PolicyDefinitions

Attack:

  • If the attacker only has permissions to edit the ADMX file, modify the ADMX file and registry location of a key that is constantly switched.

  • If the attacker has permissions to edit ADMX files and modify the GPO, modify the file and then enable/disable for it to take affect.

Defense:

  • User's who can edit the ADMX Central Store should be Tier 0.

  • Monitor changes to the files and folders in the ADMX Central Store.

Last updated