Skip to main content
Artifacts Generated: WindowsAPIInvoke

Summary

Extracts Kerberos tickets from the current or specified logon session using LSA APIs. Retrieves ticket details and encoded ticket data, then automatically creates credential entries in Mythic’s credential store for extracted tickets.
  • Needs Admin: False (elevated context required for targeting specific LUIDs)
  • Version: 2
  • Author: @drago-qcc

Arguments

  • service (String, Required) - Service name to extract ticket for (e.g., “krbtgt” for TGT, “cifs”, “host”, “ldap”)
  • luid (String, Optional) - Target LUID for ticket extraction (requires elevation)

Usage

Output:

Detailed Summary

Agent Execution Flow

1. Parameter Processing and Validation

  • Requires JSON parameter format only
  • Validates service parameter is provided
  • LUID parameter is optional for targeting specific sessions

2. Ticket Extraction Process (C#)

  • Trims service name parameter
  • Initializes LSA connection and Kerberos authentication package
  • Clears target LUID for non-elevated contexts
  • Searches ticket cache for matching service name

3. LSA Connection and Package Resolution

  • Establishes LSA connection using LsaConnectUntrusted
  • Elevates to SYSTEM for high integrity contexts when needed
  • Looks up Kerberos authentication package
  • Generates artifacts for API calls

4. Ticket Cache Enumeration

  • Creates KERB_QUERY_TKT_CACHE_REQUEST structure
  • Uses current session LUID for non-elevated contexts
  • Calls LsaCallAuthenticationPackage to enumerate tickets
  • Processes returned ticket information

5. Ticket Retrieval Process

  • Creates KERB_RETRIEVE_TKT_REQUEST for specific ticket retrieval
  • Allocates memory for request structure and target name
  • Uses RtlMoveMemory to copy target name data
  • Updates structure pointers for proper memory layout

6. Ticket Data Extraction

  • Retrieves encoded ticket data from LSA
  • Validates ticket extraction success
  • Copies ticket data to byte array
  • Handles memory cleanup

7. Completion Function and Credential Processing

  • Processes task responses containing extracted tickets
  • Uses Impacket CCache to parse ticket structure
  • Extracts metadata (service, timing, client information)
  • Creates credential entries in Mythic credential store

8. Response Processing and Feedback

  • Provides feedback on credential creation success/failure
  • Shows client principal name for successful extractions
  • Reports detailed error information for failures

Kerberos Structures and Operations

KERB_QUERY_TKT_CACHE_REQUEST

  • MessageType: Specifies cache query operation
  • LogonId: Target logon session (null for current session)

KERB_RETRIEVE_TKT_REQUEST

  • MessageType: Specifies ticket retrieval operation
  • TargetName: Service principal name to extract
  • CacheOptions: Returns ticket as Kerberos credential

Error Handling

LSA Operation Errors

  • Validates both API status and protocol status
  • Converts NTSTATUS codes to Win32 error codes
  • Provides detailed error context

Ticket Search Failures

  • Handles cases where requested service ticket not found
  • Provides specific error message with service name

Memory and Resource Cleanup

  • Ensures proper cleanup of LSA resources
  • Frees return buffers and handles
  • Generates artifacts for cleanup operations

Integration with TicketManager

Interface Methods

  • Provides clean interface to extraction functionality
  • Handles LUID string conversion
  • Returns ticket object and error messages

Completion Function Integration

Asynchronous Processing

  • Registers completion function for post-processing
  • Automatically processes extracted tickets
  • Creates credential entries without additional operator action

APIs Used

MITRE ATT&CK Mapping

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

Security Considerations

  • Ticket Extraction: Retrieves sensitive Kerberos authentication material
  • LSA Interaction: Direct interaction with Local Security Authority
  • Credential Storage: Extracted tickets stored in Mythic credential database
  • Cross-Session Access: Can extract from other sessions when elevated
  • Memory Exposure: Ticket data temporarily held in process memory

Limitations

  1. JSON Format Only: Requires JSON parameter format
  2. Service Name Matching: Uses substring matching for service names
  3. Elevation for LUID: Cross-session extraction requires elevated context
  4. Ticket Availability: Can only extract existing tickets from cache
  5. LSA Dependencies: Requires functional LSA subsystem
  6. Session Access: Limited to accessible logon sessions

Error Conditions

  • Invalid JSON: Malformed JSON parameters
  • Service Not Found: No ticket found for specified service name
  • LSA Connection Failed: Cannot connect to Local Security Authority
  • Package Lookup Failed: Kerberos authentication package not found
  • Ticket Retrieval Failed: LSA failed to retrieve ticket data
  • No Ticket Data: Ticket exists but contains no encoded data
  • Access Denied: Insufficient privileges for target LUID
  • Memory Allocation Failed: Cannot allocate memory for request structures

Best Practices

  1. Service Name Accuracy: Use correct service principal names
  2. Session Targeting: Understand LUID implications when elevated
  3. Error Monitoring: Check for extraction and credential creation failures
  4. Credential Management: Leverage automatic Mythic credential store integration
  5. Resource Awareness: Monitor memory usage during extraction operations