Figure 1: ICMP port unreachable |
ICMP unreachable messages provide a clear indication of configuration errors and should be rare in a well configured network. Typically, the ICMP unreachable messages that are seen result from scanning and network reconnaissance:
- Scanning a host for open ports will generate ICMP port / protocol unreachable messages
- Scanning for hosts will generate ICMP host / network unreachable messages
The challenge in monitoring ICMP messages is that there is no single location that can see all the messages - they take a direct path between sender and receiver. Installing monitoring agents on all the hosts poses practical challenges in a heterogeneous environment, and agent based monitoring may be circumvented since trojans often disable security monitoring software when they infect a host.
Support for the sFlow standard in switches provides an independent method of profiling host behavior. The sFlow standard is widely supported by switch vendors and has the scaleability to deliver real-time, network wide, monitoring of host traffic. The switches export packet headers, allowing the central monitoring software to perform deep packet inspection and extract details from the ICMP protocol.
DNS amplification attacks describes how the sFlow-RT analyzer can be used to monitor DNS activity. The SMURF attack uses spoofed ICMP messages as a method of DDoS amplification and similar techniques to those described in the DNS article can be used to detect and mitigate these attacks.
The following example illustrates how sFlow can be used to monitor ICMP unreachable activity; a single instance of sFlow-RT is monitoring 7500 switch ports in a data center network.
The following ICMP attributes are extracted from packet samples and can be used in flow definitions or as filters:
Description | Name | Example |
---|---|---|
Message type, e.g. Destination Unreachable (3) | icmptype | 3 |
Message code, e.g. Protocol Unreachable (2) | icmpcode | 2 |
IP address in network unreachable response | icmpunreachablenet | 10.0.0.1 |
Host in host unreachable response | icmpunreachablehost | 10.0.0.1 |
Protocol in protocol unreachable response | icmpunreachableprotocol | 41 |
Port in port unreachable response | icmpunreachableport | udp_30000 |
The following flow definitions were created using sFlow-RT's embedded scripting API:
setFlow('unets',{keys:'icmpunreachablenet',value:'frames',t:20}); setFlow('uhosts',{keys:'icmpunreachablehost',value:'frames',t:20}); setFlow('uprotos',{keys:'icmpunreachableprotocol',value:'frames',t:20}); setFlow('uports',{keys:'icmpunreachableport',value:'frames',t:20});Alternatively, the flow definitions can be specified by making calls to the REST API using cURL:
curl -H "Content-Type:application/json" -X PUT --data "{keys:'icmpunreachableport', value:'frames', t:20}" http://localhost:8008/flow/uports/jsonUsing the script API has a number of advantages: it ensures that flow definitions are automatically reinstated on a system restart, makes it easy to generate trend charts (for example the graphite() function sends metrics to Graphite for integration in performance dashboards) and to automate the response when ICMP anomalies are detected (for example, using the syslog() function to send an alert or http() to access a REST API on a device or SDN controller to block the traffic).
The table above (http://localhost:8008/activeflows/ALL/uports/html?maxFlows=20&aggMode=sum) shows a continuously updating, real-time, view of the top ICMP unreachable ports - a bit like the Linux top command, but applied to the active flows. The table shows that the most frequently reported unreachable port is UDP port 30000.
There are a number of more detailed flow definitions that can be created:
- To identify hosts generating scan packets, include ipdestination in the flow definition
- To identify targets of Smurf attacks, include ipdestination and filter to exclude local addresses
- To identify target country, include destinationcountry and filter to exclude local addresses
Figure 2: Performance aware software defined networking |
setFlowHandler(function(rec) { var name = rec.name; var keys = rec.flowKeys.split(','); var msg = {type:name,host:keys[0],target:keys[1]}; syslog('10.0.0.1',null,null,null,msg); },['unets','uhosts','uprotos','uports']); setFlow('unets',{keys:'ipdestination,icmpunreachablenet', value:'frames', t:20, log:true, flowStart:true}); setFlow('uhosts',{keys:'ipdestination,icmpunreachablehost', value:'frames', t:20, log:true, flowStart:true}); setFlow('uprotos',{keys:'ipdestination,icmpunreachableprotocol', value:'frames', t:20, log:true, flowStart:true}); setFlow('uports',{keys:'ipdestination,icmpunreachableport', value:'frames', t:20, log:true, flowStart:true});While this example focused on a data center hosting servers, a similar approach could be used to monitor campus networks, detecting hosts that are scanning or participating in DDoS attacks. In this case, the SDN controller would respond by isolating the compromised hosts from the rest of the network.
No comments:
Post a Comment