FaresMorcy
  • Whoami
  • Footprinting Labs
    • Lab - Easy
    • Lab - Medium
    • Lab - Hard
  • Shells & Payloads
    • The Live Engagement
  • Password Attacks
    • Lab - Easy
    • Lab - Medium
    • Lab - Hard
  • SOC Hackthebox Notes & Labs
    • Security Monitoring & SIEM Fundamentals Module
    • Windows Event Logs & Finding Evil Module
    • Introduction to Threat Hunting & Hunting With Elastic Module
    • Understanding Log Sources & Investigating with Splunk Module
      • Introduction To Splunk & SPL
      • Using Splunk Applications
      • Intrusion Detection With Splunk (Real-world Scenario)
      • Detecting Attacker Behavior With Splunk Based On TTPs
      • Detecting Attacker Behavior With Splunk Based On Analytics
      • Skills Assessment
    • Windows Attacks & Defense
      • Kerberoasting
      • AS-REProasting
      • GPP Passwords
      • GPO Permissions/GPO Files
      • Credentials in Shares
      • Credentials in Object Properties
      • DCSync
      • Golden Ticket
      • Kerberos Constrained Delegation
      • Print Spooler & NTLM Relaying
      • Coercing Attacks & Unconstrained Delegation
      • Object ACLs
      • PKI - ESC1
      • Skills Assessment
    • Intro to Network Traffic Analysis Module
    • YARA & Sigma for SOC Analysts Module
      • Developing YARA Rules
      • Hunting Evil with YARA (Windows Edition)
      • Hunting Evil with YARA (Linux Edition)
      • Sigma and Sigma Rules
      • Developing Sigma Rules
      • Hunting Evil with Sigma (Chainsaw Edition)
      • Hunting Evil with Sigma (Splunk Edition)
      • Skills Assessment
  • TryHackme SOC 1
    • TShark
      • TShark: The Basics
      • TShark: CLI Wireshark Features
      • TShark Challenge I: Teamwork
      • TShark Challenge II: Directory
    • Tempest
    • Boogeyman 1
    • Boogeyman 2
    • Boogeyman 3
  • TryHackme SOC 2
    • Advanced Splunk
      • Splunk: Exploring SPL
      • Splunk: Setting up a SOC Lab
      • Splunk: Dashboards and Reports
      • Splunk: Data Manipulation
      • Fixit
    • Advanced ELK
      • Slingshot
    • Threat Hunting
      • Threat Hunting: Foothold
      • Threat Hunting: Pivoting
      • Threat Hunting: Endgame
  • TryHackme Rooms
    • Investigating Windows
    • Splunk 2
    • Windows Network Analysis
  • Powershell Scripting Fundamentals
  • SANS SEC504 & Labs
    • Book one
      • Live Examination
      • Network Investigations
      • Memory Investigations
      • Malware Investigations
      • Accelerating IR with Generative AI
      • Bootcamp: Linux Olympics
      • Bootcamp: Powershell Olympics
    • Book Two
      • Hacker Tools and Techniques Introduction
      • Target Discovery and Enumeration
      • Discovery and Scanning with Nmap
      • Cloud Spotlight: Cloud Scanning
      • SMB Security
      • Defense Spotlight: Hayabusa and Sigma Rules
    • Book Three
      • Password Attacks
      • Cloud Spotlight: Microsoft 365 Password Attacks
      • Understanding Password Hashes
      • Password Cracking
      • Cloud Spotlight: Insecure Storage
      • Multipurpose Netcat
    • Book Four
      • Metasploit Framework
      • Drive-By Attacks
      • Command Injection
      • Cross-Site Scripting
      • SQL Injection
      • Cloud Spotlight: SSRF and IMDS
    • Book Five
      • Endpoint Security Bypass
      • Pivoting and Lateral Movement
      • Hijacking Attacks
      • Establishing Persistence
      • Defense Spotlight: RITA
      • Cloud Spotlight: Cloud Post-Exploitation
  • SANS SEC511 & Labs
    • Resources
      • Primers
      • References
      • Tools
        • Network
        • Elastic Stack
      • Printable Versions
    • Book One
      • Part One
      • Part Two
      • Part Three
    • Book Two
      • Part One
      • Part Two
      • Part Three
      • Part Four
    • Book Three
      • Part One
      • Part Two
      • Part Three
      • Part Four
    • Book Four
      • Part One
      • Part Two
      • Part Three Lab
      • Part Four Lab
    • Book Five
      • Part One Lab
      • Part Two Lab
      • Part Three Lab
  • CyberDefenders
    • XXE Infiltration Lab
    • T1594 Lab
    • RetailBreach Lab
    • DanaBot Lab
    • OpenWire Lab
    • BlueSky Ransomware Lab
    • Openfire Lab
    • Boss Of The SOC v1 Lab
    • GoldenSpray Lab
    • REvil Lab
    • ShadowRoast Lab
    • SolarDisruption Lab
    • Kerberoasted Lab
    • T1197 Lab
    • Amadey Lab
    • Malware Traffic Analysis 1 Lab
    • Insider Lab
    • Volatility Traces Lab
    • FalconEye Lab
    • GitTheGate Lab
    • Trident Lab
    • NerisBot Lab
  • Practical Windows Forensics
    • Data Collection
    • Examination
    • Disk Analysis Introduction
    • User Behavior
    • Overview of disk structures, partitions and file systems
    • Finding Evidence of Deleted Files with USN Journal Analysis
    • Analyzing Evidence of Program Execution
    • Finding Evidence of Persistence Mechanisms
    • Uncover Malicious Activity with Windows Event Log Analysis
    • Windows Memory Forensic Analysis
  • Hackthebox Rooms
    • Campfire-1
    • Compromised
    • Brutus
    • Trent
    • CrownJewel-1
  • WEInnovate Training
    • Weinnovate - Active Directory Task One
    • Build ELK Lab
      • Configure Elasticsearch and Kibana setup in ubuntu
      • Configure Fluent-Bit to send logs to ELK
      • Set up Winlogbeat & Filebeat for log collection
      • Send Logs from Winlogbeat through Logstash to ELK
      • Enable Windows Audit Policy & Winlogbeat
      • Elasticsearch API and Ingestion Pipeline
    • SOAR
      • Send Alerts To Email & Telegram Bot
      • Integrate Tines with ELK
    • SOC Practical Assessment
    • Lumma C2
    • Network Analysis
  • Build ELK Lab
    • Configure Elasticsearch and Kibana setup in ubuntu
    • Configure Fluent-Bit to send logs to ELK
    • Set up Winlogbeat & Filebeat for log collection
    • Send Logs from Winlogbeat through Logstash to ELK
    • Enable Windows Audit Policy & Winlogbeat
    • Elasticsearch API and Ingestion Pipeline
  • Build Home Lab - SOC Automation
    • Install & configure Sysmon for deep Windows event logging
    • Set up Wazuh & TheHive for threat detection & case management
    • Execute Mimikatz & create detection rules in Wazuh
    • Automate everything with Shuffle
    • Response to SSH Attack Using Shuffle, Wazuh, and TheHive
  • Home Lab (Attack & Defense Scenarios)
    • Pass-the-Hash Attack & Defense
    • Scheduled Task Attack & Defense
    • Kerberoasting Attack & Defense
    • Kerberos Constrained Delegation
    • Password Spraying Attack & Defense
    • Golden Ticket Attack & Defense
    • AS-REProasting Attack & Defense
    • DCSync Attack & Defense
  • Home Lab (FIN7 (Carbanak Group) – Point of Sale (POS) Attack on Hospitality Chains)
  • Home Lab (Lumma Stealer)
