OS Security 2
OS Security 2
SECURITY
Malware 6/15/2021
2 GENERAL PRINCIPLES
3
Malware 6/15/2021
• Linux • Windows
• Allow-only ACEs • Allow and deny ACEs
• Access to file depends on ACL of file and of • Access to file depends only on file’s ACL
all its ancestor folders • ACLs of ancestors ignored when
• Start at root of file system access is requested
• Traverse path of folders • Permissions set on a folder usually
• Each folder must have execute (cd) propagated to descendants (inheritance)
permission • System keeps track of inherited ACE’s
• Different paths to same file not equivalent
Malware 6/15/2021
5 DISCRETIONARY ACCESS
CONTROL (DAC)
• Users can protect what they own
• The owner may grant access to others
• The owner may define the type of access (read/write/execute) given to
others
• DAC is the standard model used in operating systems
UNIX PERMISSIONS
• Standard for all UNIXes
• Every file is owned by a user and has an associated group
• Permissions often displayed in compact 10-character notation
• To see permissions, use ls –l
jk@sphere:~/test$ ls –l
total 2
-rw-r----- 1 jk ugrad 0 2005-10-13 07:18 file1
-rwxrwxrwx 1 jk ugrad 0 2005-10-13 07:18 file2
Malware 6/15/2021
11
ROOT
12 FILE DESCRIPTORS
• In order for processes to work with files, they need a shorthand way to refer
to those files.
• other than always going to the filesystem and specifying a path to the files in question
• In order to efficiently read and write files stored on disk, modern operating
systems rely on a mechanism known as file descriptors.
• When a program needs to access a file, a call is made to the open system call,
which results in the kernel creating a new entry in the file descriptor table
which maps to the file’s location on the disk
• when finished, the program should issue the close system call to remove the
open file descriptor
Malware 6/15/2021
• Since the new process inherits the file descriptors of its parent,
• it will be able to read or write to the file
• although the child process might not have permission to open that file in other
circumstances.
Malware 6/15/2021
17
SIMPLE BUFFER OVERFLOW ATTACKS
• In any situation where a program allocates a fixed-size buffer in memory in which
to store information
• Care must be taken to ensure that copying user-supplied data to this buffer is
done securely and with boundary checks.
• If this is not the case, then it may be possible for an attacker to provide input
that exceeds the length of the buffer,
• which the program will then attempt to copy to the allotted buffer.
• This copying may overwrite data beyond the location of the buffer in memory
• Potentially allow the attacker to gain control of the entire process and execute arbitrary
code on the machine
18 Malware 6/15/2021
ARITHMETIC OVERFLOW
• For example, if a program continually adds very large numbers and eventually
exceeds the maximum value for a signed integer, 0x7fffffff, the representation of
the sum overflows and becomes negative rather than positive
Malware 6/15/2021
19 AN EXAMPLE VULNERABILITY
22
MALWARE:
MALICIOUS SOFTWARE
Malware 6/15/2021
23
MALICIOUS SOFTWARE / MALWARE
• This chapter is devoted to the ways that software systems can be attacked
by malicious software, which is also known as malware.
• Malicious software is software whose existence or execution has
negative and unintended consequences.
• We discuss various kinds of malware, including some case studies, and
how systems and networks can be protected from malware
Malware 6/15/2021
26 4.1.1 BACKDOORS
• When used in a normal way, the program performs completely as expected and
advertised.
• But if the hidden feature is activated, the program does something unexpected,
often in violation of security policies, such as performing a privilege
escalation.
• Benign example: Easter Eggs in software and games
Malware 6/15/2021
• A computer virus is computer code that can replicate itself by modifying other
files or programs to insert code that is capable of further replication.
• This self-replication property is what distinguishes computer viruses from
other kinds of malware, such as logic bombs.
• Another distinguishing property of a virus is that replication requires some type of
user assistance, such as clicking on an email attachment or sharing a USB drive.
Malware 6/15/2021
34 VIRUS PHASES
• Dormant phase. During this phase, the virus just exists—the virus is laying low and
avoiding detection.
• Propagation phase. During this phase, the virus is replicating itself, infecting
new files on new systems.
• Triggering phase. In this phase, some logical condition causes the virus to move
from a propagation phase to perform its intended action.
• Action phase. In this phase, the virus performs the malicious action that it was
designed to perform, called payload.
• This action could include something seemingly innocent, like displaying a silly picture on a
computer’s screen, or something quite malicious, such as deleting all essential files on the hard
drive.
Malware 6/15/2021
35 TYPES OF VIRUSES
36
4.2.2 DEFENCES AGAINST VIRUSES - SIGNATURE
• All the signatures together create the malware database that usually is
proprietary
• Common Malware Enumeration (CME)
• Digital Immune System (DIS)
Malware 6/15/2021
38
4.2.3 ENCRYPTED VIRUSES
• The presence of their virus in a file is more stealthy if the main body of
the program is encrypted, especially the replication code and payload
• The virus code’s new structure: the decryption key, the key and the
encrypted virus code.
• This structure becomes a kind of virus signature
• The arm race continues: Signature based detection encrypted viruses
look for encryption code
39 Malware 6/15/2021
• Metamorphic virus
• Non-cryptographic obfuscation techniques, such as instruction reordering, inclusion of useless
instructions.
• Challenging to detect
Malware
41
4.3 MALWARE ATTACKS -- TROJAN HORSES
• Mocmex
• it was discovered that several Chinese made digital photo frames
• malware is copied from the frame to the computer and begins collecting and
transmitting passwords
Malware 6/15/2021
43
WORM DEVELOPMENT
44
WORM DEVELOPMENT
• Once a system is infected, a worm must take steps to ensure that it persists on the victim
machine and survives rebooting.
• On Windows machines, this is commonly achieved by modifying the Windows Registry, a
database used by the operating system that includes entries that tell the operating system
to run certain programs and services or load device drivers on startup.
• One of the most common registry entries for this purpose is called
• HKEY LOCAL MACHINE \SOFTWARE \Microsoft \Windows \CurrentVersion \Run
• Associating with this entry the path to the executable file of the worm will result in Windows
executing the worm on startup.
• Thus, malware detection software always checks this entry (and other registry entries
specifying programs to run at startup) for suspicious executable names.
Malware 6/15/2021
45
WORM PROPAGATION
48 DETECTING WORMS
49 4.3.3 ROOTKITS
– User-mode rootkits
• Alter system utilities or libraries on disk
• Insert code to another user-mode process’s address space to alter its behavior, such as DLL injection
50 4.3.3 ROOTKITS
• Detecting Rootkit
• Two scans of file system (counting files)
• High-level scan using the Windows API
• Raw scan using disk access methods
• Discrepancy reveals presence of rootkit
• Could be defeated by rootkit that intercepts and modifies results of raw scan
operations
Malware 6/15/2021
• Execution emulation
– Run code in isolated emulation environment
– Monitor actions that target file takes
– If the actions are harmful, mark as virus
53
4.3.5 BONTNETS
• Malware can turn a computer in to a zombie, which is a machine that is
controlled externally to perform malicious attacks, usually as a part of a
botnet.
Attack Commands
Botnet:
Attack Actions
Victim
Malware 6/15/2021
QUESTIONS?