Attacking Kerberos
Attacking Kerberos
Kerberoasting
Service accounts have SPNs (Service Principal Names). A service principal name (SPN) is the name by which a Kerberos client uniquely identifies an instance of a service for a given Kerberos target computer. If you install multiple instances of a service on computers throughout a forest, each instance must have its own SPN.
The main security issue surrounding the use of Service Principle Name (SPN) accounts is the fact that any valid user on the domain can abuse the Kerberos authentication protocol to begin the authentication process and receive a hash of any SPN account in use. This action can be performed by any user on the domain and does not require any elevated privileges. This attack is known as kerberoasting and we can perform it in this scenario, against the MySQL service account, using impacket:
If NTLM is enabled, we can also do kerberoasting with:
Silver ticket attack
Similar in concept to a Golden Ticket, a Silver Ticket attack involves compromising credentials and abusing the design of the Kerberos protocol. However, unlike a Golden Ticket — which grants an adversary unfettered access to the domain — a Silver Ticket only enables an attacker to forge ticket-granting service (TGS) tickets for specific services. TGS tickets are encrypted with the password hash for the service; therefore, if an adversary steals the hash for a service account, they can mint TGS tickets for that service.
Creating a silver ticket
To gain the ability to mint TGS tickets, an adversary must first compromise the password hash of a service account. We have compromised the password hash for the sqlsvc account.
We need a few things to create a silver ticket:
NTLM hash for service account
Domain SID
User id (500 is the default for Administrator)
Getting NTLM hash of service account
To get the NTLM hash of a account, we can use a tool like https://www.browserling.com/tools/ntlm-hash to generate the NTLM hash of a password. In our case:
B999A16500B87D17EC7F2E2A68778F05
Getting Domain SID
We can use impacket-getPac to get the domain SID:
Creating the silver ticket
We successfully created a silver ticket for the Administrator user. To actually use the ticket, we need to export it in our host:
Getting RCE using impacket-mssqlclient
Now that we have a silver ticket for Administrator, we can use impacket-mssqlclient to authenticate with kerberos to the mysql service:
AS-REP Roasting
AS-REP roasting is an attack against Kerberos for user that don't require preauthentication During preauthentication, a user will enter their password which will be used to encrypt a timestamp and then the domain controller will attempt to decrypt it and validate that the right password was used and that it is not replaying a previous request. From there, the TGT will be issued for the user to use for future authentication. If preauthentication is disabled, an attacker could request authentication data for any user and the DC would return an encrypted TGT that can be brute-forced offline.
Last updated