Module 15: Windows Lateral Movement
Windows Authentication
Pass the Hash

In PtH, as long as the hash is valid, the challenge-response will succeed.
Granting SeDebugPriv with Mimikatz
Dumping available credentials with Mimikatz
Running PtH with offsec password hash via Mimikatz
Obtaining a remote shell on DC01 with PsExec as offsec
If a user account is successfully impersonated then a logon event is generated on the machine it occurred on. This logon event ID is 4624.
Checking the status of the Logon audit policy

Important fields:
Subject: Lists the account that initiated the authentication event.
Logon Type: Indicates the type of logon that occurred.
New Logon: Lists the account, the initiated impersonation event, and the targeted account.
Logon Types
Interactive (also known as, Logon locally)
2
Password, Smartcard, other
Yes
Console logon; RUNAS; Hardware remote control solutions (such as Network KVM or Remote Access / Lights-Out Card in server) IIS Basic Auth (before IIS 6.0)
Network
3
Password, NT Hash, Kerberos ticket
No (except if delegation is enabled, then Kerberos tickets present)
NET USE; RPC calls; Remote registry; IIS integrated Windows auth; SQL Windows auth;
Batch
4
Password (stored as LSA secret)
Yes
Scheduled tasks
Service
5
Password (stored as LSA secret)
Yes
Windows services
NetworkCleartext
8
Password
Yes
IIS Basic Auth (IIS 6.0 and newer); Windows PowerShell with CredSSP
NewCredentials
9
Password
Yes
RUNAS /NETWORK
RemoteInteractive
10
Password, Smartcard, other
Yes
Remote Desktop (formerly known as "Terminal Services")
Detecting NewCrednetials logons by searching for LogonType 9 and EventID 4624


XPath XML for PSExec service installation
Detecting PsExec service installation

XPath XML for Network logons
Detecting network logons
Detecting PtH artifacts
Brute Force Domain Credentials
Creating a custom PowerShell function named Get-BadPwdCount
Discovering the PDC and creating a search root string
Instantiating a DirectorySearcher object with a custom search root
Restricting our DirectorySearcher to only retrieve two attributes
LDAP search filter for a specific sAMAccountName
LDAP search filter for all enabled user accounts
Listing failed logon attempts with Get-BadPwdCount
Retrievin the lockout threshold with net accounts
XPath XML for lockout events (4740)
We could also search through all failed logon events (4625)

Terminal Services
By default, there are two logs that will trace RDP remote connection events, namely TerminalServices-LocalSessionManager and TerminalServices-RemoteConnectionManager.
Local Session Manager logs will include information about the local terminal session on the current machine, whereas the Remote Connection Manager logs will include information about the terminal sessions events that were triggered from a remote computer.
When an RDP logon prompt is displayed, event ID 261 is created in the Remote Connection Manager logs.
If there's a successful authentication and connection then event ID 1149 is created.
XPath XML for terminal services
Abuse the Kerberos Ticket
Pass the Ticket
When a KDC issues a TGT, the DC will create event ID 4768. When a client makes a TGS request, the DC will create event ID 4769.
Both of these events are provided by the Kerberos Service Ticket Operations audit policy, which is a subcategory of Account Logon.
XPath XML for TGT kerberos events
Extracting username and ip from 4768 events
XPath XML for TGS kerberos events
Extracting username and ip from 4769 events
Ticket stealin detection logic
Get-SessionUsers function to automate parsing output from klist
Extracting user and logonid
Extracting the user from specific session TGT
Comparing the expected user with the actual user
Kerberoasting
Kerberoasting relies on the fact that any client with a TGT can request a TGS for any service registered with a SPN in the domain.
SPN entries are stored in Active Directory as objects, and are discoverable using a simple LDAP enumeration script.
Instantiating a DirectoryServer instance restricted to two properties
SPN LDAP Filter
Extracting SPN info from LDAP result set
TGS request

XPath XML for RC4 encrypted TGS requests
XPath XML for TGS honey tokens
Last updated