Powered by GitBook
On this page
  • Endpoint Security Architecture
  • Microsoft Defender
  • Microsoft Defender for Cloud
  • Microsoft Defender for Cloud: ATT&CK Coverage
  • Microsoft Defender for Cloud: Basic Security Features
  • Microsoft Defender for Cloud: Secure Score
  • Microsoft Defender for Cloud: Security Policy
  • Microsoft Cloud Security Benchmark (MCSB)
  • Microsoft Defender for Cloud: Enhanced Security Features
  • Microsoft Defender for Cloud Security Posture Management (CSPM)
  • Defender for Cloud CSPM: Regulatory Compliance
  • Defender for Cloud: Regulatory Compliance Dashboard
  • Defender for Cloud: Workload Protections
  • Endpoint Protection Platforms (EPP)
  • EPP: Antivirus/Anti-malware
  • EPP: Host-Based Firewall
  • Windows Defender Firewall
  • Default WDFAS
  • Host-Based Firewall Capabilities
  • Microsoft Defender: Application Guard
  • Microsoft Defender: Application Guard + Edge
  • Guarded vs. Unguarded Edge
  • Microsoft Defender for Servers
  • Microsoft Defender for Servers: ATT&CK Coverage
  • Defender for Servers: Adaptive Network Hardening
  • Microsoft Defender for Servers: JIT VM Access
  • Microsoft Defender for Servers JIT Access: ATT&CK Coverage
  • Microsoft Defender for Servers: Adaptive Application Control
  • Microsoft Defender for Servers Adaptive Application Control: ATT&CK Coverage
  • Endpoint Detection and Response (EDR)
  • Host Detection without EDR
  • Microsoft Defender for Endpoint
  • Defender for Endpoint Plan 1 vs. Plan 2
  • Defender for Endpoint (Plan 1): Manual Response Actions
  • Defender for Endpoint: Attack Surface Reduction
  • Defender for Endpoint: Attack Surface Reduction Rules
  • Endpoint Monitoring and Sysmon
  • Endpoint Monitoring (on the Cheap)
  • Log Full Command Line of All Processes
  • Security Event ID 4688
  • Command Lines to Look For
  • Meterpreter Payload: Not So Normal…
  • PowerShell Logging
  • Microsoft Sysinternals Sysmon
  • Sysmon Capabilities
  • Example Sysmon XML Configuration
  • IMPHASH: Hash++
  • Sysmon Event Filtering
  • Detecting Unusual and Unsigned Drivers and Images with Sysmon
  • DeepBlueHash
  • Lab 4.1 - Sysmon
  • Bonus Exercise - Log DNS Requests
  1. SANS SEC511 & Labs
  2. Book Four

Part One

PreviousBook FourNextPart Two

Last updated 6 months ago

Endpoint Security Architecture

Adversaries mainly target data on endpoints. Protecting one endpoint is simpler than securing many devices, but it’s challenging because there are so many endpoints to cover.

