Security Data Visualization Graphical Techniques F... - (4 Vulnerability Assessment and Exploitation)
Security Data Visualization Graphical Techniques F... - (4 Vulnerability Assessment and Exploitation)
4
a n d E x p l o i t a t i o n
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
reconnaissance, usually port scans, with targeted attempts to identify
and test vulnerabilities. Nessus, developed by Tenable Network Security
([Link] is an extremely popular as well as
powerful vulnerability assessment tool, which I’ll use in this chapter to
demonstrate how vulnerability assessment works and how we can use visu-
alization to analyze various network attacks. I’ll follow up this discussion
with a walk-through of Metasploit, an open source platform for developing
and executing exploit code. I’ll then use visualization to closely examine the
behavior of a Metasploit attack that follows a common pattern: exploitation
of a known vulnerability, transfer of a malicious payload, and subsequent
compromise of the targeted host.
Nessus
Nessus began as a freely distributed, open source project. It uses a client-
server architecture, meaning that there are two components: a client that
controls the vulnerability assessment and a server that conducts it. Nessus
uses a library of plug-ins, small programs designed to test a given vulner-
ability to evaluate the target system. Figure 4-1 shows this plug-in library
displayed with NessusWX ([Link] a Nessus client for
Windows created by Victor Kirhenshtein and Nicolas Pouvesle.
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
Figure 4-1: A list of Nessus plug-ins displayed with the NessusWX client
In addition to Nessus, there are a number of other well-regarded vulnerability assessment
tools, including eEye’s Retina and Core Security Technologies’ CORE IMPACT. See http://
[Link]/[Link] for more information on these and similar tools.
Version 2.x remains free, but versions 3.x and later are commercial products. I’ll be using
version 2.x for my analysis.
You can find a comprehensive list of Nessus plug-ins at [Link]
60 Chapter 4
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
A typical vulnerability assessment occurs in two phases. In the first
stage, a port scan probes for listening ports. In the second stage, Nessus
intelligently selects from its list of plug-ins based on the target machine.
For example, Nessus won’t test a Unix machine for Windows-specific vul-
nerabilities. As the vulnerability assessment takes place, Nessus provides a
continuous update on the vulnerabilities it finds, including a count of holes
(exploitable vulnerabilities) and active ports (Figure 4-2). At the end of the
scan, Nessus provides a detailed report listing the specific vulnerabilities it
found as well as details on how those vulnerabilities can be secured.
As I begin an attack using Nessus, let’s capture some packets and
observe the probe from the target’s perspective. By gaining a better under-
standing of what attacks look like, we can apply that knowledge in later
chapters as we examine real-world network traffic.
techniques.
Highly interactive visualization systems are very useful to analysts
because they allow dynamic exploration, not just static views of data. Fig-
ure 4-3 shows the interface of one interactive system, RUMINT ([Link]
.[Link]). (You saw RUMINT’s parallel coordinate plot visualizations in
Chapter 3.) RUMINT uses a VCR-like interface to enable analysts to visually
play back traffic from any point within the set of packets. The user simply
loads the packet capture, opens the appropriate visualization windows, and
clicks the Play button.
RUMINT is intelligence community slang for rumor intelligence.
Some network tools literally play back packets by resending them on a network. While
RUMINT might provide this ability at some point in the future, here I am talking about
plotting packet data in visualization windows.
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
When I examine an unfamiliar dataset for the first time, I play it back
in its entirety to get a feel for the big-picture context. In other words, I load
the new dataset into RUMINT, open a visualization window or two (such
as the parallel coordinate plot) using the View menu, and then click the
Play button, which causes RUMINT to update each of the visualization dis-
plays based on the packet data. All we know about Nessus initially is that it
conducts a port scan and then attempts to find vulnerabilities in the ports
that are open. As I analyze the dataset, my strategy will be to precisely iso-
late the port scan and then remove it from the visualizations so I can focus
on the vulnerability phase of the attack. The dataset I captured from the
Nessus scan contains 36,156 packets. As we did in Chapter 3, let’s focus on
the 18,708 inbound packets. While the host’s responses also contain poten-
tially useful information, I’m more concerned with learning about how
Nessus conducts its probing.
NOTE While 1,518 bytes is the maximum size allowed by the original Ethernet specification,
newer specifications allow “jumbo frames” of 9,000 bytes. However, it is unlikely that
you will see jumbo frames on typical home and business networks.
62 Chapter 4
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
1
Packet number
n
0 1518
0 1000
Packet length
(bytes)
Figure 4-5: Using the packet length visualization to find the port scan within the Nessus vulnerability assess-
ment. This image shows the transition from the initial port scan, the solid green bar at the top of the screen,
to the port-specific attack phase.
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
Removing the port scan from the visualization is in my best interest
because it generates a lot of noise and consumes valuable screen space, CPU
time, and memory. However, while I’m reasonably sure that I’ve correctly
identified the scan, let’s use another visualization technique to verify that.
Figure 4-6 shows a parallel coordinate plot of the packets from the begin-
ning of the dataset to the transition point we noted at packet 15,468. This
graph shows that a single attacker probed a wide range of ports on the tar-
get machine. As you examine the image, note that Nessus used a continuous
series of source TCP ports. Clues such as port allocation give us insight into
the operating system of the attacker—which, in this case, is Slackware Linux
([Link] well as insight into the network program-
ming techniques employed by the attack tool’s developers. Note how Nessus
compares to our earlier visualizations of port scan software in Figure 3-9.
Now that we’ve safely identified the port scan, let’s continue our analysis.
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
Figure 4-6: Using a parallel coordinate plot to confirm the port scan. Notice the
sequential probing of destination ports.
64 Chapter 4
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
Animating Packets
Let’s examine an animated display for the Nessus dataset. Figure 4-7 com-
bines the static nature of the parallel coordinate plot with packet animation.
65535 65535
0 0
n 1 1 n
Packet Packet
65535 65535
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
0 0
n 1 1 n
Packet Packet
Figure 4-7: Animating the playback of the packets. The center section is a two-column
parallel coordinate plot, and the side sections use animated markers for packets. The top
image depicts the visualization after the arrival of five packets. The bottom image shows
how the display is updated after the arrival of three new packets.
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
This is important because parallel plots suffer from a significant shortcom-
ing: If packet header fields all have similar data, the resulting plots will be
identical. One thousand packets could follow the same path and you would
never know. The combined visualization, developed by Sven Krasser and
shown in Figure 4-7, solves this problem. The center region is a typical two-
column parallel coordinate plot. While we could plot any type of data from
the packet header fields on these axes, I’ve used TCP source and destination
ports. You may wish to explore different combinations; RUMINT supports
19 header fields.
As each packet arrives, RUMINT plots the line segment as with a nor-
mal parallel coordinate plot, but the tool also creates markers on each of
the side panes, one pair per packet (Figure 4-7, top). These markers start
out at the end of the newly plotted parallel coordinate plot line segment.
As additional packets arrive, existing markers are shifted slightly outward
toward the edge of the visualization (Figure 4-7, bottom). When the mark-
ers eventually reach the end of the display, they disappear. The result of
looping through this process is an animated display that allows you to see
how the two axis values change with each packet. In other words, we can
now compare the behavior of each packet against the others. For example,
increased activity on a particular port will result in an increased number of
markers issuing forth from a constant point on the respective axis. Note the
use of color for the markers. By assigning color based on a third variable, we
increase the amount of information shown in the display. Now, let’s use the
combined visualization technique to look at the Nessus dataset.
inside the red square in the main image is shown in greater detail below.)
Beyond the regularly spaced port scan traffic, Nessus generated a great deal
of activity targeting the lower ports. To focus on this, I filtered out all the
traffic with a destination port greater than 500, zoomed in, and then ran the
visualization once more. My decision to use 500 was somewhat arbitrary; you
might also choose to filter out ports greater than 1024, which would allow
you to focus on the privileged ports from 0 to 1023. However, I noticed that
See Sven Krasser, Greg Conti, Julian Grizzard, Jeff Gribschaw, and Henry Owen’s “Real-Time
and Forensic Network Data Analysis Using Animated and Coordinated Visualization” from the
2005 IEEE Information Assurance Workshop for more details on this technique.
66 Chapter 4
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
65535 65535
0 0
TCP TCP
source port destination port
Figure 4-8: Using the combined visualization technique to view the entire dataset. Notice the cluster of activity
targeting the low ports.
there was a great deal of activity on ports below 500, however, and filtering
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
in this way provides about twice as much detail as filtering below 1024. Upon
closer inspection, the image didn’t reveal any additional packets with values
less than 100, so I ran the visualization again to filter out any packets with
TCP destination ports less than 100 and greater than 500. I did this to maxi-
mize the detail displayed in the available screen space. Figure 4-9 shows the
result.
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
65535 500
0 100
TCP TCP
source port destination port
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
Figure 4-9: Filtering out everything except ports 100 to 500. By filtering and zooming in, we see two clusters
of Nessus activity, but the display is clouded by the port scan.
68 Chapter 4
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
65535 500
0 100
TCP TCP
source port destination port
Figure 4-10: Isolating the port scan. Notice the diagonal line on the right pane that shows
a series of destination ports being probed in succession.
display (Figure 4-11), we can easily determine the specific ports that were
targeted: 445, 139, and 135. What makes these ports significant? Ports 445
and 139 are associated with Windows file sharing, and port 135 is used for
locating Windows Distributed Component Object Model (DCOM) services.
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
65535 500
0 100
TCP TCP
source port destination port
Figure 4-11: Removing the port scan from the display. Notice that Nessus focused a great
deal of attention on ports 445, 139, and 135.
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
Let’s take a closer look at port 445. Figure 4-13 uses a simple technique
that I call a text rainfall set to display only printable ASCII strings of 5 char-
acters or more. The text rainfall displays contents of the packet as text, one
packet per line. If a byte is a printable ASCII character, it is printed directly;
in the case of byte values that don’t have an easily printable ASCII value, the
text rainfall prints a period character. The text rainfall allows an analyst to
compare the payloads of 25 to 50 packets at one time, and it is extremely
useful for cases in which the communication protocol uses unencrypted
human-readable commands, which are common. Notice that in these
packets, Nessus has identified the target machine’s name (CRAYII) and is
currently evaluating ADMINISTRATOR access. One drawback is that a text rain-
fall can only show about 80 to 120 characters per packet at one time on a
70 Chapter 4
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
Figure 4-12: Vulnerabilities reported by Nessus. Notice the large number of
vulnerabilities reported on TCP ports 135, 139, and 445.
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
typical monitor; the rest is either truncated, or the user must scroll hori-
zontally to see it. In most instances this isn’t a major disadvantage, because
many human-readable protocol commands typically occur right after packet
Of course, you always have the option of getting a bigger monitor.
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
headers and are easily visible in the first 80 to 120 characters. I’ll end my
analysis here, but an interesting extension would be to generate a catalog of
the visual signatures created by each plug-in. With these signatures, I believe
you could rapidly detect each type of exploitation attempt, and perhaps
even determine its success or failure, in other similar attacks.
We’ve just seen how Nessus performs vulnerability assessments, but
Nessus stops short of actually delivering a malicious payload, a key com-
ponent of real-world attacks. The next section covers Metasploit, which is
designed to do just that.
Metasploit
Metasploit is an advanced open source platform for developing, testing, and
using exploit code ([Link] It gives both seasoned
attackers and novices the ability to easily execute sophisticated exploits. An
attacker first chooses from a library of exploits, code that takes advantage of a
known vulnerability to bypass security. Second, the attacker pairs the chosen
exploit with a payload, the code that is executed after a successful attack. As
of this writing, Metasploit includes 143 different exploits and 75 different
payloads. Developed by the Metasploit Project and first released in 2003,
Metasploit is a significant advancement in hacking. Previously, exploits were
hard coded with individual payloads, and this inflexibility greatly reduced an
attacker’s ability to adapt and propagate attacks. Using Metasploit, however,
attackers can mix, match, and share attacks far more easily.
Nessus directly integrates port scanning into its probing, but Metasploit
assumes you have already identified ports of interest. Unless a machine is
up to date on security patches or protected behind a well-tuned firewall,
chances are an attacker can use Metasploit to successfully gain unauthorized
access. In this section, we’ll look at ways to visualize Metasploit attacks both
before and after compromise to help understand how they work. In this
example, assume that I’ve already used Nmap to probe a target computer
and have found a Microsoft Remote Procedure Call (RPC) DCOM service
running on port 135. This assumption does not require a leap of faith, as
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
Metasploit is powerful and can quickly get you into a lot of trouble. Make sure you are fully
authorized before using it on any network.
You can find a detailed Microsoft Security Bulletin on this vulnerability at [Link]
.[Link]/technet/security/bulletin/[Link].
72 Chapter 4
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
Choosing an Exploit
An attacker begins by using Metasploit’s show exploits command to search
for an appropriate exploit. The following is a partial listing of available
exploits.
Exploit Options
===============
For the uninitiated, these results from the show options command may
appear a bit cryptic. They show us that the exploit requires the IP address
of the target host (RHOST) and the port of the RPC service (RPORT). Note that
RPORT is already set to 135 by default, so all we need to do is use the set com-
mand to set the target’s IP address (which we identified as [Link]
during our initial Nmap scan).
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
Choosing a Payload
The next step is to select the payload we would like to pair with the exploit,
using the show payloads command.
74 Chapter 4
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
The payload requires that I choose which local host address should
receive the reverse shell connection (LHOST). I set this value to the IP
address of the attacking machine ([Link]) using the set LHOST com-
mand. I won’t alter the default local port that will receive the connection
(LPORT), which is 4321. The commonplace use of default values brings up an
important point: Many attackers will not deviate from these defaults. When
attackers rely on default values, they make their attacks easier to detect and
respond to.
C:\WINDOWS\system32>
attacker to the command line. At this point, the attacker maintains complete
access to the target machine and can proceed as desired.
C:\WINDOWS\system32>cd \topsecret
C:\topsecret>dir
Directory of C:\topsecret
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
1 File(s) 3,725 bytes
2 Dir(s) 4,104,339,456 bytes free
C:\topsecret>type [Link]
The Conventions of a number of the States having, at the time of adopting the Co
nstitution, expressed a desire, in order to prevent misconstruction or abuse of
its powers, that further declaratory and restrictive clauses should be added, an
d as extending the ground of public confidence in the Government will best insur
e the beneficent ends of its institution;
<snip>
The right of the people to be secure in their persons, houses, papers, and effec
ts, against unreasonable searches and seizures, shall not be violated, and no wa
rrants shall issue, but upon probable cause, supported by oath or affirmation, a
nd particularly describing the place to be searched, and the persons or things t
o be seized.
<snip>
NOTE The combination of an IP address and transport layer port is called a socket, and it
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
10
In certain instances, IP addresses are hidden behind a firewall and may not be unique across
the entire Internet.
76 Chapter 4
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
port, destination TCP address, and destination IP address to fill in these
two missing pieces of information. Note that the initial Metasploit attack
against port 135 was launched from port 1267, and the reverse shell back to
port 4321 came from port 1063. To summarize, the following two pairings
identify the processes in use.
Initial exploitation phase
Reverse
shell
Exploit
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
Source TCP
TCP Destination
IP address source
destination IP address
port
port
Figure 4-14: By using the parallel coordinate plot to confirm the initial attack against
port 135, we can see that it came from port 1267. In addition, we can see that the
reverse shell activity occurred on my chosen port, 4321, and the port chosen by the
target’s operating system, 1063.
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
Analyzing the Initial Exploitation and Follow-up Activity
In order to continue our exploration of the attack, let’s use two additional
visualization techniques to observe what occurred. A packet length display
(Figure 4-15) shows two distinct clusters of large packets. Based on our
knowledge of the attack, we can deduce that the top cluster of large packets
is probably the exploit and that the bottom cluster is probably the reverse
shell. Unfortunately, a simple bar graph of packet lengths doesn’t allow us
to confirm our instincts.
1
Packets
50
0 1518
Packet length (bytes)
Figure 4-15: Comparing packet lengths. Note the two clusters of larger packets at the top
and bottom of the display. The first likely contains the initial attack, and the second likely
depicts the subsequent shell activity. The next figure explores this hypothesis further.
11
For more information, see Gregory J. Conti, Julian B. Grizzard, Mustaque Ahamad, and
Henry L. Owen’s “Visual Exploration of Malicious Network Objects Using Semantic Zoom,
Interactive Encoding and Dynamic Queries” from VizSEC 2005.
78 Chapter 4
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
1
Packets
50
Figure 4-16: Using color to highlight printable ASCII bytes in the network packets so
that the reverse shell activity in the lower region stands out. The top region contains
few printable ASCII bytes and is likely the initial exploit.
NOTE Visualization of shellcode is an area ripe for additional work. If you are interested in
exploring this further, Hack Proofing Your Network by Ryan Russell (Syngress,
2002) and Hacker Disassembling Uncovered by Kris Kaspersky (A-List, 2007)
are both good starting points.
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
80
Chapter 4
Source Destination
IP address port
Exploit and
payload packets
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
(port 135)
Figure 4-17: Analyzing the attacker’s activities. The attacker initially sent a number of packets to exploit a vulnerability in port 135
(see packets 4, 5, and 7). After successfully installing the reverse shell software (listening on port 1063), the attacker sent it three
commands: cd, dir, and type.
Figure 4-18 depicts the second dataset, which contains the traffic ema-
nating from the target host back to the attacker. Note that the bulk of the
traffic is destined for port 4321 on the attacker’s machine. Recall that I
chose this port for the reverse shell when I configured Metasploit for the
attack. The detail view shows the payloads of the packets, also using a text
rainfall. The responses to the commands I issued using Metasploit are
clearly visible in the payload, including the listing of the secret file.
Reverse shell communications to attacker (port 4321)
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
Source Destination
IP address port
Figure 4-18: Analyzing the targeted host’s activities. After compromise, the targeted host
responds to the attacker’s commands via the packets in the red box. The detail region
above shows that the payload of these packets contains the text of the secret file.
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].
Conclusions
Vulnerability assessment tools such as Nessus and easy-to-use exploitation
tools such as Metasploit have changed the landscape of network security.
Attackers of all skill levels can use these tools, in conjunction with port
scanners, to locate and compromise many networked computers. Current
techniques for visualization of network exploits, payloads, and subsequent
activity have not been perfected, but the parallel coordinate plot, combined
visualization, text rainfall, and binary rainfall constitute a powerful set of
tools to help us better understand how these attacks work and how to pro-
tect against them. Even if an attacker obfuscates the shellcode or encrypts
his follow-up activities, these visualization techniques will work with the
unencrypted header fields to allow you to observe key aspects of the
interaction.
Copyright © 2007. No Starch Press, Incorporated. All rights reserved.
82 Chapter 4
Conti, G. (2007). Security data visualization : Graphical techniques for network analysis. No Starch Press, Incorporated.
Created from inflibnet-ebooks on 2024-01-05 [Link].