🔏
RootGuard
HomeSOC OperationsIncident ResponseWindows ForensicsLinux ForensicsKQL Investigations
  • Welcome
    • RootGuard
      • Who Am I?
        • Professional Profile
  • Resources Hub
    • Blogs
      • Articles
        • Safeguarding SMEs: The Strategic Importance of a Security Operations Center (SOC)
      • Posts
        • Roadmap to Becoming a Cybersecurity Specialist
        • Starting a Career in Cybersecurity
        • A Guide to Landing Your First Cybersecurity Analyst Role
        • Moving from Intermediate to Expert Incident Responder
  • SOC Operations
    • Introduction
      • Development Resources
        • SOC Analysts Roadmap
        • Becoming A SOC Analyst
        • SOC Analysts Prep Interview Questions
    • Essential Skills
      • Critical Windows EventIDs to Monitor
    • Junior Analyst Skills
      • Splunk Use Cases
      • KQL Use Cases
        • Reconnaissance (TA0043)
        • Initial Access (TA0001)
        • Execution (TA0002)
        • Persistence (TA0003)
        • Privilege Escalation (TA0004)
        • Defence Evasion (TA0005)
        • Credential Access (TA0006)
        • Discovery (TA0007)
        • Lateral Movement (TA0008)
        • Collection (TA0009)
        • Command and Control (TA0011)
        • Exfiltration (TA0010)
        • Impact (TA0040)
      • Investigating Common Attacks
        • Domain Dominance Attacks - Detection & Analysis
        • Investigating a Suspected AD FS Distributed Key Management (DKM) Attack
        • Authentication From Suspicious DeviceName
        • Identifying Interactive or RemoteInteractive Session From Service Account
        • Identifying Split or Part Archive File Transfers
        • Detect Potential Cleartext Credentials in Command Line
        • Detecting Command Line Interpreters Launched via Scheduled Tasks
        • Detecting Files Containing Potentially Sensitive Data
        • Detecting DeviceNetworkEvents From Windows Processes and Domains by TLD
        • Detecting Silent cmd.exe Execution With Redirected STDERR & STDOUT
        • Detecting Low Prevalence DLL Loaded From Process In User Downloads Directory
        • Detecting Virtual Drive Mounted From Archive
        • Identify Execution of Script From User's Downloads Folder
        • Identify Potential RDP Tunneled Sessions
        • Identify Instances of PowerShell Invoke-WebRequest, IWR or Net.WebClient
        • Identify Processes Launched by PowerShell Remoting (WSMProvHost.exe)
        • Detect DeviceNetworkEvents for LOLBAS with Download or Upload Functions
        • Detect Execution of PSEXESVC via Remote Systems
        • Identify Suspicious String in Service Creation ImagePath
        • Identify File with Double Extensions
        • Detect Potential Cleartext Credentials in Commandline
        • Detect When Large Number of Files Downloaded From OneDrive or SharePoint
        • Identify and Investigate Phishing Attacks with KQL
      • PowerShell for SecOps
        • Powershell Remoting
        • Reconnaissance Discovery
        • Initial Access Discovery
        • Execution Discovery
        • Persistence Discovery
        • Privilege Escalation Discovery
        • Defence Evasion Discovery
        • Credential Access Discovery
        • Discovery
        • Lateral Movement Discovery
        • Collection Discovery
        • Command & Control (C2) Discovery
        • Exfiltration Discovery
        • Impact Discovery
      • Packet Analysis (pcap)
        • Tcpdump
        • Tcpdump (Intermediate)
        • Tshark
        • Ngrep
      • Investigating Suspicious Emails Using KQL
    • Intermediate and Advanced Skills
      • Investigate Using MITRE ATT&CK Methodology
        • Reconnaissance (TA0043) Techniques
        • Resource Development (TA0042) Techniques
        • Initial Access (TA0001) Techniques
        • Command Execution (TA0002) Techniques
        • Persistence (TA0003) Techniques
        • Privilege Escalation (TA0004) Techniques
        • Defence Evasion (TA0005) Techniques
        • Credential Access (TA0006) Techniques
        • Discovery (TA0007) Techniques
        • Lateral Movement (TA0008) Techniques
        • Collection (TA0009) Techniques
        • Command and Control (C2) (TA0011) Techniques
        • Exfiltration (TA0010) Techniques
        • Impact (TA0040) Techniques
    • Vulnerability Management
    • Malware Analysis
  • DFIR
    • Incident Response
      • Incident Triage
        • Triage Types and Processes
        • PowerShell for Detection and Analysis
          • Malware or Compromise Investigation
          • Lateral Movement Discovery
        • Registry Analysis
        • Sysinternals Intrusion Analysis
        • PowerShell Intrusion Analysis
        • Velociraptor Intrusion Analysis
        • Zimmerman Tools Intrusion Analysis
      • KAPE Artifacts Analysis
      • Velociraptor Artifacts Analysis
      • Using The Unified Kill Chain Model to Analyse Individual Cyber Attacks
        • Phase 1 - Gaining an Initial Foothold
          • Gaining Access to the Network
          • Establishing a Foothold
          • Network Discovery
      • Response Strategies
        • Privilege Escalation Assessment
        • Command and Control Assessment
        • Command Execution Assessment
        • Defence Evasion Assessment
        • Detection Assessment
        • Discovery Assessment
        • Exfiltration Assessment
        • Initial Access Assessment
        • Initial Impact Assessment Techniques
        • Lateral Movement Assessment
        • Persistence Assessment
    • Windows Forensics
      • Evidence of Execution
      • Window Artifact Analysis
        • Account Usage
        • User Activity Tracking (Event Logs)
        • Program Execution
        • File and Folder Opening
        • File Download
        • Browser Usage
        • Deleted File or File Knowledge
        • External Device & USB Usage
    • Linux Forensics
      • Linux Commandline Basics
      • Host Compromise Assessment
    • KQL for Defender & Sentinel
      • MDO (Office)
      • MDI (Identity)
      • MDE (Endpoint)
    • Memory Forensics
      • Memory Forensics (Volatility 3)
    • Playbooks
      • First Responder DFIR Playbook
        • Device Isolation
        • Evidence Collection
          • Acquire Triage Image Using KAPE
          • Acquire Triage Data Using Velociraptor
          • Acquire Triage Data Using Powershell
          • Acquire Triage Memory Image
          • Acquire Image Using FTK
          • AXIOM Cyber Data Collection
        • Windows Forensic Artefacts
          • Application Execution
          • File & Folder Knowledge
          • External Device Usage
          • Network Activity
          • Windows Event Logs
        • Initial Analysis
          • Memory Analysis (Vol 3)
          • Axiom Cyber Examiner
  • Detection Engineering
    • AD Attack Detections & Mitigations
      • Kerberoasting
      • Authentication Server Response (AS-REP) Roasting
      • Password Spraying
      • MachineAccountQuota Compromise
      • Unconstrained Delegation
      • Password in Group Policy Preferences (GPP) Compromise
      • Active Directory Certificate Services (AD CS) Compromise
      • Golden Certificate
      • DCSync
      • Dumping ntds.dit
      • Golden Ticket
      • Silver Ticket
      • Golden Security Assertion Markup Language (SAML)
      • Microsoft Entra Connect Compromise
      • One-way Domain Trust Bypass
      • Security Identifier (SID) History Compromise
      • Skeleton Key
      • Active Directory Security Controls
      • Active Directory Events for Detecting Compromise
    • Attack Triage Playbooks (KQL Triage)
      • Windows Malware Detection Playbook
      • Linux Host Intrusion Detection Playbook (CLI)
      • Linux Intrusion Detection Playbook
      • Large-Scale Compromise Detection Playbook
      • Ransomware Detection Playbook
      • Phishing Email Compromise Detection Playbook
      • Scam Detection Playbook
      • Customer Phishing Detection Playbook
      • Insider Abuse Detection Playbook
      • Information Leakage Detection Playbook
      • Social Engineering Detection Playbook
      • Malicious Network Behaviour Detection Playbook
      • Windows Intrusion Detection Playbook
      • Vulnerability Detection Playbook
      • Business Email Compromise Detection Playbook
    • Process Execution (KQL Triage)
    • Threat Hunting
      • Hunting Ransomware Indicators
      • Hunting With KQL
        • Detecting Malware Infection (MITRE ATT&CK: T1566, T1059)
        • Discovery Activities (MITRE ATT&CK: T1016, T1083, T1046)
        • Credential Theft (MITRE ATT&CK: T1003, T1078)
        • Lateral Movement (MITRE ATT&CK: T1076, T1021)
        • Data Theft (MITRE ATT&CK: T1041, T1071)
        • Detecting CommandLine Executions (MITRE ATT&CK: T1059)
        • Windows Security Logs (Identity and Logon Activities)
      • Hunting With Splunk
