Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

GhostTrace

A comprehensive SIEM and endpoint detection engineering project - catch what was not supposed to be seen.

GhostTrace is a hands-on detection engineering project that builds a full endpoint telemetry pipeline using Elastic Cloud, Elastic Defend, and Fleet, with a Kali Linux VM as the test endpoint. The lab walks through agent enrollment, adversary-style activity generation, log hunting, building a SIEM dashboard from scratch, and writing custom detection rules.

The goal is to simulate the complete workflow a SOC analyst or detection engineer would practice in a controlled environment: generate activity, collect telemetry, hunt the evidence, visualize the pattern through a custom dashboard, and convert repeatable behavior into alerts.


Objectives

  • Deploy an Elastic Cloud environment and access Kibana
  • Enroll a Kali Linux VM into Elastic Fleet with Elastic Defend
  • Generate endpoint activity with Nmap, gobuster, hydra, and baseline Linux commands
  • Query telemetry in Kibana Logs and Security
  • Build dashboard visualizations for endpoint event volume
  • Write custom detection rules with severity mapping
  • Validate alerts in Security > Alerts

Architecture

Kali Linux VM
  `-- Elastic Agent (Fleet-managed, Elastic Defend policy)
        `-- Elastic Cloud Deployment
              |-- Kibana Logs       -> telemetry search and hunting
              |-- Security Alerts   -> rule-triggered detections
              `-- Dashboards        -> event volume and severity views

Tooling

Component Role
Elastic Cloud Hosts the Elastic deployment and Kibana interface
Elastic Defend Collects endpoint telemetry and security events
Fleet Manages agent enrollment and policy assignment
Kali Linux Lab endpoint for command-line and scan activity generation
Nmap Port scan and service discovery telemetry
gobuster / hydra Higher-risk offensive tooling for alert testing
Kibana Dashboards Event count and severity distribution visualization

Repository Layout

.
|-- README.md
|-- assets/
|   `-- screenshots/
|-- docs/
|   |-- detection-rules.md
|   |-- lab-runbook.md
|   `-- troubleshooting.md
`-- .gitignore

Quick Start

1. Spin up the environment

  • Create an Elastic Cloud deployment
  • Open Kibana > Integrations > install Elastic Defend
  • Create a Fleet policy for the lab endpoint
  • Copy the Linux enrollment command from Fleet and run it on the Kali VM

2. Confirm agent health

sudo systemctl status elastic-agent.service

3. Generate test activity

# Reconnaissance
sudo nmap 127.0.0.1
sudo nmap -sS <target-ip>
sudo nmap -sT <target-ip>
sudo nmap -p- <target-ip>

# Web enumeration
gobuster dir -u http://<target-ip> -w /usr/share/wordlists/dirb/common.txt

# Credential attack simulation
hydra -l test -p test ssh://<target-ip>

# Baseline process noise
ls -l
mkdir ghosttrace-test
ping -c 4 <target-ip>

Only scan systems you own or are explicitly authorized to test.


Hunting Queries

Run these KQL queries in Kibana to confirm telemetry is arriving.

# Nmap activity
process.name : "nmap" or process.args : "nmap"

# Offensive tooling
process.name : ("gobuster" or "hydra") or process.args : ("gobuster" or "hydra")

# Baseline commands
process.name : ("ls" or "mkdir" or "ping") or process.args : ("ls" or "mkdir" or "ping")

# Privileged execution
process.name : "sudo" or process.args : "sudo"

# Normalized scan events, if applicable
event.action : "nmap_scan"

Detection Rules

Rule Query Focus Severity Purpose
Nmap Scan Detection Nmap process and scan flags High Detect reconnaissance and port enumeration
Offensive Tooling Alert gobuster and hydra process activity Critical Detect higher-risk offensive tooling
Baseline Command Monitor ls, mkdir, ping Low Verify endpoint telemetry collection
Sudo Usage Review sudo process and argument activity Medium Surface privileged command execution

Full rule logic: docs/detection-rules.md


Dashboard

Built in Kibana > Analytics > Dashboards using Lens visualizations:

  • Area chart - event count over time (@timestamp)
  • Bar chart - process volume by command family
  • Severity distribution - low / medium / high / critical alert spread
  • Data table - host, user, process, command line, event action

The dashboard answers three questions at a glance:

  1. Which endpoint generated activity?
  2. Which command family caused the spike?
  3. Which alerts need triage first?

Analyst Workflow

1. Generate controlled activity from Kali
2. Confirm Elastic Agent health in Fleet
3. Search Logs for process telemetry
4. Pivot into event details and inspect process.name, process.args, host.name, user.name, @timestamp
5. Build dashboard to compare event families
6. Convert repeatable patterns into custom query rules
7. Validate alerts in Security > Alerts
8. Tune severities and suppress noisy baseline commands

Step-by-Step Documentation

This section documents the lab build in the same order the environment was deployed, tested, and validated.

1. Create the Elastic Cloud Deployment

Start by creating an Elastic Cloud account and launching a default deployment. This deployment hosts Kibana, Fleet, Elastic Defend, dashboards, and alerting.

Elastic Cloud signup

