SlideShare a Scribd company logo
(Ab)Using GPOs For Active Directory Pwnage
Petros Koutroumpis - @pkb1s
Dennis Panagiotopoulos - @den_n1s
Red Team Village | DEF CON 27
Agenda
• GPO Internals
• Hunting for weak GPO permissions
• Example scenarios
• Exploitation methods and SharpGPOAbuse
Previous Work
• @grouppolicyguy - https://sdmsoftware.com
• @_wald0 - https://wald0.com
• @PyroTek3 - https://adsecurity.org
• @harmj0y - http://www.harmj0y.net
• @_RastaMouse - https://rastamouse.me
What is a GPO?
• Allows administrators to easily control the settings deployed to clients
within an Active Directory environment.
• Configure settings for User and Computer accounts
• Can be Local or in Active Directory
Components of a GPO
• Group Policy Container (GPC)
• Group Policy Template (GPT)
Also,
• Client-Side Extensions (CSEs)
Group Policy Container (GPC)
• displayName
• gPCFileSysPath
• versionNumber
• gPCMachineExtensionNames and gPCUserExtensionNames
Group Policy Container (GPC)
Important Attributes:
Group Policy Template (GPT)
Client-Side Extensions (CSEs)
• DLLs installed on clients
• Used to process GPO settings
• Identified by a GUID
• Found in the gPCMachineExtensionNames and
gPCUserExtensionNames attributes of a GPO
• Special order
Client-Side Extensions (CSEs)
• gPCMachineExtensionNames value when Audit Policy is configured
[
{827D319E-6EAC-11D2-A4EA-00C04F79F83A} //Security Settings
{803E14A0-B4FB-11D0-A0D0-00A0C90F574B} //Computer Restricted Groups
]
• gPCMachineExtensionNames value after adding a Startup Script
[
{42B5FAAE-6536-11D2-AE5A-0000F87571E3} //Process Scripts Group Policy
{40B6664F-4972-11D1-A7CA-0000F87571E3} //Startup - Shutdown Scripts
]
[
{827D319E-6EAC-11D2-A4EA-00C04F79F83A} //Security Settings
{803E14A0-B4FB-11D0-A0D0-00A0C90F574B} //Computer Restricted Groups
]
Client-Side Extensions (CSEs)
https://blogs.technet.microsoft.com/mempson/2010/12/01/group-policy-client-side-extension-list/
GPO Precedence and Inheritance
What happens when multiple GPOs apply to a client?
• Local
• Site
• Domain
• OU
GPO Precedence and Inheritance
• What happens when multiple GPOs are linked to the same OU?
Blocking and Enforcement
Settings that can affect the GPO processing order:
• Block Inheritance
• Enforcement
Enforcement and Precedence
Enforcement and Precedence
Enforcement and Precedence
GPO Processing
There are 2 types of GPO processing:
• Foreground
– All settings are processed
– Affects login/logoff times
• Background
– Applied at regular intervals
– Not all settings are processed
The GpLink Attribute
The GpLink Attribute
GPLinkOptions:
• 0: The GPO is not enforced. This is the default value
• 1: The GPO link is not enabled
• 2: The GPO is enforced
• 3: The GPO is enforced but not enabled
[LDAP://cn={9CD1C444-260F-40C6-A67B-E178446622A5},cn=policies,cn=system,DC=europa,DC=com;0]
[LDAP://cn={77D3AFFC-1292-4DBE-AE89-CEDEE60BAD0E},cn=policies,cn=system,DC=europa,DC=com;2]
[LDAP://cn={C877A421-BF69-439E-89C3-99CF82C71299},cn=policies,cn=system,DC=europa,DC=com;2]
Bringing everything together
Bringing everything together
Bringing everything together
Bringing everything together
Bringing everything together
Bringing everything together
GPO Permissions
• Owns
• GenericAll
• GenericWrite
• WriteProperty
• WriteDACL
• WriteOwner
https://www.specterops.io/assets/resources/an_ace_up_the_sleeve.pdf
Hunting for weak GPO permissions
Tools of the trade:
• accesschk.exe, icacls, etc
• BloodHound
– https://github.com/BloodHoundAD/BloodHound
• PowerView
– https://github.com/PowerShellMafia/PowerSploit
• Grouper2
– https://github.com/l0ss/Grouper2
BloodHound
• Released in 2016 by @_wald0, @CptJesus and @harmj0y
• Uses graph theory to reveal relationships between active directory
components
• An ingestor collects data that can be loaded onto a neo4j database
• Useful for both Red and Blue teams
BloodHound
BloodHound and GPOs
• If a gPLink is dotted then the GPO is not enforced
• If a gPLink is solid then the GPO is Enforced
• If a Contains link is dotted then Block Inheritance is enabled
BloodHound and GPOs
BloodHound and GPOs
What about in real life?
• Misconfigurations are very common
• Multiple instances where arbitrary “low-privileged” users were able to
modify a GPO
Example 1 – Compromise Computer
Example 2 – Compromise User
Exploiting these scenarios
• Group Policy Management Console (GPMC)
• Manually edit GPC and GPT
• SharpGPOAbuse 
Group Policy Management Console (GPMC)
Manual Exploitation
• Each GPO settings has different dependencies:
– Hidden .ini files
– Various .xml files
• Error prone
• Time consuming
Manual Exploitation
Things to be remember:
• CSE order in gPCMachineExtensionNames and
gPCUserExtensionNames
• Version number in GPT.ini and versionNumber attribute must be the
same.
– versionNumber = {User Node: upper 16 bits}{Machine Node: lower 16 bits}
Manual Exploitation
Adding a user to the local Administrators group:
• Find the SID of the user we want to add as a local admin
• Get the GUID of the target GPO
• Create SYSVOLdomainPolicies{GUID}MachineMicrosoftWindows
NTSecEditGptTmpl.inf with the following contents:
[Unicode]
Unicode=yes
[Version]
signature="$CHICAGO$"
Revision=1
[Group Membership]
*S-1-5-32-544__Memberof =
*S-1-5-32-544__Members = *<USER-SID>
Manual Exploitation
• Calculate the new GPO version
• Update the value of the version parameter in
SYSVOLdomainPolicies{GUID}GPT.ini
• Update the versionNumber attribute in the GPC
• Find the values of the required CSEs and add them sorted in the
gPCMachineExtensionNames attribute of the GPO object
• Hope you didn’t mess anything up 
SharpGPOAbuse
• .NET application written in C#
• Simplifies the process – a lot
• Can be used to exploit both Computer and User GPO settings
SharpGPOAbuse - Functionality
Currently supports the following:
• Add rights to user (SeDebugPrivilege, SeImpersonatePrivilege, etc.)
• Add startup scripts
• Add immediate tasks to user or computer
• Add user to local Administrators group
Example 1 – Compromise Computer
Example 2 – Compromise User
Bonus - What about cross domain?
• GPOs can also apply to different domains
• New PR to SharpHound
• You can use SharpGPOAbuse to abuse this scenario as well 
Bonus - What about cross domain?
Related Links
SharpGPOAbuse
• https://github.com/mwrlabs/SharpGPOAbuse
Additional Links
• https://blogs.technet.microsoft.com/musings_of_a_technical_tam/2012/02/13/group-policy-
basics-part-1-understanding-the-structure-of-a-group-policy-object/#comments
• http://www.harmj0y.net/blog/redteaming/abusing-gpo-permissions/
• https://wald0.com/?p=179
• https://adsecurity.org/?p=2716
• https://rastamouse.me/2019/01/gpo-abuse-part-2/
• https://rastamouse.me/2019/01/gpo-abuse-part-1/
The End
Questions?

More Related Content

What's hot

Six Degrees of Domain Admin - BloodHound at DEF CON 24
Six Degrees of Domain Admin - BloodHound at DEF CON 24Six Degrees of Domain Admin - BloodHound at DEF CON 24
Six Degrees of Domain Admin - BloodHound at DEF CON 24
Andy Robbins
 
FreeIPA - Attacking the Active Directory of Linux
FreeIPA - Attacking the Active Directory of LinuxFreeIPA - Attacking the Active Directory of Linux
FreeIPA - Attacking the Active Directory of Linux
Julian Catrambone
 
Fantastic Red Team Attacks and How to Find Them
Fantastic Red Team Attacks and How to Find ThemFantastic Red Team Attacks and How to Find Them
Fantastic Red Team Attacks and How to Find Them
Ross Wolf
 
I hunt sys admins 2.0
I hunt sys admins 2.0I hunt sys admins 2.0
I hunt sys admins 2.0
Will Schroeder
 
Hunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows EnvironmentHunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows Environment
Teymur Kheirkhabarov
 
No Easy Breach DerbyCon 2016
No Easy Breach DerbyCon 2016No Easy Breach DerbyCon 2016
No Easy Breach DerbyCon 2016
Matthew Dunwoody
 
Abusing Microsoft Kerberos - Sorry you guys don't get it
Abusing Microsoft Kerberos - Sorry you guys don't get itAbusing Microsoft Kerberos - Sorry you guys don't get it
Abusing Microsoft Kerberos - Sorry you guys don't get it
Benjamin Delpy
 
A Threat Hunter Himself
A Threat Hunter HimselfA Threat Hunter Himself
A Threat Hunter Himself
Sergey Soldatov
 
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
DirkjanMollema
 
The Travelling Pentester: Diaries of the Shortest Path to Compromise
The Travelling Pentester: Diaries of the Shortest Path to CompromiseThe Travelling Pentester: Diaries of the Shortest Path to Compromise
The Travelling Pentester: Diaries of the Shortest Path to Compromise
Will Schroeder
 
Windows Threat Hunting
Windows Threat HuntingWindows Threat Hunting
Windows Threat Hunting
GIBIN JOHN
 
Not a Security Boundary
Not a Security BoundaryNot a Security Boundary
Not a Security Boundary
Will Schroeder
 
Hunting for Privilege Escalation in Windows Environment
Hunting for Privilege Escalation in Windows EnvironmentHunting for Privilege Escalation in Windows Environment
Hunting for Privilege Escalation in Windows Environment
Teymur Kheirkhabarov
 
The Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active DirectoryThe Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active Directory
Will Schroeder
 
SpecterOps Webinar Week - Kerberoasting Revisisted
SpecterOps Webinar Week - Kerberoasting RevisistedSpecterOps Webinar Week - Kerberoasting Revisisted
SpecterOps Webinar Week - Kerberoasting Revisisted
Will Schroeder
 
Troopers 19 - I am AD FS and So Can You
Troopers 19 - I am AD FS and So Can YouTroopers 19 - I am AD FS and So Can You
Troopers 19 - I am AD FS and So Can You
Douglas Bienstock
 
Evading Microsoft ATA for Active Directory Domination
Evading Microsoft ATA for Active Directory DominationEvading Microsoft ATA for Active Directory Domination
Evading Microsoft ATA for Active Directory Domination
Nikhil Mittal
 
Here Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLsHere Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLs
Andy Robbins
 
Windows Forensic 101
Windows Forensic 101Windows Forensic 101
Windows Forensic 101
Digit Oktavianto
 
Red Team Methodology - A Naked Look
Red Team Methodology - A Naked LookRed Team Methodology - A Naked Look
Red Team Methodology - A Naked Look
Jason Lang
 

What's hot (20)

Six Degrees of Domain Admin - BloodHound at DEF CON 24
Six Degrees of Domain Admin - BloodHound at DEF CON 24Six Degrees of Domain Admin - BloodHound at DEF CON 24
Six Degrees of Domain Admin - BloodHound at DEF CON 24
 
FreeIPA - Attacking the Active Directory of Linux
FreeIPA - Attacking the Active Directory of LinuxFreeIPA - Attacking the Active Directory of Linux
FreeIPA - Attacking the Active Directory of Linux
 
Fantastic Red Team Attacks and How to Find Them
Fantastic Red Team Attacks and How to Find ThemFantastic Red Team Attacks and How to Find Them
Fantastic Red Team Attacks and How to Find Them
 
I hunt sys admins 2.0
I hunt sys admins 2.0I hunt sys admins 2.0
I hunt sys admins 2.0
 
Hunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows EnvironmentHunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows Environment
 
No Easy Breach DerbyCon 2016
No Easy Breach DerbyCon 2016No Easy Breach DerbyCon 2016
No Easy Breach DerbyCon 2016
 
Abusing Microsoft Kerberos - Sorry you guys don't get it
Abusing Microsoft Kerberos - Sorry you guys don't get itAbusing Microsoft Kerberos - Sorry you guys don't get it
Abusing Microsoft Kerberos - Sorry you guys don't get it
 
A Threat Hunter Himself
A Threat Hunter HimselfA Threat Hunter Himself
A Threat Hunter Himself
 
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
I'm in your cloud... reading everyone's email. Hacking Azure AD via Active Di...
 
The Travelling Pentester: Diaries of the Shortest Path to Compromise
The Travelling Pentester: Diaries of the Shortest Path to CompromiseThe Travelling Pentester: Diaries of the Shortest Path to Compromise
The Travelling Pentester: Diaries of the Shortest Path to Compromise
 
Windows Threat Hunting
Windows Threat HuntingWindows Threat Hunting
Windows Threat Hunting
 
Not a Security Boundary
Not a Security BoundaryNot a Security Boundary
Not a Security Boundary
 
Hunting for Privilege Escalation in Windows Environment
Hunting for Privilege Escalation in Windows EnvironmentHunting for Privilege Escalation in Windows Environment
Hunting for Privilege Escalation in Windows Environment
 
The Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active DirectoryThe Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active Directory
 
SpecterOps Webinar Week - Kerberoasting Revisisted
SpecterOps Webinar Week - Kerberoasting RevisistedSpecterOps Webinar Week - Kerberoasting Revisisted
SpecterOps Webinar Week - Kerberoasting Revisisted
 
Troopers 19 - I am AD FS and So Can You
Troopers 19 - I am AD FS and So Can YouTroopers 19 - I am AD FS and So Can You
Troopers 19 - I am AD FS and So Can You
 
Evading Microsoft ATA for Active Directory Domination
Evading Microsoft ATA for Active Directory DominationEvading Microsoft ATA for Active Directory Domination
Evading Microsoft ATA for Active Directory Domination
 
Here Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLsHere Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLs
 
Windows Forensic 101
Windows Forensic 101Windows Forensic 101
Windows Forensic 101
 
Red Team Methodology - A Naked Look
Red Team Methodology - A Naked LookRed Team Methodology - A Naked Look
Red Team Methodology - A Naked Look
 

Similar to (Ab)Using GPOs for Active Directory Pwnage

Useful Group Policy Concepts
Useful Group Policy ConceptsUseful Group Policy Concepts
Useful Group Policy Concepts
Rob Dunn
 
Microsoft Offical Course 20410C_11
Microsoft Offical Course 20410C_11Microsoft Offical Course 20410C_11
Microsoft Offical Course 20410C_11
gameaxt
 
How To Troubleshoot Group Policy in Windows 10
How To Troubleshoot Group Policy in Windows 10How To Troubleshoot Group Policy in Windows 10
How To Troubleshoot Group Policy in Windows 10
Global Knowledge Training
 
Group Policy Windows Server 2008
Group Policy Windows Server 2008Group Policy Windows Server 2008
Group Policy Windows Server 2008
Unitek Eduation
 
Network Implementation and Support Lesson 09 Group Policy - Eric Vanderburg
Network Implementation and Support Lesson 09   Group Policy - Eric VanderburgNetwork Implementation and Support Lesson 09   Group Policy - Eric Vanderburg
Network Implementation and Support Lesson 09 Group Policy - Eric Vanderburg
Eric Vanderburg
 
Most Advanced GTM Deployment. Ever!
Most Advanced GTM Deployment. Ever!Most Advanced GTM Deployment. Ever!
Most Advanced GTM Deployment. Ever!
Phil Pearce
 
PGEncryption_Tutorial
PGEncryption_TutorialPGEncryption_Tutorial
PGEncryption_TutorialVibhor Kumar
 
How to use postgresql.conf to configure and tune the PostgreSQL server
How to use postgresql.conf to configure and tune the PostgreSQL serverHow to use postgresql.conf to configure and tune the PostgreSQL server
How to use postgresql.conf to configure and tune the PostgreSQL server
EDB
 
Sprint 71
Sprint 71Sprint 71
Sprint 71
ManageIQ
 
Windows server 2012 and group policy
Windows server 2012 and group policyWindows server 2012 and group policy
Windows server 2012 and group policy
Ravi Kumar Lanke
 
Kubernetes as data platform
Kubernetes as data platformKubernetes as data platform
Kubernetes as data platform
Lars Albertsson
 
DevOpsDaysRiga 2018: Eric Skoglund, Lars Albertsson - Kubernetes as data plat...
DevOpsDaysRiga 2018: Eric Skoglund, Lars Albertsson - Kubernetes as data plat...DevOpsDaysRiga 2018: Eric Skoglund, Lars Albertsson - Kubernetes as data plat...
DevOpsDaysRiga 2018: Eric Skoglund, Lars Albertsson - Kubernetes as data plat...
DevOpsDays Riga
 
systemd @ Facebook -- a year later
systemd @ Facebook -- a year latersystemd @ Facebook -- a year later
systemd @ Facebook -- a year later
Davide Cavalca
 
Securing Windows with Group Policy
Securing Windows with Group PolicySecuring Windows with Group Policy
Securing Windows with Group Policy
Josh Rickard
 
Introduction to git & github
Introduction to git & githubIntroduction to git & github
Introduction to git & github
Vinothini KadambavanaSundaram
 
IOUG Data Integration SIG w/ Oracle GoldenGate Solutions and Configuration
IOUG Data Integration SIG w/ Oracle GoldenGate Solutions and ConfigurationIOUG Data Integration SIG w/ Oracle GoldenGate Solutions and Configuration
IOUG Data Integration SIG w/ Oracle GoldenGate Solutions and Configuration
Bobby Curtis
 
Ilya Kosmodemiansky - An ultimate guide to upgrading your PostgreSQL installa...
Ilya Kosmodemiansky - An ultimate guide to upgrading your PostgreSQL installa...Ilya Kosmodemiansky - An ultimate guide to upgrading your PostgreSQL installa...
Ilya Kosmodemiansky - An ultimate guide to upgrading your PostgreSQL installa...
PostgreSQL-Consulting
 
Google Cloud Platform Special Training
Google Cloud Platform Special TrainingGoogle Cloud Platform Special Training
Google Cloud Platform Special Training
Simon Su
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 

Similar to (Ab)Using GPOs for Active Directory Pwnage (20)

Useful Group Policy Concepts
Useful Group Policy ConceptsUseful Group Policy Concepts
Useful Group Policy Concepts
 
Microsoft Offical Course 20410C_11
Microsoft Offical Course 20410C_11Microsoft Offical Course 20410C_11
Microsoft Offical Course 20410C_11
 
How To Troubleshoot Group Policy in Windows 10
How To Troubleshoot Group Policy in Windows 10How To Troubleshoot Group Policy in Windows 10
How To Troubleshoot Group Policy in Windows 10
 
Group Policy Windows Server 2008
Group Policy Windows Server 2008Group Policy Windows Server 2008
Group Policy Windows Server 2008
 
Network Implementation and Support Lesson 09 Group Policy - Eric Vanderburg
Network Implementation and Support Lesson 09   Group Policy - Eric VanderburgNetwork Implementation and Support Lesson 09   Group Policy - Eric Vanderburg
Network Implementation and Support Lesson 09 Group Policy - Eric Vanderburg
 
Most Advanced GTM Deployment. Ever!
Most Advanced GTM Deployment. Ever!Most Advanced GTM Deployment. Ever!
Most Advanced GTM Deployment. Ever!
 
PGEncryption_Tutorial
PGEncryption_TutorialPGEncryption_Tutorial
PGEncryption_Tutorial
 
How to use postgresql.conf to configure and tune the PostgreSQL server
How to use postgresql.conf to configure and tune the PostgreSQL serverHow to use postgresql.conf to configure and tune the PostgreSQL server
How to use postgresql.conf to configure and tune the PostgreSQL server
 
70 640 Lesson07 Ppt 041009
70 640 Lesson07 Ppt 04100970 640 Lesson07 Ppt 041009
70 640 Lesson07 Ppt 041009
 
Sprint 71
Sprint 71Sprint 71
Sprint 71
 
Windows server 2012 and group policy
Windows server 2012 and group policyWindows server 2012 and group policy
Windows server 2012 and group policy
 
Kubernetes as data platform
Kubernetes as data platformKubernetes as data platform
Kubernetes as data platform
 
DevOpsDaysRiga 2018: Eric Skoglund, Lars Albertsson - Kubernetes as data plat...
DevOpsDaysRiga 2018: Eric Skoglund, Lars Albertsson - Kubernetes as data plat...DevOpsDaysRiga 2018: Eric Skoglund, Lars Albertsson - Kubernetes as data plat...
DevOpsDaysRiga 2018: Eric Skoglund, Lars Albertsson - Kubernetes as data plat...
 
systemd @ Facebook -- a year later
systemd @ Facebook -- a year latersystemd @ Facebook -- a year later
systemd @ Facebook -- a year later
 
Securing Windows with Group Policy
Securing Windows with Group PolicySecuring Windows with Group Policy
Securing Windows with Group Policy
 
Introduction to git & github
Introduction to git & githubIntroduction to git & github
Introduction to git & github
 
IOUG Data Integration SIG w/ Oracle GoldenGate Solutions and Configuration
IOUG Data Integration SIG w/ Oracle GoldenGate Solutions and ConfigurationIOUG Data Integration SIG w/ Oracle GoldenGate Solutions and Configuration
IOUG Data Integration SIG w/ Oracle GoldenGate Solutions and Configuration
 
Ilya Kosmodemiansky - An ultimate guide to upgrading your PostgreSQL installa...
Ilya Kosmodemiansky - An ultimate guide to upgrading your PostgreSQL installa...Ilya Kosmodemiansky - An ultimate guide to upgrading your PostgreSQL installa...
Ilya Kosmodemiansky - An ultimate guide to upgrading your PostgreSQL installa...
 
Google Cloud Platform Special Training
Google Cloud Platform Special TrainingGoogle Cloud Platform Special Training
Google Cloud Platform Special Training
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 

Recently uploaded

Gregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics PresentationGregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics Presentation
gharris9
 
Gregory Harris' Civics Presentation.pptx
Gregory Harris' Civics Presentation.pptxGregory Harris' Civics Presentation.pptx
Gregory Harris' Civics Presentation.pptx
gharris9
 
Obesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditionsObesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditions
Faculty of Medicine And Health Sciences
 
Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024
Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024
Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024
Dutch Power
 
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdfSupercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Access Innovations, Inc.
 
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Sebastiano Panichella
 
International Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software TestingInternational Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software Testing
Sebastiano Panichella
 
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptxsomanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
Howard Spence
 
Tom tresser burning issue.pptx My Burning issue
Tom tresser burning issue.pptx My Burning issueTom tresser burning issue.pptx My Burning issue
Tom tresser burning issue.pptx My Burning issue
amekonnen
 
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Sebastiano Panichella
 
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXOBitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Matjaž Lipuš
 
2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf
Frederic Leger
 
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdfBonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
khadija278284
 
Burning Issue Presentation By Kenmaryon.pdf
Burning Issue Presentation By Kenmaryon.pdfBurning Issue Presentation By Kenmaryon.pdf
Burning Issue Presentation By Kenmaryon.pdf
kkirkland2
 
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie WellsCollapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Rosie Wells
 
Media as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern EraMedia as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern Era
faizulhassanfaiz1670
 
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
Dutch Power
 
AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...
AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...
AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...
AwangAniqkmals
 
María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024
eCommerce Institute
 

Recently uploaded (19)

Gregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics PresentationGregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics Presentation
 
Gregory Harris' Civics Presentation.pptx
Gregory Harris' Civics Presentation.pptxGregory Harris' Civics Presentation.pptx
Gregory Harris' Civics Presentation.pptx
 
Obesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditionsObesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditions
 
Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024
Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024
Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024
 
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdfSupercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
 
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
 
International Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software TestingInternational Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software Testing
 
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptxsomanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
 
Tom tresser burning issue.pptx My Burning issue
Tom tresser burning issue.pptx My Burning issueTom tresser burning issue.pptx My Burning issue
Tom tresser burning issue.pptx My Burning issue
 
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...
 
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXOBitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXO
 
2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf
 
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdfBonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
 
Burning Issue Presentation By Kenmaryon.pdf
Burning Issue Presentation By Kenmaryon.pdfBurning Issue Presentation By Kenmaryon.pdf
Burning Issue Presentation By Kenmaryon.pdf
 
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie WellsCollapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
 
Media as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern EraMedia as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern Era
 
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
 
AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...
AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...
AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...
 
María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024
 

(Ab)Using GPOs for Active Directory Pwnage

  • 1. (Ab)Using GPOs For Active Directory Pwnage Petros Koutroumpis - @pkb1s Dennis Panagiotopoulos - @den_n1s Red Team Village | DEF CON 27
  • 2. Agenda • GPO Internals • Hunting for weak GPO permissions • Example scenarios • Exploitation methods and SharpGPOAbuse
  • 3. Previous Work • @grouppolicyguy - https://sdmsoftware.com • @_wald0 - https://wald0.com • @PyroTek3 - https://adsecurity.org • @harmj0y - http://www.harmj0y.net • @_RastaMouse - https://rastamouse.me
  • 4. What is a GPO? • Allows administrators to easily control the settings deployed to clients within an Active Directory environment. • Configure settings for User and Computer accounts • Can be Local or in Active Directory
  • 5. Components of a GPO • Group Policy Container (GPC) • Group Policy Template (GPT) Also, • Client-Side Extensions (CSEs)
  • 7. • displayName • gPCFileSysPath • versionNumber • gPCMachineExtensionNames and gPCUserExtensionNames Group Policy Container (GPC) Important Attributes:
  • 9. Client-Side Extensions (CSEs) • DLLs installed on clients • Used to process GPO settings • Identified by a GUID • Found in the gPCMachineExtensionNames and gPCUserExtensionNames attributes of a GPO • Special order
  • 10. Client-Side Extensions (CSEs) • gPCMachineExtensionNames value when Audit Policy is configured [ {827D319E-6EAC-11D2-A4EA-00C04F79F83A} //Security Settings {803E14A0-B4FB-11D0-A0D0-00A0C90F574B} //Computer Restricted Groups ] • gPCMachineExtensionNames value after adding a Startup Script [ {42B5FAAE-6536-11D2-AE5A-0000F87571E3} //Process Scripts Group Policy {40B6664F-4972-11D1-A7CA-0000F87571E3} //Startup - Shutdown Scripts ] [ {827D319E-6EAC-11D2-A4EA-00C04F79F83A} //Security Settings {803E14A0-B4FB-11D0-A0D0-00A0C90F574B} //Computer Restricted Groups ]
  • 12. GPO Precedence and Inheritance What happens when multiple GPOs apply to a client? • Local • Site • Domain • OU
  • 13. GPO Precedence and Inheritance • What happens when multiple GPOs are linked to the same OU?
  • 14. Blocking and Enforcement Settings that can affect the GPO processing order: • Block Inheritance • Enforcement
  • 18. GPO Processing There are 2 types of GPO processing: • Foreground – All settings are processed – Affects login/logoff times • Background – Applied at regular intervals – Not all settings are processed
  • 20. The GpLink Attribute GPLinkOptions: • 0: The GPO is not enforced. This is the default value • 1: The GPO link is not enabled • 2: The GPO is enforced • 3: The GPO is enforced but not enabled [LDAP://cn={9CD1C444-260F-40C6-A67B-E178446622A5},cn=policies,cn=system,DC=europa,DC=com;0] [LDAP://cn={77D3AFFC-1292-4DBE-AE89-CEDEE60BAD0E},cn=policies,cn=system,DC=europa,DC=com;2] [LDAP://cn={C877A421-BF69-439E-89C3-99CF82C71299},cn=policies,cn=system,DC=europa,DC=com;2]
  • 27. GPO Permissions • Owns • GenericAll • GenericWrite • WriteProperty • WriteDACL • WriteOwner https://www.specterops.io/assets/resources/an_ace_up_the_sleeve.pdf
  • 28. Hunting for weak GPO permissions Tools of the trade: • accesschk.exe, icacls, etc • BloodHound – https://github.com/BloodHoundAD/BloodHound • PowerView – https://github.com/PowerShellMafia/PowerSploit • Grouper2 – https://github.com/l0ss/Grouper2
  • 29. BloodHound • Released in 2016 by @_wald0, @CptJesus and @harmj0y • Uses graph theory to reveal relationships between active directory components • An ingestor collects data that can be loaded onto a neo4j database • Useful for both Red and Blue teams
  • 31. BloodHound and GPOs • If a gPLink is dotted then the GPO is not enforced • If a gPLink is solid then the GPO is Enforced • If a Contains link is dotted then Block Inheritance is enabled
  • 34. What about in real life? • Misconfigurations are very common • Multiple instances where arbitrary “low-privileged” users were able to modify a GPO
  • 35. Example 1 – Compromise Computer
  • 36. Example 2 – Compromise User
  • 37. Exploiting these scenarios • Group Policy Management Console (GPMC) • Manually edit GPC and GPT • SharpGPOAbuse 
  • 38. Group Policy Management Console (GPMC)
  • 39. Manual Exploitation • Each GPO settings has different dependencies: – Hidden .ini files – Various .xml files • Error prone • Time consuming
  • 40. Manual Exploitation Things to be remember: • CSE order in gPCMachineExtensionNames and gPCUserExtensionNames • Version number in GPT.ini and versionNumber attribute must be the same. – versionNumber = {User Node: upper 16 bits}{Machine Node: lower 16 bits}
  • 41. Manual Exploitation Adding a user to the local Administrators group: • Find the SID of the user we want to add as a local admin • Get the GUID of the target GPO • Create SYSVOLdomainPolicies{GUID}MachineMicrosoftWindows NTSecEditGptTmpl.inf with the following contents: [Unicode] Unicode=yes [Version] signature="$CHICAGO$" Revision=1 [Group Membership] *S-1-5-32-544__Memberof = *S-1-5-32-544__Members = *<USER-SID>
  • 42. Manual Exploitation • Calculate the new GPO version • Update the value of the version parameter in SYSVOLdomainPolicies{GUID}GPT.ini • Update the versionNumber attribute in the GPC • Find the values of the required CSEs and add them sorted in the gPCMachineExtensionNames attribute of the GPO object • Hope you didn’t mess anything up 
  • 43. SharpGPOAbuse • .NET application written in C# • Simplifies the process – a lot • Can be used to exploit both Computer and User GPO settings
  • 44. SharpGPOAbuse - Functionality Currently supports the following: • Add rights to user (SeDebugPrivilege, SeImpersonatePrivilege, etc.) • Add startup scripts • Add immediate tasks to user or computer • Add user to local Administrators group
  • 45. Example 1 – Compromise Computer
  • 46.
  • 47. Example 2 – Compromise User
  • 48.
  • 49. Bonus - What about cross domain? • GPOs can also apply to different domains • New PR to SharpHound • You can use SharpGPOAbuse to abuse this scenario as well 
  • 50. Bonus - What about cross domain?
  • 51.
  • 52. Related Links SharpGPOAbuse • https://github.com/mwrlabs/SharpGPOAbuse Additional Links • https://blogs.technet.microsoft.com/musings_of_a_technical_tam/2012/02/13/group-policy- basics-part-1-understanding-the-structure-of-a-group-policy-object/#comments • http://www.harmj0y.net/blog/redteaming/abusing-gpo-permissions/ • https://wald0.com/?p=179 • https://adsecurity.org/?p=2716 • https://rastamouse.me/2019/01/gpo-abuse-part-2/ • https://rastamouse.me/2019/01/gpo-abuse-part-1/