Powered by GitBook
On this page
  • Introduction
  • The following are basic KQL, Velociraptor, and Splunk queries used to investigate these techniques.
  • 1. Exploiting Public-Facing Applications
  • 2. Phishing
  • 3. External Remote Services
Edit on GitHub
  1. DFIR
  2. Incident Response
  3. Using The Unified Kill Chain Model to Analyse Individual Cyber Attacks
  4. Phase 1 - Gaining an Initial Foothold

Gaining Access to the Network

Introduction

The first phase of the Unified Kill Chain model is Gaining an Initial Foothold. The first stage within this phase is the Gaining Access to the Network. This stage focuses on how the adversaries infiltrate a target environment to establish unauthorised access. This phase is critical, as it lays the foundation for subsequent stages of an attack, such as lateral movement and data exfiltration. Understanding the tactics and techniques attackers use during this phase is essential for effective threat detection, investigation, and response. The following techniques are commonly employed by attackers to achieve initial access in, for example, a Windows environment:

  • Exploiting Public-Facing Applications: Attackers often target vulnerabilities in web applications or services exposed to the internet, such as web servers or APIs, to inject malicious code or gain unauthorised access.

  • Phishing: Malicious emails designed to trick users into clicking on links or opening attachments containing malware remain one of the most prevalent methods for gaining initial access.

  • External Remote Services: Attackers exploit poorly secured remote access protocols like RDP, VPNs, or SSH to gain a foothold, often using brute force or stolen credentials.

  • Valid Accounts: Using compromised or stolen credentials, attackers log in as legitimate users to bypass basic security measures.

  • Drive-by Compromise: By hosting malicious code on compromised or rogue websites, attackers trick users into downloading malware during regular browsing.

  • Supply Chain Compromise: Adversaries infiltrate third-party vendors or software providers to distribute malware through legitimate software updates or packages.

  • Trusted Relationships: Exploiting relationships with trusted third-party vendors or partners to gain access to internal systems.

  • Replication Through Removable Media: The use of infected USB drives or other removable media to deliver malicious payloads when connected to the target system.

