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
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_REQUESTstructure - Uses current session LUID for non-elevated contexts
- Calls
LsaCallAuthenticationPackageto enumerate tickets - Processes returned ticket information
5. Ticket Retrieval Process
- Creates
KERB_RETRIEVE_TKT_REQUESTfor specific ticket retrieval - Allocates memory for request structure and target name
- Uses
RtlMoveMemoryto 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
- JSON Format Only: Requires JSON parameter format
- Service Name Matching: Uses substring matching for service names
- Elevation for LUID: Cross-session extraction requires elevated context
- Ticket Availability: Can only extract existing tickets from cache
- LSA Dependencies: Requires functional LSA subsystem
- 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
- Service Name Accuracy: Use correct service principal names
- Session Targeting: Understand LUID implications when elevated
- Error Monitoring: Check for extraction and credential creation failures
- Credential Management: Leverage automatic Mythic credential store integration
- Resource Awareness: Monitor memory usage during extraction operations