Zum Inhalt springen
Skillpedia
Sicherheit35k · #7823

detecting-dnp3-protocol-anomalies

Was er macht

Dieser KI-Agent überwacht die Kommunikation von SCADA-Systemen über das DNP3-Protokoll. Er sucht nach verdächtigen Aktivitäten wie unautorisierten Befehlen, Versuchen, Firmware-Updates einzuspielen, oder Abweichungen vom normalen Datenverkehr, um industrielle Netzwerke abzusichern.

Wann du ihn nutzt

  • ✓Wenn du Energiesysteme überwachst, die DNP3 verwenden.
  • ✓Wenn du verdächtige Befehle untersuchst, die über DNP3 gesendet wurden.
  • ✓Wenn du Intrusion-Detection-Systeme für industrielle Netzwerke aufbaust.

Link zum Skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-dnp3-protocol-anomalies/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-dnp3-protocol-anomalies/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Prüfe den DNP3-Datenverkehr auf unautorisierte Steuerbefehle.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Er analysiert DNP3-Datenpakete auf ungewöhnliche oder verbotene Muster. Dafür nutzt er maschinelles Lernen, um den aktuellen Datenverkehr mit einer Aufzeichnung dessen zu vergleichen, was als normal gilt.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

Detecting DNP3 Protocol Anomalies

When to Use

  • When monitoring SCADA systems in the energy sector where DNP3 is the primary protocol
  • When building detection rules for DNP3-based attacks against RTUs and substations
  • When investigating suspected unauthorized control commands sent via DNP3
  • When deploying IDS with DNP3 deep packet inspection at utility substations
  • When responding to alerts from OT monitoring platforms about DNP3 traffic anomalies

Do not use for non-DNP3 protocol monitoring (see detecting-modbus-command-injection-attacks for Modbus), for DNP3 Secure Authentication configuration (separate implementation), or for protocol-agnostic network anomaly detection.

Prerequisites

  • Network TAP/SPAN on DNP3 communication segments (TCP port 20000 or serial)
  • Baseline of normal DNP3 traffic patterns (masters, outstations, poll intervals, function codes)
  • Suricata or Zeek with DNP3 protocol parser enabled
  • Understanding of DNP3 function codes and object groups used in the environment
  • DNP3 communication topology map (master-to-outstation relationships)

Workflow

Step 1: Analyze DNP3 Traffic for Anomalies

#!/usr/bin/env python3
"""DNP3 Protocol Anomaly Detector.

Monitors DNP3 communications for unauthorized control commands,
protocol violations, and deviations from established baselines.
Supports both TCP and serial DNP3 deployments.
"""

import struct
import sys
import json
from collections import defaultdict
from datetime import datetime
from typing import Dict, List, Optional, Set

try:
    from scapy.all import rdpcap, IP, TCP
except ImportError:
    print("Install scapy: pip install scapy")
    sys.exit(1)


# DNP3 Function Codes
DNP3_FUNCTIONS = {
    0x00: "Confirm", 0x01: "Read", 0x02: "Write",
    0x03: "Select", 0x04: "Operate", 0x05: "Direct Operate",
    0x06: "Direct Operate No Ack", 0x07: "Immediate Freeze",
    0x08: "Immediate Freeze No Ack", 0x09: "Freeze and Clear",
    0x0A: "Freeze and Clear No Ack", 0x0B: "Freeze at Time",
    0x0C: "Freeze at Time No Ack", 0x0D: "Cold Restart",
    0x0E: "Warm Restart", 0x0F: "Initialize Data",
    0x10: "Initialize Application", 0x11: "Start Application",
    0x12: "Stop Application", 0x13: "Save Configuration",
    0x14: "Enable Unsolicited", 0x15: "Disable Unsolicited",
    0x16: "Assign Class", 0x17: "Delay Measurement",
    0x18: "Record Current Time", 0x19: "Open File",
    0x1A: "Close File", 0x1B: "Delete File",
    0x1C: "Get File Info", 0x1D: "Authenticate File",
    0x1E: "Abort File", 0x81: "Response", 0x82: "Unsolicited Response",
}

# High-risk function codes that should trigger alerts
DNP3_CRITICAL_FUNCTIONS = {
    0x02,  # Write
    0x03, 0x04, 0x05, 0x06,  # Select/Operate/Direct Operate
    0x0D,  # Cold Restart
    0x0E,  # Warm Restart
    0x0F,  # Initialize Data
    0x10,  # Initialize Application
    0x12,  # Stop Application
    0x19, 0x1A, 0x1B,  # File operations (firmware update)
}


class DNP3AnomalyDetector:
    """Detects anomalies in DNP3 protocol communications."""

    def __init__(self, baseline_file: Optional[str] = None):
        self.alerts = []
        self.sessions = defaultdict(lambda: {
            "packet_count": 0,
            "function_codes": defaultdict(int),
            "control_commands": 0,
            "file_operations": 0,
            "restarts": 0,
        })
        self.packet_count = 0
        self.dnp3_count = 0

        self.authorized_masters: Set[str] = set()
        self.authorized_pairs: Dict[str, Set[str]] = defaultdict(set)
        self.baseline_functions: Dict[str, Set[int]] = defaultdict(set)

        if baseline_file:
            self.load_baseline(baseline_file)

    def load_baseline(self, filepath: str):
        """Load DNP3 communication baseline."""
        with open(filepath, "r") as f:
            baseline = json.load(f)

        for entry in baseline.get("authorized_communications", []):
            master = entry["master_ip"]
            outstation = entry["outstation_ip"]
            self.authorized_masters.add(master)
            self.authorized_pairs[master].add(outstation)
            self.baseline_functions[f"{master}->{outstation}"] = set(
                entry.get("expected_function_codes", [0x00, 0x01])
            )

    def parse_dnp3_header(self, payload: bytes) -> Optional[dict]:
        """Parse DNP3 data link layer and transport/application headers."""
        if len(payload) < 10:
            return None


…
Häufige Fragen

Was ist DNP3?

DNP3 ist ein Regelwerk (Protokoll), das Geräte in industriellen Steuerungssystemen verwenden, etwa in Energienetzen.

Was sind Anomalien?

Anomalien sind Abweichungen von normalem oder erwartetem Verhalten. In diesem Fall sind es ungewöhnliche Aktivitäten im DNP3-Datenverkehr.

Was sind SCADA-Systeme?

SCADA steht für Supervisory Control and Data Acquisition. Das sind Systeme, mit denen industrielle Prozesse aus der Ferne überwacht und gesteuert werden.

Details

Originalbeschreibung des Autors

Detect anomalies in DNP3 communications used in SCADA/ICS systems by monitoring unauthorized control commands, firmware update attempts, protocol violations, and deviations from baseline traffic using deep packet inspection and machine learning approaches. Use when securing energy-sector or other OT/ICS networks, investigating suspicious DNP3 master/outstation activity, or building an anomaly-base

repo: mukul975/Anthropic-Cybersecurity-Skills

Beliebtheit

GitHub-Sterne
35k
Platz im Ranking
#7823
Lizenz
Apache-2.0
Aktualisiert
31.8.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills