-
Set WiFi Adapter to Monitor Mode
- Select the interface that is placed into monitor mode (e.g.,
wlan0mon
).
- Select the interface that is placed into monitor mode (e.g.,
-
Filter for DeAuth Subtype
- Use the following filter in Wireshark:
wlan.fc.type == 0 && wlan.fc.type_subtype == 0x0C
-
Additional Reference
- For more details, see the article on analyzing deauthentication packets in Wireshark.
Note: Ensure the elastic_agent_endpoint
option within Elastic allows the subnet of the boxes where you want to deploy agents (e.g., 192.168.1.0/24
).
- Documentation: Refer to the Elastic Fleet Guide.
-
Navigate to Security Onion Manager:
- Go to
Fleet > Add Agent
.
- Go to
-
Create New Agent Policy:
- Provide a descriptive name for the agent policy.
-
Enroll in Fleet:
- Select the specific OS to install Elastic Agent (e.g., Windows or Linux).
-
Install Elastic Agent:
- Remotely access the box where you want to install the agent and execute the following commands line by line:
$ProgressPreference = 'SilentlyContinue' Invoke-WebRequest -Uri http://192.168.1.2:8443/artifacts/beats/elastic-agent/elastic-agent-8.14.3-windows-x86_64.zip -OutFile elastic-agent-8.14.3-windows-x86_64.zip Expand-Archive .\elastic-agent-8.14.3-windows-x86_64.zip -DestinationPath . cd elastic-agent-8.14.3-windows-x86_64 .\elastic-agent.exe install --url=https://192.168.1.2:8220 --enrollment-token=NlR2XzVKRUJGTVFRRVA4REF1d3c6STc5LVowcXVSQ3l6bjRuei1XOVpSQQ== --insecure
Note: The
--insecure
flag is used to address x509 certificate signed by unknown authority errors (use only in development environments). For more information, see Secure Connections -
Validate Log Ingestion:
- Run a simple file creation script and identify this activity in Elastic:
for ($i=0; $i -lt 25; $i++) { New-Item -Path C:\Users\simspace\Host_Generation -Name "File$i.txt" -ItemType "file" }
Here's a refined version of your markdown documentation for clarity and organization:
If Elastic Agent unenrollment fails, you can use the Kibana Fleet APIs to force unenroll the agent. Refer to the troubleshooting guide for more information.
-
Access Management:
- Navigate to
Management > Dev
.
- Navigate to
-
Make API Request to Disenroll Agent:
POST kbn:/api/fleet/agents/<agent_id>/unenroll { "force": true, "revoke": true }
-
Stop the Elastic Agent service:
Stop-Service -Name "Elastic Agent"
-
Remove the Elastic Agent directory:
Remove-Item -Path "C:\Users\simspace\elastic-agent-8.14.3-windows-x86_64" -Recurse -Force
-
Delete the Elastic Agent service:
sc.exe delete "Elastic Agent"
-
Verify the service removal:
Get-Service | Where-Object {$_.DisplayName -like "*Elastic Agent*"}
Navigate to the Elastic Agent directory and run the uninstall command:
cd "C:\Path\to\elastic-agent-8.14.3-windows-x86_64"
.\elastic-agent.exe uninstall
Feature | Beats | Elastic Agent |
---|---|---|
Purpose | Single-purpose shippers (e.g., logs, metrics) | Unified agent for logs, metrics, security |
Management | Managed individually | Centrally managed via Fleet |
Deployment | Deployed separately (Filebeat, Metricbeat, etc.) | One Elastic Agent per host |
Configuration | Separate YAML files for each Beat | Managed centrally via Fleet policies |
Security Integration | No built-in security features | Includes security (Endpoint Security, Malware Protection) |
Updates | Manual updates for each Beat | Automatic updates via Fleet |
Complexity | Higher complexity for multi-data type use cases | Simpler deployment, especially at scale |
Ideal Use Case | Lightweight, purpose-specific data collection | Unified data collection and security with centralized management |
-
Enable WinRm:
- Open an Administrator PowerShell session.
- Run
winrm quickconfig
.
-
Get Network Interface Index:
-
List all network adapters and their profiles:
Get-NetConnectionProfile
-
-
Set Network to Private:
-
Use the following command:
Set-NetConnectionProfile -InterfaceIndex <index#> -NetworkCategory Private
-
-
Configure WSMan:
Set-WSManQuickConfig -Force
-
Enable PowerShell Remoting:
Enable-PSRemoting -Force
-
Allow trust between your host and the client VM:
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "IP addresses here"
-
Appending trusted IP addresses without deleting what you've already created:
$current = Get-Item WSMan:\localhost\Client\TrustedHosts Set-Item WSMan:\localhost\Client\TrustedHosts -Value "ENTER_IPs_HERE"
-
Create a Session and Copy Item:
$session = New-PSSession -ComputerName 192.168.1.84 -Credential (Get-Credential) Copy-Item .\YOUR-FILE.ps1 -Destination "C:\Users\User\OneDrive" -ToSession $session
-
Run Executables:
PowerShell script:
powershell.exe -ExecutionPolicy Bypass -File .\script.ps1
Batch file:
& "C:\Path\to\executable.bat"
Here's a reorganized version of your markdown documentation with embedded links for clarity and organization:
$baseline = Get-Content .\baseline-service-20231018.txt
$current = Get-Content services-liveinvestigation.txt
Compare-Object -ReferenceObject $baseline -DifferenceObject $current
- Enable Windows Log Settings by Yamato-Security
- Run this Batchfile on each host to enhance native Windows logging!
Event | Specific Event Log | Essential Event IDs |
---|---|---|
Logons | Security | 4624, 4625, 4634, 4647, 4648, 4672, 4720, 4726 |
Account Logon | Security | 4768, 4769, 4771, 4776 |
RDP | Security | RDPClient | RDPCoreTS | RemoteConnectionManager | 4624, 4625, 4778, 4779, 1024, 1102, 98, 131, 1149 |
Network Shares | Security | 5140-5145 |
Scheduled Tasks | Security | TaskScheduler | 4698, 106, 140-141, 200-201 |
Installation | Application | 1033, 1034, 11707, 11708, 11724, 7034-7036, 7040, 7045 |
Services | System | Security | 4697 |
Log Clearing | Security | System | 1102, 104 |
Malware Execution | Security | System | Application | 1000-1002 |
Anti-Malware Log | Windows-Defender/Operational | 4688, 1116-1119 |
Command Lines | Security | PowerShell/Operational | 4688, 4103-4104 |
WMI | WMI-Activity/Operational | 5857-5861 |
The default "Windows Integration" in Fleet > Agent Policies contains essential Windows logging. To enhance it, include additional Event Codes to monitor.
-
Filter for Default Windows Integration:
winlog.channel: *
-
Log into Elastic Cloud / Kibana:
- Open your web browser and log in to your Elastic Cloud or Kibana instance.
- Navigate to the Fleet section in the side menu.
-
Create or Update a Fleet Policy:
- Go to the Policies tab under Fleet.
- Create a new policy or select an existing policy where the Windows agent is enrolled.
-
Add Windows Integration to the Policy:
- Click "Add Integration" within the policy.
- Search for Windows and install the integration.
- Configure input fields for Application, Security, System logs, etc.
-
Edit Integration Policy for Custom Event Logs:
- Click "Edit Integration."
- Scroll to the Custom Event Logs section.
- Add each log channel with its respective dataset and event IDs as defined in the YAML file below.
Note: Check the "advanced" sections for additional configurations.
Example:
- Event Log Name: Microsoft-Windows-PowerShell/Operational
- Dataset Name: windows.custom.powerShell
- Event IDs: 4103, 4104...
Note: The YAML method offers flexibility and efficiency for deploying multiple custom Windows Event Logs.
-
Ensure YAML Configuration is Correct:
inputs: - type: winlog streams: - name: security dataset: windows.security event_logs: - name: Security event_id: 4624, 4625 - name: application dataset: windows.application event_logs: - name: Application event_id: 1000, 1001 - name: powershell dataset: windows.custom.powerShell event_logs: - name: Microsoft-Windows-PowerShell/Operational event_id: 4103, 4104 - name: terminal_services_remote_connection_manager dataset: windows.custom.terminalServices event_logs: - name: Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational event_id: 1149 - name: terminal_services_local_session_manager dataset: windows.custom.localSessionManager event_logs: - name: Microsoft-Windows-TerminalServices-LocalSessionManager/Operational event_id: 21, 24, 25
-
Apply YAML Configuration Manually (Optional):
- Modify the Elastic Agent's configuration file directly on the agent host:
- For Linux:
/etc/elastic-agent/elastic-agent.yml
- For Windows:
C:\Program Files\Elastic\Agent\elastic-agent.yml
- For Linux:
- Insert your YAML configuration under the "inputs" section.
- Modify the Elastic Agent's configuration file directly on the agent host:
-
Restart the Agent: Ensure to restart the agent after applying changes for them to take effect.
Once the agent has ingested the custom event logs, you can verify the logs in Kibana.
-
Select Index Pattern:
- In the index pattern dropdown, select
logs-*
,logs-windows-*
, or the specific log ingestion setup you have.
- In the index pattern dropdown, select
-
Search for Custom Dataset and Event IDs:
-
Use the following search query:
event.dataset: "NAME_OF_DATASET" (e.g., "windows.custom.powershell") and event.code: (#### OR ####)
-
Note: Best practices for tracking integrations include:
- Using a common namespace (e.g.,
vg24range
) - Applying a common filter query (e.g.,
winlog.channel: Microsoft-Windows*
andwinlog.channel: "Application"
)
-
Navigate to Dashboard:
- Go to Kibana → Dashboard.
-
Create New Dashboard (if needed):
- Click on "Create new dashboard" to start from scratch or open an existing one to add visualizations.
-
Add a Visualization for PowerShell Logs:
- Click on "Create New" → "Visualization."
- Choose the type of visualization (e.g., table, bar chart, time series).
-
Set Up the Visualization:
- Index Pattern: Choose the appropriate index pattern, likely
logs-*
orlogs-windows-*
. - Filter by Dataset: Add a filter for the dataset you are interested in.
- Index Pattern: Choose the appropriate index pattern, likely
Log Integration | Index Pattern | Namespace | Operator | Filter Query and Channel | Event IDs |
Windows Endpoints | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: * | N/A |
Windows Endpoints | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "Microsoft-Windows-AppLocker/EXE and DLL" | 8003, 8004, 8001, 8002, 8005 |
Windows Endpoints | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "Microsoft-Windows-AppLocker/MSI and Script" | 8005, 8006, 8007 |
Windows Endpoints | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "Microsoft-Windows-AppLocker/Packaged app-Deployment" | 8007 |
Windows Endpoints | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "Microsoft-Windows-AppLocker/Packaged app-Execution" | 8008 |
Windows Endpoints | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "Microsoft-Windows-ForwardedEvents" | 4624, 4625, 4688, 4776, 4672, 4720, 4726, 4732, 4733, 4673, 4674, 4768, 4771, 4781, 4697 |
Windows Endpoints | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "Microsoft-Windows-PowerShell/Operational" | 4103, 4104, 4105, 4106, 4100, 4107 |
Windows Endpoints | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "Microsoft-Windows-PowerShell" | 400, 403, 600, 800 |
Windows Endpoints | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "Microsoft-Windows-Sysmon/Operational" | 1, 3, 7, 10, 11, 12, 13, 15, 22, 23, 25, 30, 32, 7045, 4649, 4616, 1102, 1104, 5156, 5158, 5145 |
Custom Log Integration | Dataset Name | Index Pattern | Namespace | Operator | Filter Query | Event IDs |
Terminal Services Remote Connection Manager | windows.custom.remote | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational" | 1149, 21, 1024, 1006, 1008, 1010, 1023, 1025 |
Application | windows.application | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "Application" | 1000, 1001, 1026, 2004, 2005, 2019, 2020 |
Security | windows.security | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "Security" | 4624, 4625, 4634, 4648, 4688, 4689, 4720, 4726, 4732, 4733, 4768, 4769, 4770, 4771, 4670, 4697, 4719, 1102 |
Setup | windows.setup | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "Setup" | 1000, 1001, 1002, 1011, 1020 |
System | windows.system | logs-* | data_stream.namespace : "vg24range" | AND | winlog.channel: "System" | 6005, 6006, 6008, 7000, 7001, 7011, 7036, 7040, 1101, 1102, 2004, 2019 |
- 8003, 8004: Application blocked or allowed (EXE/DLL)
- 8001, 8002: AppLocker policy changes (critical for detecting unauthorized changes)
- 8005: Script/MSI execution blocked or allowed (rules enforcement)
- 8006, 8007: Additional MSI/Script and packaged app logs for broader coverage
- 4624, 4625: Logon successes and failures, respectively
- 4688: Process creation events
- 4776: Credential validation errors
- 4672: Special privileges assigned to new logons (admin activities)
- 4720: User account creation
- 4726: User account deletion
- 4732, 4733: Group membership changes (new additions or removals)
- 4673: Privileged service requested
- 4674: Privileged object operation
- 4768, 4769, 4770: Kerberos Ticket requests and renewals
- 4771: Kerberos pre-authentication failed
- 4648: A logon was attempted using explicit credentials
- 4103, 4104: PowerShell script execution and script block logging
- 4105: Script termination
- 4106: Module loading
- 4100: PowerShell Provider started
- 4107: PowerShell script has been deleted
- 400: PowerShell engine state changes
- 403: Command executed
- 600: PowerShell script block logging (additional context for executed commands)
- 800: PowerShell script logging (script execution details)
- 1: Process creation (critical for tracking new processes)
- 3: Network connections (essential for identifying suspicious network activity)
- 7: Image loaded (DLL or driver loading)
- 10: Process access (used for lateral movement or process tampering)
- 11: File creation
- 12, 13: Registry object creation and deletion
- 15: File deletion
- 22, 23: DNS query logging
- 25: Process tampering detection (useful for malware or rootkit behavior)
- 30: File time modifications (often used to cover tracks)
- 32: WMI activity (WMI often used for lateral movement in attacks)
- 1102: The audit log was cleared (direct evidence of potential cover-up of malicious actions)
- 1104: Security log has been tampered with (important for detecting modification of security logs)
- 4616: System time was changed (useful in anti-forensics to manipulate timestamps)
- 1149: A remote desktop session has been disconnected. Useful for tracking remote session activities and potential unauthorized access.
- 21: A new remote desktop session has been created. Monitors when users initiate remote connections.
- 1024: A remote desktop session has ended. Important for auditing session terminations.
- 1006: Remote session logon failure. Crucial for detecting unauthorized access attempts or failed login attempts.
- 1008: Remote session logon success. Useful for tracking who has accessed the system remotely.
- 1010: Remote desktop session has been reconnected. Important for tracking reconnection events.
- 1023: Remote desktop connection failed. Useful for identifying potential connection issues or unauthorized access attempts.
- 1025: Remote desktop session configuration changes. Crucial for detecting unauthorized changes to session settings.
- 1000: Application Error (application crashes)
- 1001: Application Hang (application freezes)
- 1026: .NET Runtime Error (errors in .NET applications)
- 2004: Application Crash (detailed crash info)
- 2005: Application Hang (detailed hang info)
- 2019: Application crashes related to Windows services
- 2020: Application crashes due to COM component issues
- 4624: Successful Logon - A user successfully logged on to the system.
- 4625: Failed Logon - A logon attempt was unsuccessful.
- 4634: Logoff - A user logged off from the system.
- 4648: Logon Attempt with Explicit Credentials - A logon attempt was made with explicit credentials.
- 4656: Object Handle Request - An attempt was made to access an object.
- 4662: Operation Performed on Object - An operation was performed on an object.
- 4663: Access Attempt to Object - An attempt was made to access an object.
- 4670: Permissions on Object Changed - Permissions on an object were modified.
- 4688: Process Creation - A new process has been created.
- 4689: Process Termination - A process has ended.
- 4697: Service Installed on System - A service was installed on the system.
- 4719: System Audit Policy Changed - The audit policy was changed.
- 4720: User Account Creation - A user account was created.
- 4726: User Account Deletion - A user account was deleted.
- 4732: Member Added to Security-Enabled Local Group - A member was added to a security-enabled local group.
- 4733: Member Removed from Security-Enabled Local Group - A member was removed from a security-enabled local group.
- 4768: Kerberos Authentication Ticket (TGT) Request - A Kerberos TGT request occurred.
- 4769: Kerberos Service Ticket Request - A Kerberos service ticket request occurred.
- 4770: Kerberos Ticket Renewal - A Kerberos ticket was renewed.
- 4771: Kerberos Pre-Authentication Failure - A Kerberos pre-authentication attempt failed.
- 4776: NTLM Authentication - NTLM authentication occurred.
- 5145: Access Attempt to a Network Share Object - An attempt was made to access a network share object.
- 5136: Directory Service Object Modified - A directory service object was modified.
- 4657: Registry Value Modified - A registry value was modified.
- 5156: Windows Filtering Platform Allowed Connection - The Windows Filtering Platform allowed a connection.
- 1102: Audit Log Cleared - The audit log was cleared.
- 1000: New Application or Component Installed
- 1001: Setup Errors (Windows updates/applications)
- 1002: System Setup Changes (feature addition/removal)
- 1011: System Startup/Shutdown Related to Setup
- 1020: Major Setup Changes (Windows upgrade/feature installation)
- 6005: Event Log Service Startup
- 6006: Event Log Service Shutdown
- 6008: Unexpected Shutdown
- 7000: Service Failed to Start
- 7001: Service Dependency Failed
- 7011: Service Timeout
- 7036: Service State Change
- 7040: Service Startup Type Changed
- 1101: Shutdown Initiated
- 1102: Audit Log Cleared
- 2004: System Crashes/Stop Errors
- 2019: System Resource Exhaustion