Перейти к основному содержимому
Packet-Analysis Lab: Detecting Multi-Stage Intrusions
Урок 12 из 12

Packet-Analysis Lab: Detecting Multi-Stage Intrusions

Learn to correlate Suricata alerts with tshark and Wireshark filters to reconstruct multi-stage intrusions across delivery, command-and-control, lateral movement, and exfiltration.

Продвинутый 34 мин Сети
Этого урока пока нет на выбранном языке — показана версия на другом языке. Перевод готовится.
Только в разрешённой среде — Описанные здесь приёмы применяются только в учебных лабораториях и в системах, которые принадлежат вам или на которые есть письменное разрешение.

Цели обучения

  • Correlate IDS alerts with protocol statistics and conversation tables to prioritize PCAP triage
  • Trace attacker progression across DNS, HTTP, TLS, and SMB2 using Wireshark and tshark filters
  • Extract transferred payloads safely and verify whether exploitation or delivery succeeded
  • Reconstruct an evidence-backed intrusion timeline from raw packet captures

Рекомендуется заранее: Wireshark Deep Packet Inspection & Stream ReassemblySuspicious Network Traffic: Beaconing, Tunneling & ExfilIDS/IPS Architecture, Placement & Signature Logic

#Why this matters

Real intrusions rarely look like a single malicious packet. Attackers chain steps over minutes or hours: payload delivery over HTTP or email, outbound command-and-control (C2) beaconing over DNS or TLS, internal discovery and lateral movement over SMB or SSH, and data exfiltration.

An IDS such as Suricata raises alerts on individual signatures, giving you a starting point rather than the whole story. In a practical incident or raqamli-izquarlik capture challenge, you pivot from one alert across the capture, verify which actions succeeded, and build an evidence-backed timeline.

#Triage workflow: from alert to full timeline

Opening a large PCAP in Wireshark and scrolling from packet 1 wastes time and hides patterns. Run automated triage first to map protocols, top talkers, and signature hits before inspecting individual streams.

  1. InventorySuricata alerts and tshark statistics
  2. PivotIsolate suspicious IPs and time windows
  3. ReconstructFollow TCP streams and export objects
  4. ValidateConfirm delivery, lateral spread, and exfil

Run Suricata offline to generate alert logs (fast.log and eve.json), check the protocol hierarchy (io,phs), and print the TCP conversation table (conv,tcp).

Offline triage with Suricata and tshark on a lab capture
$ suricata -r lab-capture.pcapng -l ./logs
$ cat ./logs/fast.log
05/19/2026-10:14:22.418902  [**] [1:2024001:3] LAB Suspicious PowerShell Script Download [**] [Priority: 1] {TCP} 192.0.2.44:80 -> 10.10.10.25:49812
$ tshark -r lab-capture.pcapng -q -z conv,tcp | head -n 7
================================================================================
TCP Conversations
                                               |       <-      | |       ->      | |     Total     |    Relative    |   Duration   |
                                               | Frames  Bytes | | Frames  Bytes | | Frames  Bytes |      Start     |              |
10.10.10.25:49812    <-> 192.0.2.44:80              12     1420        18    24810        30    26230      112.3104        0.4218
10.10.10.25:49819    <-> 192.0.2.44:8443           142    18920       164   312400       306   331320      118.9021      480.1140
10.10.10.25:49844    <-> 10.10.10.40:445            89    14200       112   284500       201   298700      245.1092       12.6401

Three signals stand out immediately:

  • Alert anchor: 10.10.10.25 fetched a script from 192.0.2.44:80 at 112.31 seconds.
  • Long C2 flow: Six seconds later, 10.10.10.25 opened a 480-second session to 192.0.2.44:8443 with 312,400 outbound (->) bytes versus 18,920 inbound (<-).
  • East-west pivot: At 245.10 seconds, workstation 10.10.10.25 connected to internal server 10.10.10.40:445 (SMB) and transferred nearly 300 KB.

#Mapping multi-stage artifacts across protocols

Once triage identifies a suspect host (10.10.10.25), correlate events across protocols using frame.time_relative and tcp.stream.