A common challenge today is securing unmanaged or poorly managed devices, like mobile devices, in enterprises.

Microsoft Defender

Microsoft frequently renames products and services, making it hard to keep track of what’s available.

Microsoft rebranded its antivirus software from Windows Defender to Microsoft Defender, though it's also sometimes called Windows Security.

Microsoft's enterprise security products are mostly renamed as "Defender for ." Microsoft 365 Defender covers user protection, and Defender for Cloud focuses on cloud security.

Microsoft Defender for Cloud

Microsoft Defender for Cloud is a powerful Azure security tool. Although it can work alone, its real strength lies in its many integrations and additional features. While it may seem like a single product, it actually includes multiple Defender tools within the Defender for Cloud platform.

Microsoft Defender for Cloud is designed for multicloud and hybrid setups, but it also offers extensive features just for Azure.

Microsoft Defender for Cloud: ATT&CK Coverage

The photo shows part of the MITRE CTID project, mapping Azure security controls to MITRE ATT&CK. It lists 14 main adversary tactics and highlights ATT&CK techniques relevant to an Azure security control.

Microsoft Defender for Cloud: Basic Security Features

Microsoft Defender for Cloud offers many features, with basic security ones being free and enabled for Azure by default. However, it's only active once you open it in the Azure portal. The free features apply to Azure infrastructure, but if you integrate multicloud or hybrid assets, some costs might apply, although secure scoring remains free.

Azure provides basic security features for free, including secure score, security policy tips, and network security assessments through Microsoft Defender for Cloud.

Microsoft Defender for Cloud: Secure Score

Secure Score: "Defender for Cloud checks your resources for security issues and gives you a score. A higher score means lower risk."

The Secure Score in Microsoft Defender for Cloud gives a helpful security overview. It covers many areas, though not all security controls. Defender for Cloud supports multicloud security, integrating with AWS, GCP, GitHub, Azure DevOps, and hybrid systems. While integrating non-Azure assets costs extra, it provides more than basic security features.

The secure score is based on how assets match security controls in Defender for Cloud policies. Some controls are more important than others, and Azure assigns points to each. The highest score (10 points) is given for enabling MFA, while controlling VM management ports is also highly rated due to its importance in preventing password-based attacks like RDP exploits.

Microsoft Defender for Cloud: Security Policy

Defender for Cloud offers free security policies and initiatives that provide security recommendations. By default, only Microsoft’s Secure Cloud Benchmark is enabled, but many other prebuilt controls, based on global compliance standards, can be turned on for a subscription.

Defender for Cloud uses Azure Policy to manage security policies, initiatives, and recommendations. These are controlled from the Azure Policy dashboard. You'll notice the terms policy, initiative, and recommendation used clearly and specifically.

A security policy is a rule to monitor or enforce. Initiatives are bigger than policies and manage multiple policies together. They can be applied to subscriptions or management groups. If policies are violated, security recommendations are given for fixing them.

Microsoft Cloud Security Benchmark (MCSB)

Multicloud security is now a key focus for Microsoft, expanding beyond Azure to include AWS and GCP with the Microsoft Cloud Security Benchmark (MCSB). MCSB uses industry standards like CIS Controls, PCI-DSS, and NIST SP800-53, aligning its security recommendations with these standards.

The MCSB gives security best practices and advice to protect Azure workloads, data, and services, focusing on cloud security with input from Microsoft and industry experts.

Microsoft Defender for Cloud: Enhanced Security Features

Microsoft Defender for Cloud's free features offer some benefits, but most advantages come with the paid "enhanced security features." These features are often extensions of the basic ones but also include standalone tools now managed through the Defender for Cloud portal.

Cloud Security Posture Management is an upgrade to basic features, while Defender for Containers and Defender for Servers are more complete products that integrate well with Defender for Cloud. Some Defender for Cloud features were separate products before Defender for Cloud existed.

Microsoft Defender for Cloud Security Posture Management (CSPM)

Microsoft Defender for Cloud CSPM checks your resources and subscriptions for security issues and shows your security status with a score. A higher score means lower risk.

Cloud Security Explorer offers a visual interface to view data from your multicloud environment, allowing queries to check the security status, with some preloaded queries for easier analysis.

The cloud security graph is analyzed with an attack path algorithm that finds weak spots attackers might exploit and suggests ways to fix them. Microsoft says it considers factors like internet exposure, permissions, and lateral movement to spot potential security risks.

Defender for Cloud CSPM: Regulatory Compliance

The MCSB provides good security recommendations, but organizations must follow their own compliance standards. Defender for Cloud's Regulatory Compliance Dashboard helps with compliance tasks, covering major standards like PCI, HIPAA, SOC 2, and more. The compliance features are free, but only the Microsoft Cloud Security Benchmark is included by default.

To track standards beyond MCSB, you need to enable Defender for Cloud's enhanced security features. The dashboard shows this, but the guidance still uses old names like Azure Defender and Azure Security Benchmark, and doesn’t clarify that "enabling" refers to advanced features, not the basic free ones.

If more standards are enabled, a gap analysis can show all recommendations. The Regulatory Compliance Dashboard can also generate reports for each standard's compliance if needed.

Defender for Cloud: Regulatory Compliance Dashboard

