Categories
Tags
604 words
3 minutes
Abusing Group Policy Objects (GPOs) for Privilege Escalation and Domain Compromise
Table of Contents
- Abusing Group Policy Objects (GPOs)
Abusing Group Policy Objects (GPOs)
What is GPO?
- Group Policy Objects (GPOs) are a feature of Active Directory used to manage settings and policies across devices in a network.
- GPOs can control various aspects of system behavior such as security settings, software installation, login scripts, and more.
How GPO Works
- GPOs are applied to computers and users in a domain to enforce system-wide settings.
- These settings can be applied at different levels: local, site, domain, or organizational unit (OU).
- The two main categories of GPO settings:
- Computer Configuration: Applies to computer settings (e.g., security policies, software installation).
- User Configuration: Applies to user settings (e.g., login scripts, desktop settings).
How GPO Can Be Abused
1. Gaining Access to GPO
- Privilege Escalation: A hacker needs elevated privileges (admin or domain admin) to modify GPO settings. This can be achieved through:
- Exploiting vulnerabilities in Windows services.
- Misconfigured accounts with low-level privileges.
- Exploiting Weak Credentials: Attackers can use weak or default credentials to gain access to systems and escalate privileges.
2. Manipulating GPO
Once access is gained, the attacker can modify the GPO to achieve malicious objectives:
- Executing Malicious Scripts on Logon: Attackers can modify the “Logon Scripts” in GPO to execute malicious code (e.g., reverse shells, keyloggers) whenever a user logs in.
- Example: Modify GPO to run a PowerShell script on user login that opens a reverse shell.
- Disabling Security Features: Attackers can disable Windows Defender, firewalls, or UAC (User Account Control) to make the system more vulnerable.
- Example: Disable Windows Defender or firewall settings via GPO to allow malicious traffic or malware.
- Changing Security Policies: Modify security policies to weaken the system’s defenses.
- Example: Disable password complexity or account lockout policies to facilitate brute-force attacks.
3. Exploiting Group Policy Preferences
- Group Policy Preferences (GPP) are a feature that allows administrators to configure settings like network drives, scheduled tasks, and user accounts.
- Abusing GPP: Attackers can extract sensitive information like passwords stored in the registry or configuration files via GPP.
- Example: Extracting clear-text passwords from GPP configuration files.
Examples of GPO Abuse
Example 1: Executing Malicious Scripts on Logon
- Gain access to the GPO with administrative privileges.
- Navigate to User Configuration > Windows Settings > Scripts (Logon/Logoff).
- Add a PowerShell script that executes malicious code (e.g., reverse shell or RAT).
- When a user logs in, the script runs, allowing the attacker to gain control of the machine.
Example 2: Disabling Security Features
- Gain access to the GPO.
- Navigate to Computer Configuration > Administrative Templates > Windows Components > Windows Defender Antivirus.
- Disable Windows Defender or other security tools.
- The system becomes vulnerable to malware and attacks.
Example 3: Exploiting Group Policy Preferences (GPP)
- Access the GPO and navigate to Computer Configuration > Preferences > Control Panel Settings > Local Users and Groups.
- Look for any saved passwords or sensitive information stored in clear text.
- Extract the passwords or configuration details and use them to escalate privileges or gain access to other systems.
Steps to Execute GPO Abuse Attack
1. Privilege Escalation
- Tools: Use tools like Mimikatz to extract credentials or PowerShell Empire to execute commands remotely.
- Exploiting SMB, Kerberos, or Windows Vulnerabilities: Use known vulnerabilities to escalate privileges on the network.
2. Accessing GPO
- Tools: Use GPMC (Group Policy Management Console) to access and modify GPOs.
- If GPMC is unavailable, use PowerShell to manipulate GPO settings remotely.
3. Modifying GPO to Execute Malicious Actions
- Login Scripts: Modify the Logon Scripts section to run malicious code (e.g., reverse shells, keyloggers).
- Disabling Security: Disable security tools like Windows Defender or UAC.
- Changing Password Policies: Weakening password policies to allow easier brute-force attacks.
Happy Hacking Broo
Abusing Group Policy Objects (GPOs) for Privilege Escalation and Domain Compromise
https://bad-glitch.github.io/posts/privilege-escalation/gpo/abusing-gpo/