Stage Protocols Key display-filter fields Compromised signal vs. noise
Delivery DNS, HTTP, SMTP dns.qry.name, http.request.uri, http.response.code 200 OK script download followed by outbound connections
C2 beaconing HTTP, TLS, DNS tls.handshake.extensions_server_name, http.user_agent Regular intervals, rare SNI, anomalous User-Agent
Lateral movement SMB2, Kerberos, SSH smb2.cmd, smb2.filename, tcp.dstport == 445 Workstation-to-workstation SMB or remote service creation
Exfiltration HTTP POST, DNS TXT, FTP http.request.method, http.content_length, dns.txt High outbound byte ratio right after internal file reads
Reconstructed multi-stage intrusion timeline in lab-capture.pcapngReconstructed multi-stage intrusion timeline in lab-capture.pcapng10.10.10.25192.0.2.4410.10.10.40HTTP GET /update/helper.ps1 (t=112.3s)200 OK (24 KB script, stream 4)TLS ClientHello to port 8443 (t=118.9s, stream 7)C2 session runs for 480sSMB2 Tree Connect and Read (t=245.1s, stream 19)Outbound data transfer over stream 7 (t=268.4s)

Timing links the stages together. An isolated SMB share read might be routine user activity; an SMB read two minutes after an unverified script download and twenty seconds before an outbound upload burst indicates staged exfiltration.

#Extracting payloads and verifying execution

An IDS alert on a URI does not prove delivery succeeded. A server may have returned 403 or 404, or the file may be benign tooling. Inspect the full stream and carve transferred files to confirm impact.

Use tshark -T fields to list DNS queries, HTTP requests, and TLS Server Name Indication (SNI) values chronologically, then follow the stream and export HTTP objects.

Pivoting on suspect host and carving HTTP objects
$ tshark -r lab-capture.pcapng -Y "ip.addr == 10.10.10.25 && (dns.flags.response == 0 || http.request || tls.handshake.type == 1)" -T fields -e frame.time_relative -e tcp.stream -e dns.qry.name -e http.host -e http.request.uri -e tls.handshake.extensions_server_name
112.1041        cdn-sync.example.test
112.3104   4    192.0.2.44   /update/helper.ps1
118.9021   7                 cdn-sync.example.test
$ tshark -r lab-capture.pcapng -q -z follow,tcp,ascii,4 | head -n 13
===================================================================
Follow: tcp,ascii
Filter: tcp.stream eq 4
Node 0: 10.10.10.25:49812
Node 1: 192.0.2.44:80
GET /update/helper.ps1 HTTP/1.1
Host: 192.0.2.44

HTTP/1.1 200 OK
Content-Length: 24102
# Lab marker: benign simulation payload
$ tshark -r lab-capture.pcapng --export-objects http,./extracted_http
$ sha256sum ./extracted_http/*
9b74c9897bac770ffc029102a200c5de9f1f1443c3d8d9102b8e4f9b7a2c1108  ./extracted_http/helper.ps1

Confirming HTTP/1.1 200 OK and inspecting helper.ps1 in a sandbox proves payload delivery. Even when C2 on port 8443 uses TLS, correlating the DNS query (cdn-sync.example.test), TLS SNI, and byte asymmetry reveals the surrounding activity.

#Defending and common mistakes

Analysts often miss multi-stage intrusions when they skip verification or rely on a single view:

  • Stopping at the first alert: One Suricata signature often marks the middle of an intrusion. Always inspect traffic several minutes before and after the alert timestamp.
  • Ignoring HTTP status codes: A GET request for a malicious path does not prove compromise if the server answered 403 or 404 or reset the connection.
  • Assuming TLS blinds all analysis: Without decryption keys, DNS queries, TLS SNI extensions, certificate subjects, JA3/JA4 hashes, and flow cadence still expose C2 and exfiltration bursts.
  • Relying only on perimeter taps: Gateway captures miss east-west movement (10.10.10.25 to 10.10.10.40). Deploy internal VLAN sensors or pair PCAPs with host telemetry.
  • Mishandling carved objects: Exporting files writes untrusted payloads to disk; keep analysis inside a non-privileged sandbox VM.

#Summary

  • Start PCAP triage with offline Suricata alerts and tshark summary tables (io,phs, conv,tcp) instead of reading packets sequentially.
  • Correlate timestamps across DNS, HTTP delivery (200 OK), TLS/HTTP C2, east-west lateral movement (445/tcp, 22/tcp), and asymmetric outbound transfers.
  • Verify impact by following TCP streams, exporting HTTP objects, and checking status codes and hashes in an isolated environment.
  • Anchor every finding to concrete packet evidence such as tcp.stream IDs, SNI hostnames, and SHA-256 digests.

Проверка знаний

Войдите, чтобы проходить тест, завершать уроки и сохранять прогресс. Войти в систему

Практика: проверьте свои знания