# LEAF-PROTO local rules. Only rules with `metadata: leaf_action block;` are # acted on by leaf-controller (override via config policy). SIDs reserved: 1000000-1099999. # # Inbound flows (attacker->victim): default policy blocks nothing (dest is your LAN). # Outbound flows (victim->external C2 / exfil / scan-out): dest_ip gets blocked on VyOS. # Suricata 7: HOME_NET/EXTERNAL_NET are defined in suricata-leaf.yaml # (vars: address-groups). 'var' statements in rule files are not supported. # --- lab test rule: any outbound ICMP to TEST-NET (trigger demo) --- alert icmp any any -> 192.0.2.0/24 any (msg:"LEAF TEST ICMP to TEST-NET"; sid:1000001; rev:1; metadata: leaf_action block;) # --- outbound scan: many TCP SYNs from one host to many hosts in 10s --- alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"LEAF SCAN-OUT tcp syn flood"; flags:S; threshold: type threshold, track by_src, count 25, seconds 10; sid:1000002; rev:1; metadata: leaf_action block;) # NOTE: the threshold is engine-side noisy for lab use; controller also windows by (sid,dest) # --- obvious C2 patterns (examples; extend with your own) --- alert tcp any any -> any any (msg:"LEAF possible meterpreter reverse"; flow:to_server; content:"|0a 16 1a 05|"; depth:4; sid:1000010; rev:1; metadata: leaf_action block;) # --- DNS tunneling heuristic: prefer et open ruleset + thresholding for this --- # --- inbound (src-side block candidates; block_src must be enabled in controller) --- # SYN+FIN is an abnormal flag combination, not an SSH authentication failure. # Encrypted SSH login failures cannot be inferred from TCP flags. alert tcp $EXTERNAL_NET any -> $HOME_NET 22 (msg:"LEAF abnormal SYN FIN inbound"; flow:to_server; flags:SF; threshold: type threshold, track by_src, count 20, seconds 30; sid:1000020; rev:1; metadata: leaf_action block_src;) # --- lateral/brute observable on the VEX-mirror posture: SYN-only toward sensor --- alert tcp 172.19.32.0/24 any -> 10.0.249.1 22 (msg:"LEAF LATERAL-BRUTE ssh sweep from VEX-LAN at sensor"; flags:S; threshold: type threshold, track by_src, count 15, seconds 30; sid:1000021; rev:1; metadata: leaf_action block_src;) # SRC-MODE drill: mirror-visible transit wave with out-of-floor spoofed src. # dst 192.0.2.x is transit-only dst reachable through the mirror (locally-dst # traffic toward 10.0.249.1 never appears on the mirror, so 1000020/1000021 cannot # fire there). Spoofed src is 203.0.113.0/24 (RFC5737) -> never a real peer. alert tcp 203.0.113.0/24 any -> 192.0.2.0/24 22 (msg:"LEAF SRC-MODE spoofed-src at TEST-NET dst"; flags:S; threshold: type threshold, track by_src, count 12, seconds 30; sid:1000030; rev:1; metadata: leaf_action block_src;)