The dashboard shows how well the organization follows compliance policies. You can check individual policies to find any gaps. It lets you see where noncompliance exists and how many resources are affected. Some controls are automatically checked, but others need manual input to determine if they are followed correctly.

Defender for Cloud's compliance dashboard lets you start fixes directly from it, with Microsoft marking quick fixes for fast security improvements.

Some recommendations may not be fixed quickly and might need extra approval. In these cases, we assign someone to be responsible for review and fixing.

Defender for Cloud: Workload Protections

Microsoft still refers to Azure Security Center and Azure Defender in some docs, but these have now been merged into Microsoft Defender for Cloud. A key feature of Defender for Cloud is the Workload Protections dashboard.

Microsoft highlights the numbered components of Defender for Cloud:

  • Microsoft Defender for Cloud Coverage - Shows eligible resources in your subscription for protection, with an option to upgrade all.

  • Security Alerts - Notifies you of threats with details and remediation steps. You can also trigger automated responses.

  • Advanced Protection - Displays the status of advanced protections (VMs, SQL, containers, etc.) and lets you configure them.

  • Insights - Provides news, alerts, and suggestions on important security issues for your subscription.

Endpoint Protection Platforms (EPP)

Traditional antivirus is nearly obsolete. Although it still exists, its decreasing effectiveness has led most companies to stop selling standalone antivirus software.

Antivirus is just one part of a broader set of security tools called Endpoint Protection Platform (EPP). There isn't a single definition for EPP, and it keeps changing to stay ahead of threats.

A recent change is adding Endpoint Detection and Response (EDR) to Endpoint Protection Platforms (EPP). The key is to check what your EPP offers and identify any gaps that need fixing.

EPP: Antivirus/Anti-malware

Security pros have criticized basic antivirus for years, even calling it "dead." Some suggest removing it, but I think it's simple—just install it and move on to other tasks.

AV is unlikely to be a hugely significant boon to your approach at catching evil. It is extremely far from perfect, and yet, just deploy it and keep moving.

EPP: Host-Based Firewall

Section 2 covered network firewalls, but here we focus on endpoint firewalls. They offer similar benefits, with their logging features providing a bigger security advantage than their preventive role.

Standalone desktop firewalls are mostly outdated. It's hard to justify paying extra for them when most organizations already have free options like Windows Defender or firewalls included in their existing security suite.

Windows Defender Firewall

Since Windows XP SP2, Microsoft has included a firewall, now called Windows Defender Firewall with Advanced Security (WDFAS), in modern Windows OS for better security.

WDFAS is a free, pre-installed firewall that can be managed with Group Policy. It offers network location awareness for different firewall rules on different networks and egress filtering for controlling outbound traffic. It’s a stateful firewall, meaning it tracks connection states rather than checking each packet individually.

WDFAS logs stay local by default, which ties into my frustration with Microsoft's past lack of centralized logging, although they've improved lately.

Default WDFAS

This course doesn't cover creating a full firewall rulebase, but it's important to understand that WDFAS doesn't block outbound traffic by default. Setting it up correctly is challenging but valuable.

A key issue is poor logging setup, but it's easy to fix. By default, WDFAS logs don’t block or allow connections, but this can be enabled. The log size is limited to 4 MB, which can be increased to 32 MB. There’s no built-in centralized logging, so it's a good idea to configure separate logs for each profile, especially on laptops, since all profiles use the same log file by default (C:\Windows\System32\LogFiles\Firewall\pfirewall.log).

Host-Based Firewall Capabilities

Firewalls have blocked IPs and ports for years, but most host firewalls, like Windows', can also block by application—though this feature is rarely used.

Microsoft Defender: Application Guard

New Windows 10/11 controls use Microsoft's Hyper-V to isolate less trustworthy or sensitive parts of the system. Microsoft Defender Application Guard helps prevent both old and new attacks by isolating hardware, making current attack methods ineffective.

Application Guard improves security by isolating Microsoft Office and Edge, which are commonly targeted apps.

Application Guard in Microsoft Office opens untrusted Word, PowerPoint, and Excel files in a safe, isolated container. This keeps the main system protected if the file is malicious, preventing attackers from accessing your data or credentials.

Microsoft Defender: Application Guard + Edge

Application Guard protects Microsoft Edge by isolating untrusted websites in a secure container. As an admin, you define trusted sites, and anything else is considered untrusted. When employees visit untrusted sites, Edge opens them in a safe, isolated environment.

If your organization doesn't require Microsoft Edge, you can use an extension for other browsers like Chrome to integrate with Application Guard. If a user visits a site not on the safelist, it will open in an Isolated Edge instead of Chrome.

Microsoft Defender Application Guard keeps devices safe by opening untrusted websites in a secure version of Edge, preventing any harm if the site is malicious.

Guarded vs. Unguarded Edge

The screenshots show the impact of running Edge in Application Guard isolation. Both guarded and unguarded Edge instances run simultaneously. In the Browser Task Manager, the unguarded Edge shows multiple tabs and windows, while the guarded instance is isolated. The PID for the guarded instance is not visible in Task Manager or even in an elevated Process Hacker. Additionally, Application Guard prevents copying and pasting data from the isolated Edge.

Microsoft Defender for Servers