After the deployment is created, confirm that the Elastic Cloud console shows the environment as available.

Elastic Cloud deployment console

2. Open Kibana Integrations

From Kibana, open the main navigation menu and go to Integrations. This is where the endpoint security integration is installed.

Kibana integrations navigation

Search for Elastic Defend and open the integration.

Elastic Defend integration search

3. Configure Elastic Defend and Fleet

Configure the Elastic Defend integration and attach it to a Fleet-managed agent policy. The policy controls what the enrolled Kali endpoint collects and forwards.

Elastic Defend policy configuration

Add the integration to the selected policy.

Elastic Defend add integration

Open the add-host workflow in Fleet so the Kali endpoint can be enrolled.

Fleet policy add host

Copy the Linux enrollment command generated by Elastic.

Elastic Agent install command

4. Install and Validate Elastic Agent on Kali

Run the enrollment command on the Kali Linux VM. Once complete, Elastic Agent starts sending endpoint telemetry to the Elastic deployment.

Agent install terminal output

Validate the agent service with systemd.

sudo systemctl status elastic-agent.service

Elastic Agent service status

5. Generate Endpoint Security Events

Generate controlled reconnaissance activity with Nmap. These commands create process telemetry and network-scan evidence that can be hunted in Kibana.

sudo nmap 127.0.0.1
sudo nmap -sS <target-ip>
sudo nmap -sT <target-ip>
sudo nmap -p- <target-ip>

Nmap localhost scan output

Run additional scans against authorized lab targets to create more event variety.

Nmap host scan output

Nmap service version scan output

Nmap additional scan output

6. Hunt the Telemetry in Kibana Logs

Open Observability > Logs to search the telemetry forwarded by Elastic Agent.

Elastic logs navigation

Search for Nmap-related process activity.

process.name : "nmap" or process.args : "nmap"

Log stream filter nmap

Open individual log entries to inspect event fields and confirm the command-line evidence.

Log event table actions

The event details show process arguments and other fields needed for detection rule logic.

Process args log field

Expand the event record to review the full context for the generated command.

Log event details expanded

7. Build a SIEM Dashboard from Scratch

Go to Analytics > Dashboards and create a dashboard for endpoint event visualization.

Dashboard navigation

Create a Lens visualization and choose a chart type such as area or bar.

Dashboard visualization type area

Start with an empty Lens editor and build the visualization manually.

Dashboard Lens empty editor

Use @timestamp for the horizontal axis so event volume can be viewed over time.

Lens horizontal axis timestamp

Use count as the vertical metric to measure the number of events.

Lens vertical axis count

Save the visualization once the event count appears correctly.

Dashboard event count view

Add multiple views to compare event volume and alert distribution in one dashboard.

Dashboard bar and area graphs

8. Create Custom SIEM Detection Rules

Open Security > Alerts, then go to rule management.

Security alerts navigation

Create a new rule from the rule management screen.

Alerts manage rules button

Select a custom query rule so the alert logic can be based on the telemetry observed during hunting.

Create custom query rule

Enable the rule after setting the query, severity, schedule, and actions.

Rule action enable button

Create a high-severity rule for Nmap scan activity.

process.name : "nmap" or process.args : "nmap" or process.args : ("-sS" or "-sT" or "-p-")

Rule nmap scan detection

Create a critical-severity rule for offensive tooling such as gobuster and hydra.

process.name : ("gobuster" or "hydra") or process.args : ("gobuster" or "hydra")

Rule gobuster hydra detection

Create a low-severity rule for baseline Linux commands to confirm endpoint process collection.

process.name : ("ls" or "mkdir" or "ping") or process.args : ("ls" or "mkdir" or "ping")

Rule basic Linux command detection

9. Validate Alerts with New Activity

Run another controlled command sequence from Kali to trigger the rules.

gobuster dir -u http://<target-ip> -w /usr/share/wordlists/dirb/common.txt
hydra -l test -p test ssh://<target-ip>
ls -l
ping -c 4 <target-ip>
sudo nmap -sS <target-ip>
sudo nmap -p- <target-ip>

Terminal generated commands

Generate more Nmap activity to confirm the scan rule fires consistently.

Nmap SYN scan output

Nmap full port scan output

Review Security > Alerts to confirm the expected low, high, and critical severity alerts appear.

Alerts severity distribution


Suggested Enhancements

  • Add Windows endpoint telemetry with Sysmon and Elastic Agent
  • Add Linux authentication failure rules for SSH and sudo misuse
  • Map all rules to MITRE ATT&CK: Discovery, Credential Access, Execution
  • Add response actions: Slack, email, or webhook notifications
  • Export detection rules as saved objects or NDJSON
  • Build a triage worksheet template for each alert type

Outcome

GhostTrace demonstrates a complete detection engineering loop: endpoint enrollment, telemetry generation, SIEM ingestion, log hunting, visualization, and alert engineering. Small enough to run as a personal lab. Structured like a production SOC workflow.


Built by Austin BC

About

Detection engineering platform for modeling adversary behavior, validating endpoint telemetry, and converting investigative hypotheses into high-confidence operational detections.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors