PISA Pakistan — Community CERT

← 🚩 CTF: Getting Started

23. SIEM & Detection Engineering for CTF Forensics: Correlating Logs with MITRE ATT&CK

⏱ 11 min

Role of SIEM in CTF Forensics

A SIEM aggregates logs from multiple sources, letting you correlate events across a CTF scenario. In a forensic challenge you may need to spot a hidden APT‑style behavior, reconstruct a timeline, and identify the attacking technique.

Deploying ELK Stack Locally

  1. Docker Compose file for Elasticsearch, Logstash, Kibana:
version: '3'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0
    environment:
      - discovery.type=single-node
    ports:
      - \"9200:9200\"
  logstash:
    image: docker.elastic.co/logstash/logstash:8.11.0
    volumes:
      - ./logstash.conf:/usr/share/logstash/pipeline/logstash.conf
  kibana:
    image: docker.elastic.co/kibana/kibana:8.11.0
    ports:
      - \"5601:5601\"
  1. Start the stack: docker‑compose up -d.
  2. Verify Kibana at http://localhost:5601.

Ingesting Zeek & Suricata Logs

Configure Logstash to read JSON logs from Zeek (conn.log) and Suricata (eve.json). Use the json filter and index them under ctf-logs.

Writing Sigma Rules & Mapping to MITRE ATT&CK

Sigma converts detection logic to SIEM queries. Example rule for SMB brute‑force (T1110):

title: SMB Brute‑Force Attempt
id: 1a2b3c4d‑5e6f‑7890‑abcd‑ef1234567890
status: experimental
description: Detects multiple SMB login failures
logsource:
  product: suricata
  service: alert
detection:
  selection:
    alert.signature: 'SURICATA SMB login failure'
  condition: selection
level: high

Map the rule to MITRE ATT&CK technique T1110 – Brute Force.

Correlating Alerts – Example: Detecting Lateral Movement

Combine Zeek’s notice.log (anomalous SMB sessions) with Suricata alerts using Kibana’s Lens visualization. A spike in SMB login_failure events followed by a successful authenticated event flags lateral movement.

Do / Don't

  • Do store logs in a secure, append‑only Elasticsearch index.
  • Don't expose Kibana to the public CTF network without authentication.
  • Do test Sigma rules against a replay of captured PCAP to reduce false positives.
  • Don't rely solely on signatures; add behavioral anomaly detection.

Takeaway Today

Replay a sample PCAP with tshark to generate Suricata JSON logs, feed them into your ELK stack, and apply the Sigma rule above to confirm detection of a simulated SMB brute‑force.

Additional Sigma rule templates can be found at pisa.maahir.io.

← PrevNext →