By applying the Unified Kill Chain model, investigators can systematically analyse the techniques used during this phase, identify relevant indicators of compromise (IOCs), and map the attacker’s behaviour to defensive strategies. This structured approach enhances detection and response efforts, enabling defenders to disrupt adversaries early in the attack lifecycle.

The following are basic KQL, Velociraptor, and Splunk queries used to investigate these techniques.

KQL (Microsoft Sentinel), Velociraptor VQL, and Splunk SPL to investigate each of the techniques in Phase 1 – Gaining an Initial Foothold, along with descriptions of what each query does and multiple query examples for each technique.

1. Exploiting Public-Facing Applications

Attackers often exploit vulnerabilities in public-facing applications, such as web servers or APIs, to gain unauthorised access.

KQL Queries

Identify SQL Injection Attempts

Description: Searches for potential SQL injection patterns in application logs, such as "select *" or explicit "sql injection" alerts.

AzureDiagnostics
| where Message contains "sql injection" or Message contains "select *"
| summarize count() by Message, ClientIP, TimeGenerated

Detect Unusual POST Requests

AzureDiagnostics
| where Method == "POST" and UrlPath contains ".php"
| summarize count() by ClientIP, UrlPath, TimeGenerated

Description: Identifies suspicious POST requests targeting .php files, often used in web application attacks.

Monitor Error Messages Suggesting Vulnerabilities

AzureDiagnostics
| where Message contains "500 Internal Server Error" or Message contains "unauthorized"
| summarize count() by ClientIP, Message, TimeGenerated

Description: Detects repeated error messages that could indicate exploitation attempts.

Velociraptor VQL

SELECT * FROM Audit.WindowsEventLogs
WHERE EventID = 4688 AND EventData.CommandLine =~ "cmd.exe /c"

Description: Identifies suspicious command-line executions that attackers might trigger through exploited applications.

Detect Web Shell Creation

SELECT * FROM FileSystem 
WHERE path =~ "C:\\inetpub\\wwwroot\\*.aspx"

Description: Searches for newly created web shell files in common IIS server directories.

Identify Abnormal HTTP Traffic

SELECT * FROM Network.HTTP
WHERE UserAgent =~ "sqlmap"

Description: Detects traffic from automated tools like SQLmap, often used for exploitation.

Splunk SPL

index=web_logs sourcetype=access_combined
| search uri_query="*union*" OR uri_query="*select*" 
| stats count by clientip, uri_query

Description: Searches for SQL injection attempts by filtering for SQL keywords in URL queries.

POST Requests with Large Payloads

index=web_logs sourcetype=access_combined
| search method="POST" content_length > 10000
| stats count by clientip, uri

Description: Detects large POST requests, potentially used for uploading malicious payloads.

Frequent 404 Errors

index=web_logs sourcetype=access_combined
| search status="404"
| stats count by clientip, uri

Description: Flags repeated 404 errors, which may indicate probing or scanning activities.


2. Phishing

Attackers deliver malicious payloads or steal credentials through phishing emails.

KQL Queries

Identify Emails from Suspicious Domains

EmailEvents
| where SenderDomain endswith ".ru" or SenderDomain endswith ".cn"
| summarize count() by Sender, Subject, ReceivedTime

Description: Searches for emails from unusual or high-risk domains.

Monitor for Malicious Attachments

EmailAttachmentInfo
| where FileName endswith ".exe" or FileName endswith ".docm"
| summarize count() by FileName, Sender, ReceivedTime

Description: Identifies emails containing potentially malicious attachments.

Flag Emails with Suspicious Subjects

EmailEvents
| where Subject contains "urgent" or Subject contains "invoice"
| summarize count() by Sender, Subject, ReceivedTime

Description: Look for common phishing subject lines, such as "urgent" or "invoice."

Velociraptor VQL

Search for Suspicious Office Documents

SELECT * FROM FileSystem
WHERE filename =~ ".*\\.docm$"

Description: Finds recently created Office documents with macros enabled.

Identify PowerShell Commands

SELECT * FROM Processes
WHERE cmdline =~ ".*PowerShell.*DownloadString.*"

Description: Detects PowerShell usage commonly associated with malicious payloads.

Monitor New Executables in Downloads Folder

SELECT * FROM FileSystem
WHERE path =~ "C:\\Users\\*\\Downloads\\*.exe"

Description: Flags newly downloaded executables.

Splunk SPL

Email Attachment Analysis

index=email sourcetype=mail_logs
| search attachment="*.exe" OR attachment="*.docm"
| stats count by sender, attachment

Description: Identifies suspicious attachments in emails.

High Volume Emails from Single Sender

index=email sourcetype=mail_logs
| stats count by sender
| where count > 5

Description: Flags high email volume from a single sender, potentially indicative of phishing campaigns.

Keywords in Email Subject

index=email sourcetype=mail_logs
| search subject="*urgent*" OR subject="*payment*"
| stats count by sender, subject

Description: Searches for phishing-like keywords in email subjects.


3. External Remote Services

Attackers exploit remote access services like RDP, VPNs, or SSH to gain a foothold.

KQL Queries

Detect RDP Authentication Failures

SecurityEvent
| where EventID == 4625 and LogonType == 10
| summarize count() by Account, IPAddress, TimeGenerated

Description: Flags failed RDP login attempts (LogonType 10).

VPN Logon from Unusual Locations

SigninLogs
| where AppDisplayName == "VPN" and Location != "ExpectedLocation"
| summarize count() by UserPrincipalName, Location, TimeGenerated

Description: Detects VPN logins from unexpected geographic locations.

Repeated Brute-Force Attempts

SigninLogs
| where Status == "Failure" and ResultDescription contains "Invalid credentials"
| summarize Count=count() by UserPrincipalName, IPAddress, TimeGenerated

Description: Identifies accounts targeted by brute-force attacks.

Velociraptor VQL

Search for Failed Logins

SELECT * FROM Audit.WindowsEventLogs
WHERE EventID = 4625 AND EventData.LogonType = "10"

Description: Finds failed login attempts for RDP sessions.

Monitor Remote Services

SELECT * FROM Processes
WHERE cmdline =~ ".*mstsc.exe.*"

Description: Tracks usage of the mstsc.exe utility for remote desktop sessions.

Monitor for VPN Software Execution

SELECT * FROM Processes
WHERE cmdline =~ ".*openvpn.*"

Description: Detects OpenVPN usage, which could indicate unauthorized remote access.

Splunk SPL

Failed RDP Logins

index=authentication sourcetype=windows:security
| search EventCode=4625 LogonType=10
| stats count by AccountName, src_ip

Description: Flags failed RDP login attempts.

VPN Logins from New Locations

index=authentication sourcetype=vpn_logs
| stats dc(Location) by user
| where dc(Location) > 1

Description: Identifies VPN logins from unusual locations for the same user.

Repeated Login Failures

index=authentication sourcetype=windows:security
| search EventCode=4625
| stats count by src_ip, AccountName

Description: Highlights accounts targeted by repeated login failures.


The included descriptions and multiple queries for each technique should aid the investigations using KQL, Velociraptor, and Splunk, ultimately enhancing the detection and response capabilities in a Windows environment.

PreviousPhase 1 - Gaining an Initial FootholdNextEstablishing a Foothold

Last updated 4 months ago