Skip to content
Pwnversity
DEF-REDintermediate · 11 min · upd. 2026-11

Network hardening

T1021T1557.001Suricata

Network hardening decides where an attacker can move once inside and what they can reach from outside. Its central idea is segmentation: compromising one machine shouldn’t give access to the whole network. It’s the direct countermeasure to lateral movement, name poisoning (LLMNR/NBT-NS) and command and control: if the compromised laptop can’t talk SMB to the servers or reach the Internet except through the proxy, the intrusion stays small.

  • Containment: a flat network turns one compromised machine into access to everything; a segmented one turns it into an incident inside one zone.
  • Cutting egress: C2 and exfiltration need to get out. Filtering outbound traffic matters as much as inbound.
  • Reducing exposure: edge devices (VPNs, firewalls, gateways) are the most common way in. In 2025, vulnerability exploitation was the top initial access vector for the sixth year in a row (M-Trends 2026).
flowchart LR
    I["Internet"] -->|"443"| DMZ["DMZ<br/>web, mail,<br/>reverse proxy"]
    DMZ -->|"specific ports"| APP["Application zone"]
    U["Users<br/>802.1X"] -->|"web, applications"| APP
    U -.-x|"SMB, RDP, WinRM"| U
    ADM["Administration<br/>bastions"] -->|"RDP, SSH,<br/>WinRM"| APP
    ADM --> DC["Domain<br/>controllers"]
    APP --> DC
    APP -->|"proxy only"| P["Egress proxy"]
    P --> I
    APP -.-x|"direct"| I
    SENS["Sensors<br/>IDS, NDR"] --> SIEM[("SIEM")]
  • North-south: what enters and leaves the organization. Only what’s published lives in the DMZ.
  • East-west: what moves inside. That’s where lateral movement happens, and where flat networks fail.
  • Separate management plane: RDP, SSH and WinRM to servers only from dedicated bastions, never from each administrator’s laptop.
  • User to user: workstations almost never need to talk to each other over SMB or RDP. Blocking it cuts much of the lateral movement of worms and ransomware.

Zero Trust (NIST SP 800-207 and CISA’s maturity model) takes the idea further: no access is granted for being “inside”; each one is decided by identity, device state and context (IAM). Segmentation is still needed: Zero Trust makes it finer-grained (per-workload microsegmentation), it doesn’t replace it.

An nftables example for a web server in the DMZ: only what’s published and administration from the bastions comes in, and only what’s essential goes out.

#!/usr/sbin/nft -f
flush ruleset
table inet filtro {
set admin_v4 { type ipv4_addr; elements = { 10.10.0.10, 10.10.0.11 } } # bastions
chain input {
type filter hook input priority filter; policy drop;
ct state established,related accept
ct state invalid drop
iif "lo" accept
tcp dport { 80, 443 } accept
ip saddr @admin_v4 tcp dport 22 accept
icmp type echo-request limit rate 5/second accept
log prefix "nft-in-drop " level info
}
chain output {
type filter hook output priority filter; policy drop;
ct state established,related accept
oif "lo" accept
ip daddr 10.10.0.53 udp dport 53 accept # internal DNS only
ip daddr 10.10.0.53 tcp dport 53 accept
ip daddr 10.10.0.123 udp dport 123 accept # internal NTP
ip daddr 10.10.0.80 tcp dport 3128 accept # proxy (updates)
log prefix "nft-out-drop " level info
}
chain forward {
type filter hook forward priority filter; policy drop;
}
}
Ventana de terminal
nft -c -f ruleset.nft && echo "syntax OK, not applied"

General rules:

  • Every rule has an owner, a reason and a review date; any-any rules and rules with no traffic for months get retired.
  • Logging what’s denied outbound is a valuable detection source: a server trying to reach the Internet on an odd port is almost always a problem.
  • Direct DNS to external resolvers is blocked: everything goes through internal DNS, which filters malicious domains (Protective DNS) and gets logged.

Legacy protocols: detecting them on the wire

Section titled “Legacy protocols: detecting them on the wire”

Before disabling LLMNR, NBT-NS, SMBv1 or Telnet, you need to know who still uses them. An IDS like Suricata shows it without touching the machines. Custom policy rules:

alert udp $HOME_NET any -> 224.0.0.252 5355 (msg:"PWN LLMNR on the network (legacy, poisonable)"; sid:1000001; rev:1; classtype:policy-violation;)
alert udp $HOME_NET any -> any 137 (msg:"PWN NBNS (NetBIOS Name Service) on the network"; sid:1000002; rev:1; classtype:policy-violation;)
alert smb any any -> any any (msg:"PWN SMBv1 negotiated"; flow:established,to_server; content:"|ff|SMB"; offset:4; depth:4; sid:1000003; rev:1; classtype:policy-violation;)
alert tcp any any -> $HOME_NET 23 (msg:"PWN Telnet into the internal network"; flow:to_server; flags:S; sid:1000004; rev:1; classtype:policy-violation;)
alert dns $HOME_NET any -> !$DNS_SERVERS any (msg:"PWN DNS to an unauthorized resolver"; sid:1000005; rev:1; classtype:policy-violation;)

