CHAPTER 5 EXPERIMENTS AND OBSERVATIONS
5.2 E XPERIMENT RESULTS
On Snort
The command used in the experiments on Snort is “snort –c <snort.conf> ‐r
<xxx.pcap> ‐A full” where “snort.conf” is the configuration file of Snort and “xxx.pcap”
the packet trace. Table 3 summarizes the configuration of Snort.
14
Table 3 Configuration of Snort‐2.9.0.5
Function Status
Decoder Enabled
Base detection engine Enabled Dynamic loaded library Enabled
Preprocessor Enabled
Output modules Only “log_tcpdump” enabled Customized rule set Snortrules‐2903
Code coverage and richness increases when packet number increases, but not each of diversity indices increases.
In Fig. 4(a), code coverage C that packet traces of packet source 1 can achieve ranges from 19.1% to 32.2% as the number of packets increases from 1 to 10000000.
Diversity indices also increase except the source IP diversity index
D
s_IP and mixed diversity indexD
mix when the number of packets reaches 5000000. In Fig. 4(b), richness of each header that packet traces of packet source 1 can achieve increases as the number of packets increases. The reason is that Simpson’s index considers both richness and evenness. A burst of network traffic from the same source IP leads to the decrease of evenness, which can cause the decrease of diversity indices. We also notice that when the number of packets exceeds 1000000, code coverage increases slowly. It means that the packet source 1 triggers most part of source code as it can when the packet number exceeds 1000000.In Fig. 4(c), code coverage C that packet traces of packet source 2 can achieve ranges from 19.4% to 31.8% as the number of packets increases from 1 to 10000000.
All diversity indices increase as the number of packets increases. In Fig. 4(d), richness of each header that packet traces of packet source 2 can achieve increases as the number of packets increases. With comparing to packet source 1, packet source 2 can achieve larger code coverage and its evenness is better than packet source 1.
15
Code coverage increases when network segment size becomes larger, but not each of diversity indices increases.
In Fig. 6(a), code coverage C that packet source 1 can achieve increases from 28.2% to 32.2% when the size of network segments becomes larger. A larger size of network segments contains more hosts, implying more richness in IP diversity.
In Fig. 6(b), code coverage C that packet source 2 can achieve increases from 27.5% to 31.8% when the size of network segments becomes larger. However, source IP diversity index
D
s_IP decreases in network segment 140.113.249.0/24, which means that traffic bursts occurred in 140.113.249.0/24.pcap which resulted in worse1 10 100 1000 10000 100000 1000000 5000000 10000000
Code coverage
16
1 10 100 1000 10000 100000 1000000 5000000 10000000
Code coverage
1 10 100 1000 10000 100000 1000000 5000000 10000000
Code coverage
17
Fig. 4(d) Richness vs. code coverage for packet source 2 with different number of
packets
The mixed diversity index D
mixhas highest correlation to code coverage
We calculate the correlation coefficient between code coverage and diversity indices on Snort to find which index has highest correlation to code coverage. In Fig.5, we can observe that the mixed diversity index Dmix which means the probability that randomly select two packets from a packet trace, the source IP, destination IP, source port and destination port are all different has highest correlation coefficient to code coverage comparing to other diversity indices both in packet source 1 and 2.
0.00%
1 10 100 1000 10000 100000 1000000 5000000 10000000
Code coverage
18
Ds_IP Dd_IP Ds_port Dd_port Dmix
correlation
19
In Snort, source code in the directory “HttpInspect” is used to decode user applications. Given a data buffer, HttpInspect will decode the buffer, find HTTP fields, and normalize the fields. Thus, the part of Snort source code should be greatly influenced by different packet traces. The percentage of branches of the directory
“HttpInspect” to all source code is only 7%.
From Fig. 7(a), we can observe that code coverage of “HttpInspect” that packet source 1 can achieve ranges from 2.1% to 52.6%, while the code coverage of all source code from 19.2% to 32.2%.
From Fig. 7(b), we can observe that code coverage of “HttpInspect” that packet source 2 can achieve ranges from 2.1% to 53.5%, while the code coverage of all source code from 19.4% to 31.8%. Thus, packet source 2 can achieve larger code coverage when packet number reaches 10000000. We can obtain more precise
25.00%
20
1 10 100 1000 10000 100000 1000000 5000000 10000000
Code coverage
1 10 100 1000 10000 100000 1000000 5000000 10000000
Code coverage
21
Code coverage increases when network segment size becomes larger in the view of variable header fielder.
We can observe variable length header fields as well. The field “http.host” in HTTP header is selected. Packet traces used here are pure HTTP traffic, which are retrieved from those packet traces used in previous experiments.
In Fig. 8(a), code coverage that packet source 1 can achieve increases from 24.1% to 26.9% when the size of network segments becomes larger. However, evenness makes the diversity index decreasing at 140.113.249.0/26. However, it is clear that richness is increasing when the size of network segments becomes larger.
In Fig. 8(b), code coverage that packet source 2 can achieve increases from 22.7% to 26.8% when the size of network segments becomes larger. However, evenness makes the diversity index decreasing from 140.113.249.0/28 to 140.113.0.0/16.
22
Linux kernel‐2.6.35 was instrumented by Gcov with kernel patch and recompiled.
We only observed source code under directory “/net” since the whole Linux kernel is too large and the directory /net is directly related to network traffic.
Code coverage increases when packet number increases, but not each of diversity indices increases.
Code coverage of the experiments on Linux kernel is not as that large as in Snort.
In Fig. 9(a), code coverage that packet source 1 can achieve increases from 6.07% to 8.16% when the number of packets ranges from 1 to 10000000, and so do the diversity indices. It means that evenness is achieved since diversity indices are increasing (as least not decreasing) when the number of packets increases. In Fig.
9(b), code coverage that packet source 2 can achieve increases from 5.81% to 9.47%
when the number of packets ranges from 1 to 10000000, and so do the diversity
22.00%
23
24
The mixed diversity index D
mixhas highest correlation to code coverage
We calculate the correlation coefficient between code coverage and diversity indices on Linux kernel to find which index has highest correlation to code coverage.In Fig. 10, we can observe that the mixed diversity index Dmix which means the probability that randomly select two packets from a packet trace, the source IP, destination IP, source port and destination port are all different has highest correlation coefficient to code coverage comparing to other diversity indices both in packet source 1 and 2.
Fig. 10 Correlation coefficient between code coverage and diversity indices on Linux
kernel
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Ds_IP Dd_IP Ds_port Dd_port Dmix
correlation coefficient
Correlation coefficient between code coverage and diversity indices
packet source 1 packet source 2
25
Code coverage increases when network segment size becomes larger, but not each of diversity indices increases.
In Fig. 11(a) and 11(b), code coverage increases when the size of network segment becomes larger. A larger size of network segments means more hosts and thus more richness in IP diversity. However, the source IP diversity index
D
s_IP decreases at 140.113.249.0/24 in packet source 1, which means worse evenness.26
In this thesis, we define diversity indices for both fixed length header fields and variable header fields to alleviate comparison between packet traces and propose a methodology for calculating diversity index and analyzing code coverage. The packet traces are with different number of packets and different size of network segments.
Traffic diversity is calculated by the formula of Simpson’s index which considers richness and evenness at the same time. We analyze both user level source code ‐ Snort and kernel level source code – Linux kernel. Source code is instrumented and analyzed by Gcov to get its code coverage.
From experiment results, we can observe that code coverage increases when the number of packets or size of network segments of packet traces increase. For Snort, code coverage that packet source 1 can achieve is 32.2% while packet source 2