Microsoft Defender for Servers offers strong protection for Azure-hosted Windows servers, but also supports Windows and Linux machines across Azure, AWS, GCP, and on-premises, emphasizing its role in multicloud and hybrid environments.

Microsoft Defender for Servers is a security tool that boosts protection, detection, and response for Windows machines. It works with Azure services to monitor and protect servers, while Defender for Cloud displays alerts and fixes in a simple format.

Defender for Servers collects Linux audit logs using auditd, but its threat protection for Linux is weaker than for Windows, especially in Azure environments.

Defender for Servers has two plans: a limited Plan 1 and a full Plan 2. Both plans include Microsoft Defender for Endpoint (MDE), which is a complete EDR tool. With Defender for Servers, MDE’s protection and response features are shown in the Defender for Cloud's Workload Protection Dashboard.

Microsoft Defender for Servers: ATT&CK Coverage

The photo shows how Azure security controls map to MITRE ATT&CK® tactics and techniques, highlighting 14 key adversary tactics and related techniques identified by CTID.

Defender for Servers: Adaptive Network Hardening

A common security issue is giving internet-accessible hosts too much network access. Adaptive Network Hardening (ANH) in Defender for Servers helps identify and fix overly open access. It's shown in the Workload Protections dashboard. Despite sounding unnecessary, ANH is still needed and useful.

A possible reason for open ports is the default settings in many Marketplace VM deployments. For example, Windows often exposes TCP/3389 (RDP) and Linux TCP/22 (SSH) by default. Exposing these ports doesn’t usually trigger alerts or recommendations, as it's seen as normal, though not ideal.

Microsoft Defender for Servers: JIT VM Access

Many Azure Marketplace VMs expose remote administration ports to the public internet by default. While users should choose secure images, default ones often allow this for ease of use. Despite Microsoft's warnings, this risky setting remains the default for quick deployments.

Adaptive Network Hardening (ANH) gives recommendations and alerts about risky services exposed to the internet, but exposing RDP/SSH alone doesn’t trigger a warning. If remote admin access is needed, we can temporarily allow it through NSG, similar to Just-In-Time (JIT) VM access. JIT simplifies this process and reduces user error, with default settings blocking access. It also allows temporary access and can limit it to specific IP addresses. The "Maximum request time" option sets a time limit for allowed access.

Admins can start the "Request access" process through Defender for Cloud, the VM connect page in Azure Portal, PowerShell, or the Microsoft Defender for Cloud API.

Microsoft Defender for Servers JIT Access: ATT&CK Coverage

The photo shows a part of the MITRE Engenuity CTID project, mapping Azure security controls to MITRE ATT&CK®. It lists 14 main adversary tactics and highlights the ATT&CK techniques relevant to Azure security controls.

Microsoft Defender for Servers: Adaptive Application Control

Application control (or whitelisting) has long been a strong security measure, allowing only safe apps to run. However, many organizations found it hard to manage and abandoned it. While it’s easier to use now, challenges and the perception that it's difficult persist.

Defender for Server's Adaptive Application Control automatically creates rules for safe software based on your systems. It tailors these rules to each system, allowing different rules for different system groups.

CTID's Security Stack Mappings explain that AAC allow lists are for Azure workloads, customizable, and based on trusted paths, publishers, and hashes. Security alerts occur when unauthorized applications run with AAC enabled.

Microsoft Defender for Servers Adaptive Application Control: ATT&CK Coverage

The photo shows part of the MITRE CTID project, mapping Azure security controls to MITRE ATT&CK®. It lists 14 main adversary tactics and shows relevant ATT&CK techniques for the Azure control.

Endpoint Detection and Response (EDR)

ASD explains why EDR is included in the full Mitigation Strategies document:

EDR software constantly logs system activity, helping detect both known and unknown cyber threats. It enables quick investigations, blocks certain network actions, and can isolate compromised devices.

Agent fatigue is real, and deploying another agent across an enterprise can feel overwhelming. However, this one stands out because it focuses on detection and response, not prevention—a rare but valuable feature in cybersecurity.

EDR tools provide huge amounts of data, enabling detailed threat detection but can be overwhelming without careful tuning. Unlike past response tools used only after an attack, EDR now allows faster data gathering and remote actions, supporting quick incident response.

Host Detection without EDR

If you don’t have an EDR tool, you can still use other data sources for detecting threats. One overlooked source is the endpoint firewall. Many, like Microsoft, don’t log connections by default, but enabling it—even without blocking connections—provides valuable insights for detection without dedicated tools.

Application control tools are crucial for blocking unknown files from running. But we also need to ask: how did these files get there, are they malicious, and was the block bypassed?

Microsoft Defender for Endpoint

Gartner ranks Defender for Endpoint as a top leader in endpoint protection. They praise it for providing a full set of security tools (EPP, EDR, threat hunting) from one console, and note that it has improved significantly with new features in each Windows 10 update to offer strong, layered security.

Defender for Endpoint Plan 1 vs. Plan 2

The new Defender for Endpoint Plan 1 offers a cheaper option with some of the original features.

Defender for Endpoint Plan 1 includes the following capabilities:

"Powerful antivirus and antimalware protection with manual quarantine options, attack prevention, and detailed control over device access. Central management through Microsoft 365 Defender, supporting Windows, macOS, iOS, and Android."

Defender for Endpoint (Plan 1): Manual Response Actions

