Detection of Attacks ....
Detection of Attacks ....
A Thesis Submitted in Partial Fulfillment of the Requirements for the Degree of Master in Computer
and Network Engineering.
Prepared By
Manhal Mohammed Mokhtar Hamed
Supervised by
Dr. Ahmed Abdallah
June-2017
i
اآليــــــة
بسم اهلل الرمحن الرحيم
قال تعاىل
﴿ قَالُوا سُبْحَا َنكَ لَا عِ ْلمَ لَنَا إِلَّا مَا عَلَّمْتَنَا ۖ إ َِّنكَ أَنْتَ الْعَلِي ُم الْحَكِيمُ ﴾
ii
DEDICATION
iii
ACKNOWLEDGMENT
Thanks be to God, before and after, characterized the human mind and
distinguished it.
This journey would not have been possible without the support of my
family, professors and mentors, and friends. To my family, thank you for
encouraging me in all of my pursuits and inspiring me to follow my
dreams. I am especially grateful to my parents, who supported me
emotionally and financially. I always knew that you believed in me and
wanted the best for me.
iv
ABSTRACT
v
المستخلص
شبىبث ِٕطمت اٌتخض ٟ٘ ٓ٠طش٠مت شبئعت ٚفعبٌت ٌبٕبء أٔظّت تخض ٓ٠وب١شة ،سٛاء ف ٟب١ئت اٌّؤسسبث أٚ
ٌّضٚد ٞخذِبث اٌتخضِ ٓ٠تعذدة إٌطبلبث ٚ ،اٌت ٟتتطٍب تٛفشًا عبًٌ١ب ٚسش٠ت ٚسالِت ٚأداءً .فِ ٟثً ٘زٖ األطش
٠ ،تصً وً اٌّض١ف ٓ١ببٌتخض ٓ٠عبش شبىتٌٚ .ىٓ ٕ٘بن ِخبطش إِٔ١ت أوثش ِٓ ٔظبَ اٌتخض ٓ٠اٌتمٍ١ذ .ٞال تٕطبك
أٔظّت وشف اٌتطفً اٌّتٛفش بىفبءة عٍ ٝب١ئبث شبىت اٌتخض ٓ٠بسبب استخذاَ اٌمٛاعذ اٌثببتت ٚعذَ اٌتعب ْٚبٓ١
ٚزذاث اٌىشف .عالٚة عٍ ٝرٌه ،لذ ٠تُ اختشاق ِىٔٛبث اٌىشف إرا تّىٓ اٌذخ ِٓ ً١اٌٛصٛي إٌ ٝإٌظبَ.
عالٚة عٍ ٝرٌه ٠ ،تُ إخشاء اٌىشف عٓ اٌسٍٛي األوثش شٛ١عًب عٍِ ٝست ٜٛأظّت اٌتشغ ً١أٚاٌشبىت .اٌغشض
ِٓ ٘زٖ األطشٚزت ٘ ٛتط٠ٛش تمٕ١ت اٌىشف عٓ االلتسبَ اٌّٛخ ٗٙإٌٔ ٝظبَ اٌتخضٌٍ ٓ٠ىشف عٓ ٘د َٛاٌسشوت
اٌدبٔب١ت ف ٟاستخذاَ شبىت ِٕطمت اٌتخض ٓ٠اٌت ٟتٛفش ِدٍذًا ِشتشوًب وّٕٛرج إختببس ببستخذاَ ِسًٍ شبىت "بش"ٚ
ٔ ٛ٘ٚظبَ أسبس ٟألِٓ اٌشبىبث ِفتٛذ اٌّصذس .اٌٙد َٛاٌدبٔب ٛ٘ ٟأزذ ِشازً ٘د َٛاٌتٙذ٠ذ اٌّستّش اٌّتمذَ
اٌزٕ٠ ٞتمً خالٌٗ ا ٌّٙبخُ بشىً تذس٠دٔ ِٓ ٟظبَ إٌ ٝآخش ف ٟاٌشبىت ٠ٚ ،ستغً أٚساق اعتّبدٖ ٌتٕف١ز ٘دَٛ
اٌبعثشة ٚ ،تصع١ذ االِت١بصاث ٚ ،اٌٛصٛي أخ١شاً إٌ ٝأ٘ذافٗ إٌٙبئ١ت ٟ٘ٚأٔظّت زشخت ز١ث تٛخذ اٌب١بٔبث
اٌشئ١س١ت .عٍ ٝاٌشغُ ِٓ ٚخٛد اٌعذ٠ذ ِٓ اٌطشق ٌتٕف١ز ٘د َٛاٌسشوت اٌدبٔب١ت ،فمذ لّٕب بتم ُ١١آٌ١ت اٌىشف ٌذٕ٠ب
ضذ اثٕ ِٓ ٓ١أوثش أسبٌ١ب اٌسشوت اٌدبٔب١ت شٛ١عب ّ٠ ،ىٓ أْ تى ْٛإزذ ٜإٌتبئح اٌّتشتبت عٍ٘ ٝد َٛزشوت
خبٔب١تٔبخر٘ ٛاٌٛصٛيغ١ش اٌّصشذ بٗ إٌ ٝاٌّعٍِٛبث اٌشخص١تٚاٌّبٌ١تٌٍششوبثأٚإٌّظّتاٌّعٕ١ت
vi
TABLE OF CONTENTS
اآلية................................................................................................................................ ii
Dedication ...................................................................................................................iii
Acknowledgment......................................................................................................... iv
Abstract ........................................................................................................................ v
المستخلص....................................................................................................................... vi
Introduction.............................................................................................................. 2
Methodology .......................................................................................................... 33
(Hypothesis) ...................................................................................................... 40
Investigation (Data)........................................................................................... 40
Figure 4.6 comparison between number of Write commands towards IPC$ in normal
and malicious behavior while using shared SMB via NAS storage. ......................... 47
References .................................................................................................................. 52
Appendices ................................................................................................................. 53
Appendix A ....................................................................................................... 54
Appendix B ....................................................................................................... 55
Appendix C ....................................................................................................... 56
ix
TABLE OF FIGURES:
x
LIST OF TABLES:
xi
LIST OF ABBREVIATIONS
ANSI American National Standards Institute
BRO Bro Network Analyzer
CIFS Common Internet File System
COM Communication port
DAS Direct Attached Storage
ESS Enterprise Storage Servers
FC Fibre Channel
FCIP Fiber Channel Internet Protocol
HBA Host Bus Adapters
HIDS Host-Based Intrusion Detection Systems
HMAC message authentication code
ICT information and communication, technology
IDPS Intrusion detection and prevention systems
IDS Intrusion Detection Systems
iFCP Internet Fibre Channel Protocol
International Committee for Information Technology
INCITS Standards
IPC Inter process communication
ISCSI internet Small Computer Interface
iSNS Internet Storage Name Services
JBOD Just a Bunch of Disks
LAN Local Area Network
MAN metropolitan area network
MBps megabytes per second
NAS Network Attached Storage
xii
NFS Network File Systems
NIC network interface card
NIDS Network-Based Intrusion Detection Systems
NTLM NT LAN Manager
RAID of Redundant Array of Independent Disks
SAN Storage Area Network
SCSI Small Computer Systems Interface
SIDS Storage-Based Intrusion Detection Systems
SMB Server Message Block protocol
SNIA The Storage Network Industry Association
SSA Serial Storage Architecture
VM Virtual Machine
WAN Wide Area Network
xiii
CHAPTER ONE
INTRODUCTION
2
Chapter One
Introduction
1.1 Preface
Many technologies have been developed to manage and handle this traffic of
data for use in different scales of networks such as LAN, MAN and WAN. Some
examples of these technologies include Network Attach Storage (NAS), Direct
Attach Storage (DAS) and Storage Area Network (SAN).
Storage Area Networks (SAN) is one such technology that emerged to quench
this need to store, manage, process and access data efficiently and securely. A
Storage area network, or SAN, maybe defined as a high-speed network of storage
devices. Also, these storage devices are connected to the servers. Applications
running on any of the networked servers can access and use this storage. Due to its
versatile functionality and their apparent property of being able to relieve
overburdened LANs from high volumes of data, SANs have become
overwhelmingly popular in the global market. They reduce administrative and
2
equipment costs, provide high data availability and ensure regular backups.
However, companies and its customers need to ensure the safety and security of the
information that is being routed through the storage area network. Today, most of
the data handled by large computing companies are managed on SANs. [5] Hence,
the Security has always been highest priority in such networks for network
administrators, working with information and sensitive data of their companies.
3
point for intrusion detection. The second, because there are very few people who
master storage technology, the chance of breaking through the storage system is rare.
This makes the SIDS very strong. [2]
The proposed solution to detect attacks is based on a set of intrusion detection and
tolerance components that are added to SAN system by:
A. the management of two areas (virtual area and protected area) at each
storage node;
4
B. the cooperation of detection modules running on each SAN component;
and
C. The use of distributed set of rules and scripts that are updated and
managed in a secure manner.
1.5 Methodology
The goal is to find out intrusion activity and attacks like ISCSI attacks or
detect lateral movement attack through SMB presents in packet with the help of
BRO analyzer. BRO analyzer also summarizes the intensive Storage IDS alerts by
5
sending summary reports to the administrator of the System. In which we will use
the virtualization environment to implement the storage-based IDS which is
connected to each virtual network as well as Open-filer software to provide storage
for VMs and by using Kali system to perform different attacks through the storage
network.
In general, the thesis will be divided into five chapters. Each chapter will
discuss on different issues related to the project. The following are the issues
discussed.
6
CHAPTER TWO
LITERATURE REVIEW
7
CHAPTER TWO
Literature Review
2.1 Introduction
8
2.2 SAN technology overview
Historically, storage devices, such as disk drives and backup tapes, were
directly attached to a host, hence the name Direct Attached Storage or DAS. This
was performed via SCSI (Small Computer Systems Interface) parallel bus interface
with a speed of up to 320 MBps. This approach of attaching storage devices is
coming from internal computer architecture, which has obviously got to its limits in
several ways. Number of devices, which could be attached to one bus, is limited
even in latest version of SCSI protocol to only 16 devices while the distances are not
bigger than 15 meters. Sharing disk or tapes drives amongst multiple hosts were due
to architecture of DAS impossible or required specialized and typically expensive
software or controllers for device sharing. On the other side, utilization of the
storage spread across the multiple servers was typically lower than on one single
pool. Often necessary expansions of storage volumes and replacement of the failed
9
hard drives have in DAS architecture frequently generated system downtimes. DAS
Architecture is illustrated in Figure 2.1 .[4]
The effort to get a better usage of storage devices by the multiple hosts has
generated specialized devices for shared storage access on the file level. This
architecture is commonly referred as Network Attached SAN Storage or shortly
NAS. NAS architecture consist of a dedicated device named Filer which is actually a
stripped down and optimized host for very fast network file sharing. Two most
typically supported file systems on Filers are NFS (Network File Systems) for a
Unix world and CIFS (Common Internet File System) for the Microsoft world.
While NAS solution has its main advantage in simplicity in maintenance and
installation, its main drawback is limited file and operating system support or
support of future new file systems. Architecture of a NAS illustrated in Figure 2.2.
10
Figure 2. 2: NAS Architecture
The latest mechanism of attaching storage remotely with a block level access
is commonly referred as Storage Area Network or SAN. SAN consist of hosts,
switches and storage devices. Hosts equipped with Host Bus Adapters (HBA) are
attached via optical cable to a storage switches which act as a fabric between the
hosts and the storage devices. SAN architecture is illustrated in Figure 2. 3.[4]
11
2.2.2 Storage Area Network objectives
The main objectives that make SAN a popular solution for storage networks
are: disk utilization, disaster recovery methods, availability of data and fast backup
data ability. SAN help users to use disk resources in a more efficient way, since all
the disks in SAN are kept together as one resource so the management of disks
become easier and disks can work better and more utilized, resulting in less waste of
free space. One can therefor save power and increase the performance of the system.
SANs are capable of adding or removing new disks for expanding the free space to
servers and applications, whenever an application need more space, it is thus easier
to make free space available without turning servers down or power them off to
allocate free space to applications. SAN has good disaster recovery method; by
mirroring the data to another disk that located in another place and used different
types of Redundant Array of Independent Disks (RAID) to provide mirroring and
data duplication, SAN improve the communication I/ O by using fiber optic cables
and gigabit Ethernet LAN also reduce the physical space that need for keeping
storage devices and servers, because SAN handle the data management with lower
number of servers and higher number of disks. SAN components consist of basic
elements such as connectivity part that typically is fibre optic in FC and fast or
gigabit Ethernet for iSCSI, hubs, switches, directors, connectors and routers are
themain components of SAN. Components can be from different storage devices e.g.
tape, Just a Bunch of Disks (JBOD), Enterprise Storage Servers (ESS), Serial
Storage Architecture (SSA) and IBM DS family storages. Different servers in SAN
can use different operating systems such as Windows, UNIX and LINUX. By help
of different communication techniques and communication protocols such as iSCSI
and Fiber Channel Internet Protocol (FCIP) SAN allows the storage management
over long distances with high speeds in centralized and efficient way. Traditional
12
storage devices work with SCSI connectors for making communication with host,
that makes the connection length limited to 25 meters but SAN with using fiber optic
technology overcame to this limitation and extended it up to 10 kilometers and
increased the number of connections that was 16 in SCSI to unlimited for FC.[3]
In the long history of adaptations and improvements, the line sometimes blurs
between where one Small Computer System Interface (SCSI) ends and another
begins. The original SCSI standard approved in 1986 by the American National
Standards Institute (ANSI), supported transfer rates of up to 5 MBps (megabytes per
second) which is, measured by today's standards, slow. Worse yet, it supported a
very short bus length. When original SCSI was introduced, however, it represented a
significant improvement over what was available at that time, but the problem was
the compatibility - since many vendors offered their own unique SCSI options. The
next generation of SCSI standard SCSI-2, incorporated SCSI-1 as its subset. In
development since 1986, SCSI-2 gained its final approval in 1994 and resolved
many of the compatibility issues original SCSI-1 faced. With SCSI-2, it was possible
to construct more complex configurations using a mix of peripherals. The most
noticeable benefit of SCSI-2 over SCSI-1 was its speed. Also called Fast SCSI,
13
SCSI-2 typically supported bus speeds up to 10 MBps but could go up to 20 MBps
when combined with fast and wide SCSI connectors. Fast SCSI enabled faster
timing on the bus (from 5 to 10 MHz), thereby providing for higher speed. Wide
SCSI used an extra cable to send data that's 16 or 32 bits wide, which allowed for
double or quadruple the speed over the bus versus standard, narrow SCSI interfaces
that were only 8 bits wide. The latest specification of SCSI protocol, SCSI-3 was
among other improvements the first one that did a separation of the higher-level
SCSI protocol from the physical layer. This was the prerequisite of giving
alternatives to run SCSI commands on top of different physical layers than the
parallel bus. Hence the SCSI-3 specification was the basis of porting the SCSI
protocol to different media carriers such as Fibre Channel or even other transport
protocols as TCP/IP[3]
2.3.2 Internet SCSI
The SCSI-3 protocol has been mapped over various transports such as parallel
SCSI, IEEE-1394 (firewire) and Fibre Channel. All these transports have their
specifics but also all have limited distance capabilities. The Internet SCSI or shortly
iSCSI protocol is the IETF draft standard protocol that describes means of
transporting SCSI packets over TCP/IP. The iSCSI interoperable solution can take
advantage of existing IP network infrastructure which have virtually no distance
limitations. Encapsulation of the SCSI frames in the TCP/IP protocol is illustrated in
Figure 2. 4.[4]
14
The primary market driver for the development of the iSCSI protocol was to
enable broader access of the large installed base of DAS over IP network
infrastructures. By allowing greater access to DAS devices over IP networks, storage
resources can be maximized by any number of users or utilized by a variety of
applications such as remote backup, disaster recovery, and storage virtualization. A
secondary driver of iSCSI is to allow other SAN architectures such as Fibre Channel
to be accessed from a wide variety of hosts across IP networks. iSCSI enables block-
level storage to be accessed from Fibre Channel SANs using IP storage routers or
switches, furthering its applicability as an IP-based storage transport protocol. iSCSI
defines the rules and processes to transmit and receive block storage applications
over TCP/IP networks. Although iSCSI can be supported over any physical media
that supports TCP/IP as a transport, most iSCSI implementations runs on Gigabit
Ethernet. iSCSI protocol can run in software over a standard Gigabit Ethernet
network interface card (NIC) or can be optimized in hardware for better performance
on an iSCSI host bus adapter (HBA). iSCSI enables SCSI-3 commands to be
encapsulated in TCP/IP packets and delivered reliably over IP networks. As it sits
above the physical and data-link layers, iSCSI interfaces to the operating system's
standard SCSI access method command set to enable the access of block-level
15
storage that resides on Fibre Channel SANs over an IP network via iSCSI-to-Fibre
Channel gateways such as storage routers and switches. iSCSI protocol stack
Fibre Channel (FC) is an open industry standard serial interface for high-speed
systems. FC is a protocol for transferring the data over fibber cable that consists of
16
multiple layers covering different functions. As a protocol between the host and a
storage device, FC was out of a scope of an average information technology
professional for a simple reason that it was point to point connection between the
host with a HBA and storage device of typically same vendor which did not require
any knowledge or understanding except maybe during the installation process. From
the speed perspective, FC is available already in flavors of 1 Gbps and 2 Gbps while
specifications for 4Gbps as well as 10Gbps are being worked on and are not that far
away.
17
Figure 2. 6: Fibre Channel Protocol Stack
The lowest level (FC-0) defines the physical link in the system, including the
fibre, connectors, optical and electrical parameters for a variety of data rates. FC-1
defines the transmission protocol including serial encoding and decoding rules,
special characters and error control.
The FC-3 level of the FC standard is intended to provide the common services
required for advanced features such as:
FC-4, the highest level in the FC structure defines the application interfaces
that can execute over Fibre Channel. It specifies the mapping rules of upper layer
protocols such as SCSI, ATM, 802.2 or IP using the FC levels below.
Fiber Channel Over TCP/IP (FCIP) protocol is described in the IETF draft
standard as the mechanisms that allow the interconnection of islands of Fibre
Channel storage area networks over IP-based networks to form a unified storage area
network in a single Fibre Channel fabric. Encapsulation of the FC frames which are
carrying SCSI frames on top of the TCP is illustrated in Figure 2. 7.[1, 4]
19
2.3.5 Other SAN Protocols
There are several other SAN protocols which are in IETF draft proposal or
development like Internet Fibre Channel Protocol (iFCP) or Internet Storage Name
Services (iSNS). iFCP is also a gateway-togateway approach in which FC frames are
encapsulated directly into IP packets and IP addresses are mapped to a FC device.
This is more iP-oriented scheme than the IP tunneled SCSI frames FCIP, but is a
more complex protocol that was designed to overcome the potential vulnerabilities
of stretched fabrics, enable multi-point deployments and provide native IP
addressing to individual Fibre Channel transactions. [4]
iSNS protocol is used for interaction between iSNS servers and iSNS clients
in order to facilitate automated discovery, management, and configuration of iSCSI
and FC devices on a TCP/IP network. iSNS provides intelligent storage discovery
and management services comparable to those found in FC networks, allowing a
commodity IP network to function in a similar capacity as a storage area network.
iSNS also facilitates a seamless integration of IP and FC networks, due to its ability
to emulate FC fabric services, and manage both iSCSI and Fibre Channel devices.
iSNS thereby provides value in any storage network comprised of iSCSI devices,
Fibre Channel devices (using iFCP gateways), or any combination thereof. iFCP
requires iSNS for discovery and management, while iSCSI may use iSNS for
discovery, and FCIP does not use iSNS.[3, 4]
23
anomaly-based detection are inadvertently including malicious activity within a
profile, establishing profiles that are not sufficiently complex to reflect real-world
computing activity, and generating many false positives.
Sensor or Agent. Sensors and agents monitor and analyze activity. The
term sensor is typically used for IDPSs that monitor networks, including network-
based, wireless, and network behavior analysis technologies. The term agent is
typically used for host-based IDPS technologies.
24
Management Server. A management server is a centralized device that
receives information from the sensors or agents and manages them. Some
management servers perform analysis on the event information that the sensors or
agents provide and can identify events that the individual sensors or agents cannot.
Matching event information from multiple sensors or agents, such as finding events
triggered by the same IP address, is known as correlation. Management servers are
available as both appliance and software-only products. Some small IDPS
deployments do not use any management servers, but most IDPS deployments do.
In larger IDPS deployments, there are often multiple management servers, and in
some cases, there are two tiers of management servers.
25
2.6 Preliminary Knowledge
26
authentication is based on challenge response, which contains nonce from a client
and nonce from server[6]
Figure 2.8 shows how SMB client and server initiates communication. Client
sends SMB C0M Negotiate to server to request negotiation of SMB protocol dialect.
In this message the client includes his dialects (max buffer size, canonical file
names, etc). In response to the client request the Server identify SMB protocol
dialects for the session and also includes 8-byte random string used in the next to
authenticate client. Client then sends SMB COM Session Setup ANDX message to
identify his
capabilities. The client also sends username, domain name, or password hash;
the server supports both plaintext password as well as password hash. In response to
this message, if the server accepts challenge/response, Server will issue a valid UID
to the client for the session else the server will deny the client access request. The
issued UID is submitted with all subsequent SMBs on that connection to the server.
If the client is granted access, the client sends SMB COM Tree Connect ANDX
message to request access to the share (e.g. IPC$, Admin$, C$) and fully specifying
the path of the share. Based on the client credentials if the client is allowed to access
the requested share, the server returns 16-bit tree ID (TID) else the server responds
with error message and deny access to the request share. With SMB COM Open
ANDX message the client request the server to open a file on the accessed share. If
access to the requested file is granted, in response the server returns file ID of the
requested file. In SMB COM Read ANDX message the client includes the file ID
issued to the client in the previous message to request the server to read data from
the previously opened file and return its data to the client. In response to this request
the server return the requests file data.
27
Figure 2.8 Microsoft SMB Protocol Packet Exchange Scenario
Many intrusion detection systems (IDSs) have been developed over the years,
with most falling into one of two categories: network-based or host-based. Network
IDSs (NIDS) are usually embedded in sniffers or firewalls, scanning traffic to, from,
and within a network environment for attack signatures and suspicious traffic. Host-
based IDSs (HIDS) are fully or partially embedded within each host’s OS. They
examine local information for signs of intrusion or suspicious behavior. Many
environments employ multiple IDSs, each watching activity from its own vantage
point.
29
The storage system is another interesting vantage point for intrusion detection.
Several common intruder actions are quite visible at the storage interface. Examples
include manipulating system utilities (e.g., to add backdoors or Trojan horses),
tampering with audit log contents (e.g., to eliminate evidence), and resetting
attributes (e.g., to hide changes). By design, a storage server sees all changes to
persistent data, allowing it to transparently watch for suspicious changes and issue
alerts about the corresponding client systems. Also, like a NIDS, a storage IDS must
be compromise-independent of the host.[7]
For emphasis, we note that there have been many intrusion detection systems
focused on host OS activity and network communication. Axelsson [1998] surveyed
and laid out classifications for many of these IDS types. Also, the most closely
related tool, Tripwire [Kim and Spafford 1994], was used as an initial template for
our prototype’s file modification detection rule set. Our work is part of a line of
research exploiting physical [Ganger and Nagle 2001; Zhang et al. 2002] and virtual
[Chen and Noble 2001; Payne et al. 2007] protection boundaries to detect intrusions
into system software. Notably, Garfinkel and Rosenblum [2003] explore the utility
of an IDS embedded in a Virtual Machine Monitor (VMM), which can inspect
machine state while being compromise-independent of most host software. Storage-
based intrusion detection rules could be embedded in a VMM’s storage module,
rather than in a physical storage device, to identify suspicious storage activity. After
our initial explorations of the field of storage-based intrusion detection [Pennington
et al. 2003; Griffin 2004], other researchers pursued complementary projects that
advanced the field and demonstrated the versatility of active monitoring behind the
storage interface. Banikazemi et al. at IBM Research explored the commercial
viability of storage-based intrusion detection [Banikazemi et al. 2005]. First, they
extended our IDD concept beyond a single disk and into a managed storage area
30
network, demonstrating a concrete realization of a real-time block-based storage
device inside a commercially viable storage platform. Second, they observed the
utility of using delayed execution an IDS rule-set over file system snapshots as an
efficient complement to real-time IDS activity. Paul et al. at the University of
Virginia explored the architectural issues that will be faced in stand-alone
semantically smart disk systems [Paul 2008; Paul et al. 2005]. They identified
observable disk-level behaviors that are characteristic of malware and explored disk
detection algorithms tuned to operate in the limited-resource embedded
computational environments that will likely be characteristic of programmable
storage devices. Butler et al. at the Pennsylvania State University introduced the idea
of using a removable administrative token to perform safe programming and
administration of a storage-based IDS [Butler et al. 2008]. They identified an elegant
empirical alternative to selecting which blocks should be treated as immutable by the
IDS rule-set: with some exceptions, all blocks written to storage whenever the
administrative token is present are considered immutable. The results from these
three independent projects collectively underscore our claims of the feasibility and
efficacy of locating independent security monitoring and response utilities behind
the storage interface. Somewhere between block-based storage and file-based
storage lies the emerging concept of object-based storage [Gibson et al. 1998; Weber
2004]. Storage-based intrusion detection is easier for storage objects than for blocks,
since files often map directly to one or more objects. One such system has been
demonstrated by Zhang and Wang [2006] who created a storage-based IDS running
on an early object-based storage implementation. Perhaps the most closely related
work is the original proposal for self-securing storage [Strunk et al. 2000], which
argued for storage-embedded support for intrusion survival. Self-securing storage
retains every version of all data and a log of all requests for a period of time called
the detection window. For intrusions detected within this window, security
31
administrators have a wealth of information for post intrusion diagnosis and
recovery. Such versioning and auditing complements storage-based intrusion
detection in several additional ways.
First, when creating rules about storage activity for use in detection,
administrators can use the latest audit log and version history to test new rules for
false alarms.
Second, the audit log could simplify implementation of rules looking for
patterns of requests.
Fourth, since the history is retained, a storage IDS can delay checks until the
device is idle, allowing the device to avoid performance penalties for expensive
checks by accepting a potentially longer detection latency.[1, 7]
32
CHAPTER THREE
METHODOLOGY
33
Chapter Three
Methodology
34
with installed BRO IDS integrated with kitana log for GUI), Windows
Sever 2012, Window 7 (Staff machine), Windows 7 (Staff machine) and
Open-Filer storage to represent the SAN storage network.
The SBIDS system is monitoring all ingress and egress traffic from
the systems on the WORKGROUP domain through port mirroring on the
switch. A GNS3 core switch “Cisco 26125S” is connecting all the VMs
through a cloud interfaces, the attacker running Kali Linux is assumed to be
on
the
net
wo
rk
po
st-
co
mp
ro
mi
se, within the testing environment.
35
Figure 3. 2 Block Diagram of the Proposed Model
Device SAN network IP Shared SMB folder VMnet-If
Centos 7 server with BRO 192.168.20.254/24 - VMnet11
OpenFiler SAN storage 192.168.20.100/24 Vmnet12
Windows 7 Client 192.168.20.30/24 \\192.168.20.100\sharenas.smb.windo VMnet15
Windwos server 2012 192.168.20.2/24 VMnet13
Kali linux 192.168.20.14/24 - VMnet14
dce_rpc.log
Distributed Computing Environment/RPC
smb_cmd.log
SMB commands
smb_files.log
SMB files
smb_mapping.log
SMB trees
36
With Bro, we can build additional detections, and generate alerts on
instances of suspicious SMB activity. Bro offers the advantage of detecting
activity in real-time by-passing traffic to the analysis engine. It can also
detect malicious activity in packet captures, which can be applied
retrospectively to past events. [6]
38
network, giving them a chance to alter their tactics or cause further damage.
Trusted systems should be added to the global trustedIPs variable, which
would prevent them from being misidentified as malicious. Appendix B and
C displays another custom script, created to detect the use of the C$,
ADMIN$, or IPC$ shares. While there are legitimate uses for these shares,
activity involving these shares should be limited. Attackers use these shares
to execute services and processes, upload/transport malware, and move
laterally. Any systems seen in the notice log for this alert should be
investigated to determine if they are infected or compromised. Trusted
administrative systems can be tuned out by adding their static IP to the
trustedIPs set.
39
3.6 Attack scenario:
Table 3.3 below illustrates how to use the hypotheses laid out with
the data and techniques enumerated.
Hypothesis: Attackers may be attempting to move laterally
in Windows environment by leveraging PsExec using the
shared SAN.
40
3.7 Random Host Name:
41
CHAPTER FOUR
RESULTS AND DISCUSSION
CHAPTER FOUR
42
Results and Discussion
Figure 4.1 shows the architecture of the testing lab. To collect the
datasets, Wireshark is running on Windows 12 OS and SAN storage to
detect the share traffic. Two types of datasets are generated at the lab,
normal datasets and datasets containing lateral movement attacks in the
proposed Storage Network. In normal datasets, real administrator behavior
is simulated, while malicious datasets contain attacker behavior.
43
The metaexploit tool, used to generate normal and malicious datasets.
The total size of the datasets generated at this lab is 10Mb. The total time
duration of these datasets is approximately 11 minutes.
Below are some examples of the capabilities that the scripts shown in
Appendix A and B provide to detect attacks utilizing SMB in Storage Area
Network.
All cases of the received values have been illustrated in more details
below.
44
4.2 Metasploit psexec
db_status
use exploit/windows/smb/psexec
set RHOST 192.168.20.2
set SMBDomain WORKGROUP
set SMBPASS test@123
set SMBUSER administrator
set payload windows/meterpreter/reverse_tcp
set LHOST 192.168.20.14
exploit
45
The “exploit” command runs the module which results in a
meterpreter session, giving the attacker access to the remote system at IP
address 192.168.20.2 as seen in Figure 4.2. Figure 4.3 displays the Bro
notice log, verifying detection of Metasploit PsExec module use of
ADMIN$ and IPC$ shares, as well as use of the random hostname “WIN-
V34558051QU”.
Attackers use the SMB protocol in ways that blend in with day-to-
day network traffic. These malicious entities then move laterally within a
network, post-compromise, and attempt to access systems looking for
47
sensitive data. The SMB protocol allows their activity hard to detect.
Collecting Windows or Linux event logs related to file share auditing is a
method for detecting malicious SMB activity, however this is not ideal due
to the large volume of logs generated logs.
48
CHAPTER FIVE
CONCLUSION AND RECOMMENDATIONS
49
Chapter Five
Conclusion and Recommendations
5.1 Conclusion
A storage IDS watches system activity from a new view point, which
immediately exposes some common intruder actions. Running on separate
hardware, this functionality remains in place even when client OSes or user
accounts are compromised. Our prototype storage IDS demonstrate both
feasibility and efficiency within a file server. Analysis of real intrusion tools
indicates that most would be immediately detected by a storage IDS. After
adjusting for storage IDS presence, intrusion tools will have to choose
between exposing themselves to detection or being removed whenever the
system reboots. We described and evaluate a prototype storage IDS,
embedded in an NFS server, to demonstrate both feasibility and efficiency of
storage-based intrusion detection to detect lateral movement attack using
SMB protocol by using BRO network analyzer, Intrusion detection systems,
such as Snort rely primarily on pattern-based indicators, which can be
bypassed and may be difficult to tune. Bro Network Security Monitor can
analyze the SMB protocol and provide metadata which can be used to
identify potential indicators of compromise. These indicators are the basis of
scripts that are used to detect malicious activity and alert analysts. The
scripts introduced in this research generate alerts when potentially malicious
files transferred via SMB, hidden file shares such as C$ are used, and when
suspicious hostnames seen in SMB traffic. Bro proves to be an effective,
open-sourced, and cost efficient, solution to detect and respond to malicious
activity.
50
5.2 Recommendations
51
REFERENCES
52
APPENDICES
53
Appendix A
@load base/frameworks/files
@load base/frameworks/notice
@load frameworks/files/hash-all-files
export {
redef enum Notice::Type += { SMB};
global trustedIPs: set[addr] = {192.168.1.22,192.168.1.20} &redef;
# url needed to use VirusTotal API
const vt_url = "https://www.virustotal.com/vtapi/v2/file/report" &redef;
# VirusTotal API key
const vt_apikey = "<---- Enter your Virus Total API key here ---->" &redef;
# threshold of Anti-Virus hits that must be met to trigger an alert
const notice_threshold = 2 &redef;
event file_hash(f: fa_file, kind: string, hash: string)
{
# If the file "f" for the event has a source type, and if the source type equals
SMB, check file hash against VirusTotal
if ( f?$source && f$source == "SMB")
{
local data = fmt("resource=%s", hash);
local key = fmt("-d apikey=%s",vt_apikey);
# HTTP request out to VirusTotal via API
local req: ActiveHTTP::Request = ActiveHTTP::Request($url=vt_url,
$method="POST",$client_data=data, $addl_curl_args=key);
when (local res = ActiveHTTP::request(req))
{
if ( |res| > 0)
{
if ( res?$body )
{
local body = res$body;
local tmp = split_string(res$body,/\}\},/);
if ( |tmp| != 0 )
{
local stuff = split_string( tmp[1], /\,/ );
# splitting the string that contains the amount of
positive anti-virus hits on ":" "positives:23"
local pos = split_string(stuff[9],/\:/);
# converting the string from variable pos into a
integer
local notic = to_int(pos[1]);
# If the number of positives (number stored in
variable notic) equals or exceeds the threshold, generate a notice
if (notic >= notice_threshold )
54
Appendix B
@load base/frameworks/files
@load base/frameworks/notice
#@load policy/protocols/smb
@load base/protocols/smb
export {
redef enum Notice::Type += {
Match
};
global isTrusted = T;
global trustedIPs: set[addr] = {192.168.20.100,192.168.20.2} &redef;
function hostAdminCheck(sourceip: addr): bool
{
if (sourceip !in trustedIPs)
{
return F;
}
else
{
return T;
}}
event smb2_tree_connect_request(c: connection, hdr: SMB2::Header, path: string)
{
isTrusted = hostAdminCheck(c$id$orig_h);
if (isTrusted == F){
if ("IPC$" in path || "ADMIN$" in path || "C$" in path)
{
NOTICE([$note=Match, $msg=fmt("Potentially Malicious Use of NAS Share"),
$sub=fmt("%s",path), $conn=c]);
}}}
event smb1_tree_connect_andx_request(c: connection, hdr: SMB1::Header, path: string, service:
string)
{
isTrusted = hostAdminCheck(c$id$orig_h);
if (isTrusted ==F){
if ("IPC$" in path || "ADMIN$" in path || "C$" in path)
{
NOTICE([$note=Match, $msg=fmt("Potentially Malicious Use of NAS Share"),
$sub=fmt("%s",path), $conn=c]);
}}}}
55
Appendix C
Bro Script for random hostname access through the SMB share:
@load base/frameworks/notice
#@load policy/protocols/smb
@load base/protocols/smb
export {
redef enum Notice::Type += {
SMB
};
event ntlm_authenticate(c: connection, request: NTLM::Authenticate)
{
# strip out the first 5 characters of workstation value to be compared to naming convention
local strcheck = sub_bytes(request$workstation, 1, 8);
# value of the comparison of the two strings
local comp_str = strcmp(strcheck ,"WIN-V34558051Qu" );
# If the comparison of the strings stored in variable comp_str are not the same, generate a notice.
if (comp_str != 0 )
{
NOTICE([$note=SMB, $msg=fmt("Potential Lateral Movement Activity – Invalid Hostname
using Domain Credentials"), $sub=fmt("%s,%s","Suspicious Hostname:",request$workstation),
$conn=c]);
}
}
}
56