Docsity

Traffic Analysis: Understanding Network Protocols and Packet Dissection - Prof. Gerald A. , Study notes of Cryptography and System Security

Partial preview of the text

Download Traffic Analysis: Understanding Network Protocols and Packet Dissection - Prof. Gerald A. and more Study notes Cryptography and System Security in PDF only on Docsity!

Traffic Analysis

Traffic Analysis

Dr. G. A. Marin

Traffic Analysis

Packet Dissection with TCPDUMP ˆ

TCPDUMP gives most information andEthereal also but sometimes you want tolook at the Hex data directly.^ 

Example in Chapter 7 (sidestep program) ˆ

Basics:^ 

Need right formats: IP, TCP, ICMP, etc.  Use tcpdump –x to obtain Hex (or Ethereal)  Ethernet header usually appears as first 14bytes in Ethereal Output.  Ethernet header must be requested fromtcpdump with –e flag.

Traffic Analysis

NIDS Insertion Attack ˆ^

Idea: Insert an extra packet (NIDS receives buttarget does not) to confuse pattern-matchingalgorithms on the IDS.^ 

Do it in such a way that the target host won’t see theextra packet(s). ˆ^

Good example in text: Suppose hacker hasestablished a backdoor account (REWT) on targetmachine. IDS system knows to look for attemptedlog-in to REWT on port 23 (telnet). ˆ^

But hacker sends “R” in correctly formattedpacket followed by “O” with invalid TCP checksum.This accepted by IDS and not by target host.Hacker then follows with “EWT” which IDS doesnot detect because “ROEWT” is ok. But host seesa connectiont to “REWT.”

Traffic Analysis

NIDS Evasion Attack ˆ

Same idea but insert an extra packet thattarget host sees but NIDS does not.

For example, it is possible to include datain the opening SYN packet. Nids might notbe programmed to accept it.

Destination

host does.

In this case send “R” in SYN and “EWT” infirst data packet.

Traffic Analysis

Protocol Number ˆ

List available at^ www.iana.org/assignments/protocol-^ numbers

Later we will cover use of nmap –sO option.

Note that nmap assumes protocol islistening if it does not receive an ICMPprotocol unreachable.^ 

Firewall may block this.

Traffic Analysis

DF Flag ˆ^

We’ve covered the function. ˆ^

You may see particular TCP/IP stacks sending“discovery” frames with DF flag set (to newdestination) to try to determine MTU along path. ˆ^

Some stacks set DF on particular packets andnmap uses this as a technique for identifyingoperating systems. ˆ^

If packet arrives at a NIDS from a network with alarger MTU, then DF flag may prevent NIDS fromforwarding to target host. This technique can beused for an insertion attack.

Traffic Analysis

IP Address Considerations ˆ^

An internal address entering your network from anexternal interface is probably spoofed. (Firewallshould block.) ˆ^

Should not see packets with private addressesarriving from outside the network: ˆ^

The Internet Assigned Numbers Authority (IANA) hasreserved the following three blocks of the IP addressspace for private internets: 10.0.0.0 - 10.255.255.255(10/8 prefix) 172.16.0.0 - 172.31.255.255 (172.16/12prefix) 192.168.0.0 - 192.168.255.255 (192.168/16prefix) We will refer to the first block as "24-bit block",the second as "20-bit block", and to the third as "16-bit" block. Note that (in pre-CIDR notation) the firstblock is nothing but a single class A network number,while the second block is a set of 16 contiguous classB network numbers, and third block is a set of 256contiguous class C network numbers.

Traffic Analysis

IP ID Number ˆ

New number is generated for eachdatagram sent.^ 

Usually incremented by 1 but may be 254  Should wrap at 65, ˆ

If one observes packets from seeminglyunrelated sources that are following astandard increment procedure across thedifferent sources, this may be a sign ofspoofing.

A string of packets with identical ID alsosuggests an attack.

Traffic Analysis

Embedded Protocol Headers - TCP ˆ

Ports^ 

Two 16-bit fields ranging 1-65, ˆ

In a scan the source port may incrementregularly (like by 1).

Destination port may

be randomized (irregular).^ 

If see many SYNs with constant source port,this is also likely to be a scan (nmap). ˆ

Note that scans to port 0 are immediatelysuspicious and likely to be looking forresets to determine if host alive at @.

Traffic Analysis

TCP and UDP Checksums ˆ

Computed including the pseudo-header, tcp(or UDP) header plus data.^ 

Note pseudo-header in Figure 9.1.^ • Source and destination IP @^ • 1 byte zero pad^ • 1 byte protocol field^ • 2 bytes TCP length (TCP header plus data)  Uses same 1-s complement arithmetic as IPheader on 16-bit fields and includes pseudoheader.^ • May catch an IP destination address corruption that

occurs within a router.

Traffic Analysis

Acknowledgement numbers ˆ

Have covered the function.

Value of zero (with flag set) is extremelyunlikely.^ 

Ack flag set and zero number may imply annmap scan. ˆ

Ack flag set may generate a reset fromthe host (indicating host is alive).^ 

Gets past router filtering because it looks liketraffic from ongoing TCP connection.

Traffic Analysis

TCP Flags ˆ^ We’ve covered the function. ˆ^ Various “mutant” combinations are used forfingerprinting operating systems. ˆ^ Packets sometimes get corrupted so an out-of-spec packet does not NECESSARILYimply an attack.

^

Vern Paxson labels as crud the “innocuousimplementation errors” that create trafficpattern pathologies similar to genuine attacks.

Traffic Analysis

TCP congestion control:

ˆ^

two “phases”^ 

slow start (exponentialincrease)  congestion avoidance(linear increase)

-^ On timeout, thresholdset to half congwin andcongwin set to 1 MSS.

ˆ^

important variables:^ ^

Congwin ^

threshold:

defines

threshold between twoslow start phases.

ˆ^

“probing” for usablebandwidth:^ 

ideally: transmit as fastas possible (

Congwin

as

large as possible)without loss 

increase

Congwin

until

loss (congestion) ^

loss:

decrease

Congwin

,

then begin probing(increasing) again

Traffic Analysis

TCP Slowstart^ ˆ^

exponential increase (perRTT) in window size (not soslow!) ˆ^ initialize: Congwin = 1for (each segment ACKed)loss event: timeout (TahoeTCP) and/or or threeduplicate ACKs (Reno TCP)

Congwin++ until (loss event OR

CongWin > threshold) Slowstart algorithm

Host A

one segment

RTT

Host B

time

two segmentsfour segments