NATIONAL ECONOMICS UNIVERSITY
SCHOOL OF INFORMATION TECHNOLOGY AND DIGITAL ECONOMICS
CHAPTER 7: PROTECTION
CHAPTER 7
PROTECTION & SECURITY
1
OUTLINE
¡ Goals of Protection
¡ Principles of Protection
¡ Domain of Protection
¡ Access Matrix
¡ Implementation of Access Matrix
GOALS OF PROTECTION
¡ The most obvious is the need to prevent the mischievous, intentional violation
of an access restriction by a user.
¡ The need to ensure that each program component active in a system uses system
resources only in ways consistent with stated policies
¡ Protection can improve reliability by detecting latent errors at the interfaces
between component subsystems.
¡ Provide a mechanism for the enforcement of the policies governing resource use.
3
PRINCIPLES OF PROTECTION
¡ Guiding principle – principle of least privilege
¡ Programs, users and systems should be given just enough privileges to perform their tasks
¡ Limits damage if entity has a bug, gets abused
¡ Can be static (during life of system, during life of process)
¡ Or dynamic (changed by process as needed) – domain switching, privilege escalation
¡ “Need to know” a similar concept regarding access to data
4
DOMAIN OF PROTECTION
¡ A computer system is a collection of
¡ Processes:
¡ Objects:
¡ Hardware objects (such as the CPU, memory segments, printers, disks, and tape drives)
¡ Software objects (such as files, programs, and semaphores).
¡ Each object has a unique name that differentiates it from all other objects in the system, and each
can be accessed only through well-defined and meaningful operations.
¡ A process should be allowed to access only those resources for which it has authorization.
¡ To facilitate the scheme just described, a process operates within a protection
domain,
5
DOMAIN OF PROTECTION
¡ Each domain defines a set of objects and the types of operations that may be invoked
on each object.
¡ The ability to execute an operation on an object is an access right.
¡ A domain is a collection of access rights, each of which is an ordered pair <object-
name, rights-set>.
¡ For example, if domain D has the access right <file F, {read,write}>, then a process
executing in domain D can both read and write file F. It cannot, however, perform any
other operation on that object.
6
DOMAIN STRUCTURE
¡ Access-right = <object-name, rights-set>
¡ Domain = set of access-rights
¡ Domains may share access rights
¡ The access right <O4, {print}> is shared by D2 and D3, => process executing in either
of these two domains can print object O4.
7
DOMAIN STRUCTURE
¡ A domain can be realized in a variety of ways:
¡ Each user may be a domain. Set of objects that can be accessed depends on the identity of the user.
Domain switching occurs when the user is changed—generally when one user logs out and another
user logs in.
¡ Each process may be a domain. In this case, the set of objects that can be accessed depends on the
identity of the process. Domain switching occurs when one process sends a message to another
process and then waits for a response.
¡ Each procedure may be a domain. In this case, the set of objects that can be accessed corresponds
to the local variables defined within the procedure. Domain switching occurs when a procedure call
is made.
8
DOMAIN IMPLEMENTATION (UNIX)
¡ Domain = user-id
¡ Domain switch accomplished via file system
¡ Each file has associated with it a domain bit (setuid bit)
¡ When file is executed and setuid = on, then user-id is set to owner of the file being executed
¡ When execution completes user-id is reset
¡ Domain switch accomplished via passwords
¡ su command temporarily switches to another user’s domain when other domain’s password provided
¡ Domain switching via commands
¡ sudo command prefix executes specified command in another domain (if original domain has privilege or
password given)
9
DOMAIN IMPLEMENTATION (MULTICS)
¡ Let Di and Dj be any two domain rings
¡ If j < I Þ Di Í Dj
10
ACCESS MATRIX
¡ View protection as a matrix (access matrix)
¡ Rows represent domains
¡ Columns represent objects
¡ Access(i, j) is the set of operations that a process executing in Domaini can
invoke on Objectj
11
USE OF ACCESS MATRIX
¡ If a process in Domain Di tries to do “op” on object Oj, then “op” must be in the access matrix
¡ User who creates object can define access column for that object
¡ Can be expanded to dynamic protection
¡ Operations to add, delete access rights
¡ Special access rights:
¡ owner of Oi
¡ copy op from Oi to Oj (denoted by “*”)
¡ control – Di can modify Dj access rights
¡ transfer – switch from domain Di to Dj
¡ Copy and Owner applicable to an object
¡ Control applicable to domain object
12
ACCESS MATRIX OF FIGURE A WITH DOMAINS AS OBJECTS
13
ACCESS MATRIX WITH COPY RIGHTS
14
ACCESS MATRIX WITH OWNER RIGHTS
15
MODIFIED ACCESS MATRIX OF FIGURE B
16
IMPLEMENTATION OF ACCESS MATRIX
¡ Generally, a sparse matrix
¡ Option 1 – Global table
¡ Store ordered triples <domain, object, rights-set> in table
¡ A requested operation M on object Oj within domain Di -> search table for < Di, Oj, Rk >
¡ with M ∈ Rk
¡ But table could be large -> won’t fit in main memory
¡ Difficult to group objects (consider an object that all domains can read)
17
IMPLEMENTATION OF ACCESS MATRIX (CONT.)
¡ Option 2 – Access lists for objects
¡ Each column implemented as an access list for one object
¡ Resulting per-object list consists of ordered pairs <domain, rights-set> defining all domains
with non-empty set of access rights for the object
¡ Easily extended to contain default set -> If M ∈ default set, also allow access
18
IMPLEMENTATION OF ACCESS MATRIX (CONT.)
¡ Option 3 – Capability list for domains
¡ Instead of object-based, list is domain based
¡ Capability list for domain is list of objects together with operations allows on them
¡ Object represented by its name or address, called a capability
¡ Execute operation M on object Oj, process requests operation and specifies capability as parameter
¡ Possession of capability means access is allowed
¡ Capability list associated with domain but never directly accessible by domain
¡ Rather, protected object, maintained by OS and accessed indirectly
¡ Like a “secure pointer”
¡ Idea can be extended up to applications
19
IMPLEMENTATION OF ACCESS MATRIX (CONT.)
¡ Option 4 – Lock-key
¡ Compromise between access lists and capability lists
¡ Each object has list of unique bit patterns, called locks
¡ Each domain as list of unique bit patterns called keys
¡ Process in a domain can only access object if domain has key that matches one of the locks
20
COMPARISON OF IMPLEMENTATIONS
¡ Many trade-offs to consider
¡ Global table is simple, but can be large
¡ Access lists correspond to needs of users
¡ Determining set of access rights for domain non-localized so difficult
¡ Every access to an object must be checked
¡ Many objects and access rights -> slow
¡ Capability lists useful for localizing information for a given process
¡ But revocation capabilities can be inefficient
¡ Lock-key effective and flexible, keys can be passed freely from domain to domain, easy revocation
21
COMPARISON OF IMPLEMENTATIONS (CONT.)
¡ Most systems use combination of access lists and capabilities
¡ First access to an object -> access list searched
¡ If allowed, capability created and attached to process
¡ Additional accesses need not be checked
¡ After last access, capability destroyed
¡ Consider file system with ACLs per file
22
SECURITY
OBJECTS
¡ The Security Problem
¡ Program Threats
¡ System and Network Threats
¡ Cryptography as a Security Tool
¡ User Authentication
¡ Implementing Security Defenses
THE SECURITY PROBLEM
¡ System secure if resources used and accessed as intended under all circumstances
¡ Total security cannot be achieved
¡ Nonetheless, we must have mechanisms to make security breaches a rare
occurrence, rather than the norm
¡ Intruders (crackers) attempt to breach security
¡ Threat is potential security violation, such as the discovery of a vulnerability
¡ Attack is attempt to breach security
¡ Attack can be accidental or malicious
¡ Easier to protect against accidental than malicious misuse
FORMS OF ACCIDENTAL AND MALICIOUS SECURITY VIOLATIONS
¡ Breach of confidentiality
¡ Unauthorized reading of data
¡ Breach of integrity
¡ Unauthorized modification of data
¡ Breach of availability
¡ Unauthorized destruction of data
¡ Theft of service
¡ Unauthorized use of resources
¡ Denial of service (DOS)
¡ Prevention of legitimate use
SECURITY VIOLATION METHODS
¡ Masquerading (breach authentication)
¡ Pretending to be an authorized user to escalate privileges
¡ Replay attack
¡ As is or with message modification
¡ Man-in-the-middle attack
¡ Intruder sits in data flow, masquerading as sender to receiver and vice versa
¡ Session hijacking
¡ Intercept an already-established session to bypass authentication
STANDARD SECURITY ATTACKS
SECURITY MEASURE LEVELS
¡ Impossible to have absolute security, but make cost to perpetrator sufficiently high to deter most intruders
¡ Security must occur at four levels to be effective:
¡ Physical
¡ Data centers, servers, connected terminals
¡ Human
¡ Avoid social engineering: phishing, dumpster diving, shoulder surfing
¡ Operating System
¡ The system must protect itself from accidental or purposeful security breaches
¡ Network
¡ Intercepted communications, interruption, DoS
¡ Security is as weak as the weakest link in the chain
PHISHING
30
NO TECH HACKING
31
PROGRAM THREATS
¡ Many variations, many names
¡ Trojan Horse
¡ Code segment that misuses its environment
¡ Exploits mechanisms for allowing programs written by users to be executed by other users
¡ Login Program, Spyware, pop-up browser windows, covert channels
¡ Up to 90% of spam delivered by spyware-infected systems
¡ Trap Door
¡ Specific user identifier or password that circumvents normal security procedures
¡ Could be included in a compiler
¡ How to detect them?
PROGRAM THREATS (CONT.)
¡ Logic Bomb
¡ Program that initiates a security incident under certain circumstances
¡ Stack and Buffer Overflow
¡ Exploits a bug in a program (overflow either the stack or memory buffers)
¡ Failure to check bounds on inputs, arguments
¡ Write past arguments on the stack into the return address on stack
¡ When routine returns from call, returns to hacked address
¡ Pointed to code loaded onto stack that executes malicious code
¡ Unauthorized user or privilege escalation
C PROGRAM WITH BUFFER-OVERFLOW CONDITION
#include <stdio.h>
#define BUFFER SIZE 256
int main(int argc, char *argv[])
{
char buffer[BUFFER SIZE];
if (argc < 2)
return -1;
else {
strcpy(buffer,argv[1]);
return 0;
}
}
LAYOUT OF TYPICAL STACK FRAME
HYPOTHETICAL STACK FRAME
Before attack After attack
PROGRAM THREATS (CONT.)
¡ Viruses
¡ Code fragment embedded in legitimate program
¡ Self-replicating, designed to infect other computers
¡ Very specific to CPU architecture, operating system, applications
¡ Usually borne via email or as a macro
¡ Visual Basic Macro to reformat hard drive
Sub AutoOpen()
Dim oFS
Set oFS = CreateObject(’’Scripting.FileSystemObject’’)
vs = Shell(’’c:command.com /k format c:’’,vbHide)
End Sub
PROGRAM THREATS (CONT.)
¡ Many categories of viruses, literally many thousands of viruses
¡ File / parasitic
¡ Boot / memory
¡ Macro
¡ Source code
¡ Polymorphic
¡ Encrypted
¡ Stealth
¡ Tunneling
¡ Multipartite
¡ Armored
A BOOT-SECTOR COMPUTER VIRUS
THE THREAT CONTINUES
¡ Attacks still common, still occurring
¡ Attacks moved over time from science experiments to tools of organized crime
¡ Targeting specific companies
¡ Creating botnets to use as tool for spam and DDOS delivery
¡ Keystroke logger to grab passwords, credit card numbers
¡ Why is Windows the target for most attacks?
¡ Most common
¡ Everyone is an administrator
¡ Licensing required?
SYSTEM AND NETWORK THREATS
¡ Some systems “open” rather than secure by default
¡ Reduce attack surface
¡ But harder to use, more knowledge needed to administer
¡ Network threats harder to detect, prevent
¡ Protection systems weaker
¡ More difficult to have a shared secret on which to base access
¡ No physical limits once system attached to internet
¡ Or on network with system attached to internet
¡ Even determining location of connecting system difficult
¡ IP address is only knowledge
SYSTEM AND NETWORK THREATS (CONT.)
¡ Worms – use spawn mechanism; standalone program
¡ Internet worm
¡ Exploited UNIX networking features (remote access) and bugs in finger and sendmail programs
¡ Exploited trust-relationship mechanism used by rsh to access friendly systems without use of
password
¡ Grappling hook program uploaded main worm program
¡ 99 lines of C code
¡ Hooked system then uploaded main code, tried to attack connected systems
¡ Also tried to break into other users accounts on local system via password guessing
¡ If target system already infected, abort, except for every 7th time
THE MORRIS INTERNET WORM
SYSTEM AND NETWORK THREATS (CONT.)
¡ Port scanning
¡ Automated attempt to connect to a range of ports on one or a range of IP addresses
¡ Detection of answering service protocol
¡ Detection of OS and version running on system
¡ nmap scans all ports in a given IP range for a response
¡ nessus has a database of protocols and bugs (and exploits) to apply against a system
¡ Frequently launched from zombie systems
¡ To decrease trace-ability
SYSTEM AND NETWORK THREATS (CONT.)
¡ Denial of Service
¡ Overload the targeted computer preventing it from doing any useful work
¡ Distributed denial-of-service (DDOS) come from multiple sites at once
¡ Consider the start of the IP-connection handshake (SYN)
¡ How many started-connections can the OS handle?
¡ Consider traffic to a web site
¡ How can you tell the difference between being a target and being really popular?
¡ Accidental – CS students writing bad fork() code
¡ Purposeful – extortion, punishment
SOBIG.F WORM
¡ More modern example
¡ Disguised as a photo uploaded to adult newsgroup via account created with stolen credit card
¡ Targeted Windows systems
¡ Had own SMTP engine to mail itself as attachment to everyone in infect system’s address
book
¡ Disguised with innocuous subject lines, looking like it came from someone known
¡ Attachment was executable program that created WINPPR23.EXE in default Windows
system directory
Plus the Windows Registry
[HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"TrayX" = %windir%\winppr32.exe /sinc
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"TrayX" = %windir%\winppr32.exe /sinc
CRYPTOGRAPHY
¡ Means to constrain potential senders (sources) and / or receivers (destinations) of
messages
¡ Based on secrets (keys)
¡ Enables
¡ Confirmation of source
¡ Receipt only by certain destination
¡ Trust relationship between sender and receiver
ENCRYPTION
¡ Constrains the set of possible receivers of a message
¡ Encryption algorithm consists of
¡ Set K of keys
¡ Set M of Messages
¡ Set C of ciphertexts (encrypted messages)
¡ A function E : K → (M→C). That is, for each k Î K, Ek is a function for generating ciphertexts from
messages
¡ Both E and Ek for any k should be efficiently computable functions
¡ A function D : K → (C → M). That is, for each k Î K, Dk is a function for generating messages from
ciphertexts
¡ Both D and Dk for any k should be efficiently computable functions
ENCRYPTION (CONT.)
¡ An encryption algorithm must provide this essential property: Given a ciphertext c
C, a computer can compute m such that Ek(m) = c only if it possesses k
¡ Thus, a computer holding k can decrypt ciphertexts to the plaintexts used to produce them, but a
computer not holding k cannot decrypt ciphertexts
¡ Since ciphertexts are generally exposed (for example, sent on the network), it is important that it be
infeasible to derive k from the ciphertexts
49
SYMMETRIC ENCRYPTION
¡ Same key used to encrypt and decrypt
¡ Therefore k must be kept secret
¡ DES was most commonly used symmetric block-encryption algorithm (created by US Govt)
¡ Encrypts a block of data at a time
¡ Keys too short so now considered insecure
¡ Triple-DES considered more secure
¡ Algorithm used 3 times using 2 or 3 keys
¡ For example
¡ 2001 NIST adopted new block cipher - Advanced Encryption Standard (AES)
¡ Keys of 128, 192, or 256 bits, works on 128 bit blocks
¡ RC4 is most common symmetric stream cipher, but known to have vulnerabilities
¡ Encrypts/decrypts a stream of bytes (i.e., wireless transmission)
¡ Key is a input to pseudo-random-bit generator
¡ Generates an infinite keystream
SECURE COMMUNICATION OVER INSECURE MEDIUM
ASYMMETRIC ENCRYPTION
¡ Public-key encryption based on each user having two keys:
¡ public key – published key used to encrypt data
¡ private key – key known only to individual user used to decrypt data
¡ Must be an encryption scheme that can be made public without making it easy to
figure out the decryption scheme
¡ Most common is RSA block cipher
¡ Efficient algorithm for testing whether or not a number is prime
¡ No efficient algorithm is know for finding the prime factors of a number
ASYMMETRIC ENCRYPTION (CONT.)
¡ Formally, it is computationally infeasible to derive kd,N from ke,N, and so ke need not be
kept secret and can be widely disseminated
¡ ke is the public key
¡ kd is the private key
¡ N is the product of two large, randomly chosen prime numbers p and q (for example, p and q are
512 bits each)
¡ Encryption algorithm is Eke,N(m) = mke mod N, where ke satisfies kekd mod (p−1)(q −1) = 1
¡ The decryption algorithm is then Dkd,N(c) = ckd mod N
ASYMMETRIC ENCRYPTION EXAMPLE
¡ For example. make p = 7and q = 13
¡ We then calculate N = 7∗13 = 91 and (p−1)(q−1) = 72
¡ We next select ke relatively prime to 72 and< 72, yielding 5
¡ Finally, we calculate kd such that kekd mod 72 = 1, yielding 29
¡ We how have our keys
¡ Public key, ke,N = 5, 91
¡ Private key, kd,N = 29, 91
¡ Encrypting the message 69 with the public key results in the cyphertext 62
¡ Cyphertext can be decoded with the private key
¡ Public key can be distributed in cleartext to anyone who wants to communicate with holder of public key
ENCRYPTION USING RSA ASYMMETRIC CRYPTOGRAPHY
CRYPTOGRAPHY (CONT.)
¡ Note symmetric cryptography based on transformations, asymmetric based on
mathematical functions
¡ Asymmetric much more compute intensive
¡ Typically not used for bulk data encryption
AUTHENTICATION
¡ Constraining set of potential senders of a message
¡ Complementary to encryption
¡ Also can prove message unmodified
¡ Algorithm components
¡ A set K of keys
¡ A set M of messages
¡ A set A of authenticators
¡ A function S : K → (M→ A)
¡ That is, for each k Î K, Sk is a function for generating authenticators from messages
¡ Both S and Sk for any k should be efficiently computable functions
¡ A function V : K → (M × A→ {true, false}). That is, for each k Î K, Vk is a function for verifying authenticators on messages
¡ Both V and Vk for any k should be efficiently computable functions
AUTHENTICATION (CONT.)
¡ For a message m, a computer can generate an authenticator a Î A such that Vk(m, a) = true only if it
possesses k
¡ Thus, computer holding k can generate authenticators on messages so that any other computer
possessing k can verify them
¡ Computer not holding k cannot generate authenticators on messages that can be verified using Vk
¡ Since authenticators are generally exposed (for example, they are sent on the network with the
messages themselves), it must not be feasible to derive k from the authenticators
¡ Practically, if Vk(m,a) = true then we know m has not been modified and that send of message has k
¡ If we share k with only one entity, know where the message originated
AUTHENTICATION – HASH FUNCTIONS
¡ Basis of authentication
¡ Creates small, fixed-size block of data message digest (hash value) from m
¡ Hash Function H must be collision resistant on m
¡ Must be infeasible to find an m’ ≠ m such that H(m) = H(m’)
¡ If H(m) = H(m’), then m = m’
¡ The message has not been modified
¡ Common message-digest functions include MD5, which produces a 128-bit hash, and SHA-1,
which outputs a 160-bit hash
¡ Not useful as authenticators
¡ For example H(m) can be sent with a message
¡ But if H is known someone could modify m to m’ and recompute H(m’) and modification not detected
¡ So must authenticate H(m)
AUTHENTICATION – DIGITAL SIGNATURE
¡ Based on asymmetric keys and digital signature algorithm
¡ Authenticators produced are digital signatures
¡ Very useful – anyone can verify authenticity of a message
¡ In a digital-signature algorithm, computationally infeasible to derive ks from kv
¡ V is a one-way function
¡ Thus, kv is the public key and ks is the private key
¡ Consider the RSA digital-signature algorithm
¡ Similar to the RSA encryption algorithm, but the key use is reversed
¡ Digital signature of message Sks (m) = H(m)ks mod N
¡ The key ks again is a pair (d, N), where N is the product of two large, randomly chosen prime numbers p and q
¡ Verification algorithm is Vkv(m, a) (akv mod N = H(m))
¡ Where kv satisfies kvks mod (p − 1)(q − 1) = 1
AUTHENTICATION (CONT.)
¡ Why authentication if a subset of encryption?
¡ Fewer computations (except for RSA digital signatures)
¡ Authenticator usually shorter than message
¡ Sometimes want authentication but not confidentiality
¡ Signed patches et al
¡ Can be basis for non-repudiation
MAN-IN-THE-MIDDLE ATTACK ON ASYMMETRIC CRYPTOGRAPHY
USER AUTHENTICATION
¡ Crucial to identify user correctly, as protection systems depend on user ID
¡ User identity most often established through passwords, can be considered a special case of either keys or capabilities
¡ Passwords must be kept secret
¡ Frequent change of passwords
¡ History to avoid repeats
¡ Use of “non-guessable” passwords
¡ Log all invalid access attempts (but not the passwords themselves)
¡ Unauthorized transfer
¡ Passwords may also either be encrypted or allowed to be used only once
¡ Does encrypting passwords solve the exposure problem?
¡ Might solve sniffing
¡ Consider shoulder surfing
¡ Consider Trojan horse keystroke logger
¡ How are passwords stored at authenticating site?
PASSWORDS
¡ Encrypt to avoid having to keep secret
¡ But keep secret anyway (i.e. Unix uses superuser-only readably file /etc/shadow)
¡ Use algorithm easy to compute but difficult to invert
¡ Only encrypted password stored, never decrypted
¡ Add “salt” to avoid the same password being encrypted to the same value
¡ One-time passwords
¡ Use a function based on a seed to compute a password, both user and computer
¡ Hardware device / calculator / key fob to generate the password
¡ Changes very frequently
¡ Biometrics
¡ Some physical attribute (fingerprint, hand scan)
¡ Multi-factor authentication
¡ Need two or more factors for authentication
¡ i.e. USB “dongle”, biometric measure, and password