Trustee and Resource Delegation

Exploiting Delegation

ko-fi

Delegations

ADeleginator

NXC

https://x.com/al3x_n3ff/status/1857153795949559875?t=3iN0A-aTMN58zD0O7rIIlA&s=03

SharpADWS

Unconstrained Delegation

Unconstrained Delegation: allows the first hop server to request access to any service on any computer in the domain

Discovery

  • PowerView

  • AD Module

Compromise the server where unconstrained delegation is enabled

Wait for a DA to connect then

Reuse DA token

Trick a high user to connect to a machine with Unconstrained Delegation ? Printer Bug

MisconfigurationPrint Spooler

Capture the TGT of dc$ by using Rubeus on victim server

Printerbug - Run MS-RPRN.exe

Or with PetitPotam

On Linux, use Coercer

SMB (445, 139) / RPC

ShadowCoerce or DFSCoerce can also be used

Copy the base64 encoded TGT and remove extra spaces before use it

Or use Invoke-Mimikatz:

Run DCSync

DCSync

Mitigation

The following security controls should be implemented to mitigate unconstrained delegation:

  • Ensure computer objects are not configured for unconstrained delegation. If delegation is required for a computer object, use resource-based constrained delegation instead.

  • Ensure privileged user objects are configured as ‘sensitive and cannot be delegated’. This can be configured by using the ‘Account is sensitive and cannot be delegated’ option on the user object in Active Directory Users and Computers.

  • Ensure privileged user objects are members of the Protected Users security group. Members of this security group cannot be delegated.

  • Disable the Print Spooler service on Domain Controllers. This prevents the Print Spooler service from being used to coerce a Domain Controller into authenticating to another system.

https://www.cyber.gov.au/resources-business-and-government/maintaining-devices-and-systems/system-hardening-and-administration/system-hardening/detecting-and-mitigating-active-directory-compromises?s=03

Constrained Delegation - Protocol Transition

Constrained Delegation: allows the first hop server to request access only to specified computers

Service for User (S4U) used to impersonate a user

S4U2self: allows a forwardable TGS to itself on behalf of a user - TUSTED_TO_AUTHENTICATE_FOR_DELEGATION

S4U2proxy: allows a service to obtain a TGS to a second service on behalf of the user - msDS-AllowedToDelegateTo contains a list of SPN to which the token can be forwarded

Discovery

  • PowerView

  • AD Module

Abusing with kekeo

password or NTLM/AES keys required

  1. Request a TGT

  1. Request a TGS

  1. Inject the ticket

Abusing with Rubeus

Request TGT and TGS in a single command

With rc4

Abusing with kekeo

password or NTLM/AES keys required

  1. Request a TGT

  1. Request a TGS

  1. Inject the ticket

Abusing with Rubeus

Request TGT and TGS in a single command

Persistence - msDS-AllowedToDelegateTo

Persistence

Resource-based Constrained Delegation

Instead of SPNs on msDS-AllowedToDelegatTo on the front end service, access is control by a security descriptor of msDS-AllowedToActOnBehalfOfOtherIdentity (visible as PrincipalsAllowedToDelegateToAccount) on the resource/service

The service administrator can configure this delegation whereas for other type SeEnableDelagation privs required - by default only DA

Two privileges needed to abuse RBCD:

  1. Write permissions over the target service

  2. Control over an object which as SPN configured (like admin access do a domain joined machine or ability to join a machine to domain - ms-DS- MachineAccountQuota is 10 by default)

Write Permission

Exploit

Configure RBCD

Extract AES keys for computerx$

Use the AES key and access vicitm as ANY user we want

With Impacket

L.BIANCHI_ADM is a DA

Constrained Delegation - Kerberos Only

Leverage RBCD to abuse Kerberos Only configuration

Enumeration

Create a new machine account

https://github.com/Kevin-Robertson/Powermad

Configure RBCD

Get TGS

Request a new forwardable TGS

Support this Gitbook

I hope it helps you as much as it has helped me. If you can support me in any way, I would deeply appreciate it.

ko-fi

buymeacoffee

Last updated