Manual response actions let your security team respond to threats on devices or files. Defender for Endpoint offers actions to handle potentially compromised devices or suspicious files.

File/Device
Action
Description

Device

Run antivirus scan

Starts a scan for threats; if found, they are usually fixed during the scan.

Device

Isolate device

Disconnects a device from the network but keeps it connected to Defender for Endpoint for monitoring and further action.

File

Stop and quarantine

Stop processes from running and quarantines associated files.

File

Add an indicator to block or allow a file

Block indicators stop executable files from being accessed, while allow indicators let them through.

Defender for Endpoint: Attack Surface Reduction

Losing ASR across all Windows OS is disappointing, but it was mainly useful for technical enterprise clients. With Defender for Endpoint Plan 1, you can protect your devices and apps, reducing your organization's cyberattack risks.

Attack surface reduction rules block or detect risky app behaviors:

Running suspicious files or scripts that download or execute other files, especially if they're hidden or unusual.

When ASR rules trigger, events are logged in the Microsoft-Windows-Windows Defender/Operational log. EventID 5007 notes changes to ASR settings, EventID 1121 logs blocked activities, and EventID 1122 logs triggered rules that aren't set to block.

Defender for Endpoint: Attack Surface Reduction Rules

If you're experienced with modern attacks, you'll understand how Microsoft develops ASR rules, offering detailed info on high-priority and other rules.

Below is a screenshot showing how to configure ASR rules in the Microsoft 365 Defender portal:

Endpoint Monitoring and Sysmon

Endpoint Monitoring (on the Cheap)

Commercial EDR tools like Microsoft Defender for Endpoint have strong features, but their cost and complexity can be a barrier for some organizations.

We have free solutions that can be used temporarily or as a full, effective option while moving toward a commercial product.

Log Full Command Line of All Processes

Microsoft security advisory "Update to improve Windows command-line auditing" adds:

This update adds a feature to Windows that logs events when a process is created, including the command-line info. These events appear in ID 4688 in the Windows Security log, helping admins troubleshoot and investigate security issues.

Security Event ID 4688

Event ID 4688 is useful but can generate a lot of data. Full command-line details, especially from cmd.exe or PowerShell, are essential for detecting threats. Despite the high volume, these events are valuable for SIEM alerts and investigations.

4688 with full command-line auditing can expose sensitive data, like passwords, if passed in commands. Instead of avoiding auditing, update processes to handle potential issues as they arise.

Command Lines to Look For

Enabling full command-line logging gives useful data but can create a lot of noise. The goal is to find the important info.

Once logging full command lines, search for the following:

  • Loooooooooong commands (1,000+ bytes) •

  • rundll32.exe and cscript.exe

  • .vbs scripts

  • Anything launched from a temp folder

  • Launching PowerShell via cmd.exe

  • Base64-encoded commands

  • whoami /priv

  • vssadmin

  • sdelete

  • schtasks and at

  • net group "Domain Admins" /domain

Meterpreter Payload: Not So Normal…

We'll cover ways to monitor command-line usage during 511.5. For now, here's a quick look at how Meterpreter creates a large PowerShell command with a compressed/base64-encoded function. Without full command-line logging or Sysmon, EventID 4688 will only show powershell.exe running.

PowerShell Logging

PowerShell is widely used by both legitimate users and attackers. Just seeing powershell.exe running isn't enough to tell if it's malicious. Microsoft improved PowerShell logging a lot, especially in version 5.0, making it much better at detecting suspicious activity.

Microsoft Sysinternals Sysmon

  • Sysmon 10 added DNS query logs (Event ID 22).

  • Sysmon 11 introduced file deletion logs (Event ID 23).

  • Sysmon 12 added clipboard interaction logs (Event ID 24).

  • Sysmon 13 added process tampering logs (Event ID 25).

This Sysmon update adds a process tampering event that detects when a process image doesn’t match the file or is locked. It helps spot process hollowing and herpaderping. It also fixes some bugs and memory leaks.

Sysmon Capabilities

ID
Tag
Event

1

ProcessCreate

Process Create

2

FileCreateTime

File creation time

3

NetworkConnect

Network connection detected

5

ProcessTerminate

Process terminated

6

DriverLoad

Driver Loaded

7

ImageLoad

Image loaded

8

CreateRemoteThread

CreateRemoteThread detected

9

RawAccessRead

RawAccessRead detected

10

ProcessAccess

Process accessed

11

FileCreate

File created

12

RegistryEvent

Registry object added or deleted

13

RegistryEvent

Registry value set

14

RegistryEvent

Registry object renamed

15

FileCreateStreamHash

File stream created

17

PipeEvent

Named pipe created

18

PipeEvent

Named pipe connected

19

WmiEvent

WmiEventFilter activity detected

20

WmiEvent

WmiEventConsumer activity detected

21

WmiEvent

WmiEventConsumerToFilter activity detected

22

DNSEvent

DNS query detected

24

ClipboardChange

Logs changed clipboard contents

26

FileDeleteDetected

File Deletion

FileDelete is a standout feature, making Sysmon as effective as, or better than, many EDR tools by logging deleted files.

Think carefully before enabling ClipboardChange. Password managers, like LastPass, often copy passwords to the clipboard. Logging these passwords increases security risks by exposing them in more places. Using ClipboardChange could weaken security rather than strengthen it. The authors recommend avoiding it in production unless it’s strictly needed, and even then, test it thoroughly before sending data to a SOC.