Tested with Suricata 7.0.3 in read mode on a lab capture generated with Scapy (an LLMNR query, an NBNS query, an SMBv1 negotiation, a Telnet attempt and a DNS query to 8.8.8.8). The output below comes from the run with the Spanish rule messages; the rules are otherwise identical:

Ventana de terminal
suricata -S pwn.rules -r lab.pcap -l out -k none \
--set vars.address-groups.HOME_NET="[10.0.0.0/8]" \
--set vars.address-groups.DNS_SERVERS="[10.10.0.53]"
[1:1000001:1] PWN LLMNR en la red (protocolo heredado, envenenable) {UDP} 10.20.0.50:50001 -> 224.0.0.252:5355
[1:1000002:1] PWN NBNS (NetBIOS Name Service) en la red {UDP} 10.20.0.50:137 -> 10.20.0.255:137
[1:1000004:1] PWN Telnet hacia la red interna {TCP} 10.30.0.8:40000 -> 10.10.0.20:23
[1:1000005:1] PWN DNS a resolvedor no autorizado {UDP} 10.10.0.20:53000 -> 8.8.8.8:53
[1:1000003:1] PWN SMBv1 negociado {TCP} 10.20.0.50:49152 -> 10.10.0.20:445

The eve.json log adds protocol context ("command": "SMB1_COMMAND_NEGOTIATE_PROTOCOL" for SMBv1; the queried name for DNS). With a few weeks of data you know which machines need fixing before disabling the protocol via GPO, without breaking things blindly.

  • The first version of the Telnet rule lacked flow:to_server, and Suricata warned when loading it: rule 1000004: SYN-only to port(s) 23:23 w/o direction specified. Reading load warnings is part of testing a rule.
  • In production, these policy rules are combined with a maintained ruleset (ET Open, for example) and an NDR that detects behavior (beaconing, internal scans, anomalous volumes). Captures and metadata later feed forensics (network DFIR).
  • 802.1X (NAC): the port or Wi-Fi only grants access after authenticating the device (certificate); unknown devices go to a guest or quarantine VLAN.
  • Wi-Fi: WPA3-Enterprise or WPA2-Enterprise with EAP-TLS; no shared keys on the corporate network.
  • Switch ports: unused ones disabled; protection against rogue ARP and DHCP (Dynamic ARP Inspection, DHCP snooping) on switches that support it.
  • No RDP or SSH exposed to the Internet: VPN with phishing-resistant MFA, or ZTNA, which publishes specific applications instead of granting network access.
  • Edge devices are the preferred target: patches in days, not weeks (patch management); their management interface never reachable from the Internet; and their logs sent to the SIEM, since many can’t run an EDR.
  • Continuous external inventory: what’s visible from the Internet (services, certificates, versions) compared with what should be.
  • Anomalous east-west: a user workstation connecting over SMB, WinRM or RDP to many machines in a short time.
  • Denied egress: blocked attempts from servers to the Internet.
  • Beaconing: periodic connections to rare destinations (covered by NDR or a model-assisted hunt, see threat hunting).
  • Legacy protocols reappearing after being disabled.
  • All of it centralized in the SIEM: firewall, proxy, DNS and NetFlow logs plus IDS alerts.
  • Segmenting without mapping legitimate flows first, then “temporarily” opening any-any when something breaks.
  • Filtering inbound only.
  • Allowing direct DNS to the Internet from any machine.
  • Administering servers from administrators’ laptops.
  • Exposing the VPN’s or firewall’s management interface to the Internet.
  • NotPetya (2017): it spread in minutes across flat networks using SMB (EternalBlue, MS17-010) and stolen credentials. At Maersk it hit thousands of workstations and servers; segmentation between zones and blocking SMB between workstations would have drastically reduced the spread.
  • Legitimate flows mapped before segmenting
  • Zones with explicit east-west policy; no SMB/RDP/WinRM between user workstations
  • Default deny inbound and outbound; egress only via proxy and internal DNS
  • Agent destinations (EDR, SIEM, management) included in the egress policy
  • Separate management plane with bastions
  • LLMNR, NBT-NS, SMBv1 and Telnet measured with an IDS, then disabled
  • 802.1X on wired and corporate Wi-Fi
  • No exposed RDP/SSH; remote access with phishing-resistant MFA or ZTNA
  • Firewall, DNS, proxy and IDS logs in the SIEM