ProcessTampering detects files changed after being loaded by the system. This "Herpaderping" method hides malicious code, tricking security tools or the system into running it.

Sysmon v14 introduced EDR-style features, including blocking EXE files in certain folders like "Temp" or "\users."

Example Sysmon XML Configuration

<Sysmon schemaversion="4.1">
  <!-- Capture all hashes -->
  <HashAlgorithms>*</HashAlgorithms>
  <EventFiltering>
    <!-- Log all drivers except if the signature -->
    <!-- contains Microsoft or Windows -->
    <DriverLoad onmatch="exclude">
      <Signature condition="contains">microsoft</Signature>
      <Signature condition="contains">windows</Signature>
    </DriverLoad>
    <!-- Do not log process termination -->
    <ProcessTerminate onmatch="include" />
    <!-- Log network connection if the destination port equal 443 -->
  <NetworkConnect onmatch="include">
    <DestinationPort>443</DestinationPort>
  </NetworkConnect>
  </EventFiltering>
</Sysmon>

IMPHASH: Hash++

Sysmon uses traditional hashes (MD5, SHA1, SHA256) and IMPHASH. Traditional hashes change if even a small part of a file changes, which is great for checking file integrity and finding identical files or malware.

If an attacker changes their payload slightly, a traditional hash won’t help. IMPHASH, which uses the order of imported DLL functions, lets us find new, similar samples by the same threat group.

Sysmon Event Filtering

The following event filters exclude drivers with "Microsoft" or "Windows" in the signature:

<DriverLoad onmatch="exclude">
    <Signature condition="contains">microsoft</Signature>
    <Signature condition="contains">windows</Signature>
</DriverLoad>

The following event filter includes traffic sent to port 443:

<NetworkConnect onmatch="include">
    <DestinationPort>443</DestinationPort>
</NetworkConnect> 

Detecting Unusual and Unsigned Drivers and Images with Sysmon

Sysmon logs loaded files like .EXE, .DLL, and .SYS. Most are signed, like a Microsoft DLL in Taskmgr.exe. But some, like Mimikatz, are unsigned.

DeepBlueHash

DeepBlueHash is a PowerShell tool that submits SHA256 hashes to VirusTotal using an API key. A free key allows 4 queries per minute. It collects hashes from Sysmon events like process creation, driver loads, and image/DLL loads, or from a file.

DeepBlueHash also supports a safelist, which may be generated directly via PowerShell:

PS:\> Get-ChildItem c:\windows\system32 -Include '*.exe','*.dll','*.sys','*.com' -Recurse | Get-FileHash | Export-Csv -Path safelist.csv

Lab 4.1 - Sysmon

Objectives:

  • Use and understand the Sysinternals Sysmon command.

  • Configure Sysmon.

  • Filter Sysmon logging based on:

    • Processes

    • Network connections

    • Driver loading

    • Image loading

Let's start by Installing Sysmon:

sysmon64 -i
sysmon64 -c

To view a summary of Sysmon logs in PowerShell, let's type:

Get-WinEvent @{logname="Microsoft-Windows-Sysmon/Operational";}

We can see more details by using "fl" (format list) and paging with "more":

Get-WinEvent @{logname="Microsoft-Windows-Sysmon/Operational";} | fl | more

We can also filter based on the Sysmon id, to show only ProcessCreate events (id 1), add "id=1" before the closing bracket in the Get-WinEvent command. We'll use Select-Object -first 1 to display just the first event.

Get-WinEvent @{logname="Microsoft-Windows-Sysmon/Operational";id=1} | Select-Object -first 1 | fl

Challenges

Reconfigure Sysmon to perform the following actions:

  • Log SHA1 hashes only.

  • Log DriverLoad, except for drivers with a signature containing "microsoft", "windows", or "sysinternals".

  • Log ImageLoad, except for images (DLLs) with a signature containing "microsoft", "windows" or "sysinternals".

  • Disable process termination logging.

  • Log network connections, but ignore ports 80, 137, and 443.

  • Log process creation.

  • Use the SHA1 hash to ignore putty.exe

  • Load your new Sysmon configuration and verify it is running properly.

  • Run the command ipconfig /all

First, we'll copy \labs\sysmon-config-basic.txt to \labs\sysmon-config.txt.

copy \labs\sysmon-config-basic.txt \labs\sysmon-config.txt

Then, let's load this configuration to ensure it works properly:

sysmon -c \labs\sysmon-config.txt

Let's display the current Sysmon configuration:

sysmon64 -c

Let's start editing the file. It's best to make one change at a time, saving and reloading the configuration after each change. This makes it easier to spot errors.

1) Log SHA1 hashes only.

We need to change these two lines of the configuration:

<!-- Capture all hashes -->
<HashAlgorithms>*</HashAlgorithms>

Change to:

<!-- Capture SHA1 hashes -->
<HashAlgorithms>SHA1</HashAlgorithms>

Then we save the file in Notepad and load the updated configuration:

sysmon -c c:\labs\sysmon-config.txt

Let's display Sysmon events with ID 1 (ProcessCreate) in a list format:

Get-WinEvent @{logname="Microsoft-Windows-Sysmon/Operational";id=1}| fl | more

We can see that processes are logging with SHA1 only.

2) Log DriverLoad, except for drivers with a signature containing "microsoft", "windows", or "sysinternals".

The script already includes "microsoft" and "windows," so just let's add "sysinternals" to that part.

<DriverLoad onmatch="exclude">
    <Signature condition="contains">microsoft</Signature>
    <Signature condition="contains">windows</Signature>
    <Signature condition="contains">sysinternals</Signature>
</DriverLoad>

Let's save the file in Notepad and load the updated configuration:

sysmon -c c:\labs\sysmon-config.txt

Now, let's check Sysmon events with ID 6 (DriverLoad) for any entries that happened after the initial Sysmon setup.

Get-WinEvent @{logname="Microsoft-Windows-Sysmon/Operational";id=6}| fl | more

3) Log ImageLoad, except for images (DLLs) with a signature containing "microsoft", "windows" or "sysinternals".

Let's create a new section for the ImageLoad:

<ImageLoad onmatch="exclude">
    <Signature condition="contains">microsoft</Signature>
    <Signature condition="contains">windows</Signature>
    <Signature condition="contains">sysinternals</Signature>
</ImageLoad>

Now, let's save the file in Notepad and load the updated configuration:

sysmon -c c:\labs\sysmon-config.txt

Then let's view Sysmon events with id 7 (ImageLoad), and format list output:

Get-WinEvent @{logname="Microsoft-Windows-Sysmon/Operational";id=7}| fl | more

4) Disable process termination logging.

The current ProcessTerminate section doesn't need any changes.

<!-- Do not log process termination -->
<ProcessTerminate onmatch="include" />

Let's check Sysmon events with ID 5 (ProcessTerminate) for any entries that happen after the initial Sysmon setup.

Get-WinEvent @{logname="Microsoft-Windows-Sysmon/Operational";id=5}| fl | more

Note: If you use an "include" or "exclude" statement without a filter, it has the opposite effect. For example, the statement below instructs Sysmon to log all “ProcessCreate” events and not to log any “FileCreateTime” events.

<Sysmon schemaversion=”4.1”>
  <EventFiltering>
    <ProcessCreate onmatch=”exclude”/>
    <FileCreateTime onmatch=”include”/>
  </EventFiltering>
</Sysmon>

5) Log network connections, but ignore ports 80, 137, and 443.

Let's edit the NetworkConnect section:

<NetworkConnect onmatch="include">
    <DestinationPort>443</DestinationPort>
    <DestinationPort>80</DestinationPort>
</NetworkConnect>

The current section logs ports 443 and 80, ignoring others. We want to exclude ports 137, 80, and 443, and log the rest. We need to change "onmatch" to "exclude" and add a line for DestinationPort.

<NetworkConnect onmatch="exclude">
    <DestinationPort>137</DestinationPort>
    <DestinationPort>443</DestinationPort>
    <DestinationPort>80</DestinationPort>
</NetworkConnect>

Let's generate 53/udp traffic to create a log entry:

nslookup www.sec511.com

Next, let's view Sysmon events with ID 3 (NetworkConnect) and display the output as a list:

Get-WinEvent @{logname="Microsoft-Windows-Sysmon/Operational";id=3}| fl | more

6) Log process creation, and use the SHA1 hash to ignore putty.exe.

Let's run putty, and then check the SHA1 signatures.

putty
Get-WinEvent @{logname="Microsoft-Windows-Sysmon/Operational";id=1}| fl | more

Next, let's copy the SHA1 hash and use it to ignore putty.exe.

<ProcessCreate onmatch="exclude">
    <Hashes condition="contains">3B1333F826E5FE36395042FE0F1B895F4A373F1B</Hashes>
</ProcessCreate>

Then, we'll load the new config, note the time, open PuTTY, and check Sysmon events with ID 1 (ProcessCreate) in list format.

sysmon64 -c \labs\sysmon-config.txt
date
putty
Get-WinEvent @{logname="Microsoft-Windows-Sysmon/Operational";id=1}| fl | more

Finally, let's run ipconfig /all, and verify the command line was logged by Sysmon:

ipconfig /all

Bonus Exercise - Log DNS Requests

Let's edit our sysmon configuration in notepad:

notepad C:\labs\sysmon-config.txt

Then, we'll insert the following section near the end of the file

<DnsQuery onmatch="exclude"></DnsQuery>

Next, let's open Chrome, and surf to: https://sec511.com

Now, let's use Get-WinEvent to view DNS events (id=22), and pipe the output to ogv (Out-GridView) for an easy way to search and view the events.

Get-WinEvent @{logname="Microsoft-Windows-Sysmon/Operational";id=22}| ogv

Let's click "Add criteria" and choose "Message" to search events by keywords.

Then enter "sec511.com" in the "Message contains" field

It shows the QueryName, the resolved IP address (QueryResult), and the program (Image) that made the query.

Microsoft has combined its Defender tools into one console at for unified threat protection, detection, and response across email, identity, and devices.

Sysmon updates often (several times a year). Check for the latest version at . Major updates add new detection methods and Event IDs.

Reference:

security.microsoft.com
https://sec511.com/7m
https://www.whatsupgold.com/blog/how-to-tune-windows-system-monitor-sysmon