chapter 10 security and encryption

30
Chapter 10 Security and Encryption

Upload: signa

Post on 13-Feb-2016

52 views

Category:

Documents


0 download

DESCRIPTION

Chapter 10 Security and Encryption. Objectives. Explain the nature of a threat model Be able to construct a threat model Be aware of common threats to web applications and how to prevent attacks Explain the principles for developing a secure web application. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 10 Security and Encryption

Chapter 10Security and Encryption

Page 2: Chapter 10 Security and Encryption

Objectives

• Explain the nature of a threat model• Be able to construct a threat model• Be aware of common threats to web

applications and how to prevent attacks• Explain the principles for developing a

secure web application

Page 3: Chapter 10 Security and Encryption

Security Characteristicsfor Computer Systems

• Confidentiality: data and communication are private

• Integrity: data are free of tampering and damage• Availability: an application can be used when it is

needed• Authentication: each party to a transaction can

be reliably identified• Authorization: each user is given only

appropriate privileges• Accountability: each user is bound to his/her

actions (cannot repudiate them)

Page 4: Chapter 10 Security and Encryption

Threat Modeling – Definitions

• Threat: a potential misuse of an application (event) that will cause harm if it does occur

• Attack: an actual attempt to misuse an application

• Vulnerability: a flaw within an application that enables an attack to succeed

Page 5: Chapter 10 Security and Encryption

Building a Threat Model

• A complete threat model includes a list of threats, including for each:– Threat description– Attacker profile (skill, resources, motivation)– Means of attack– Likely damage if the attack succeeds

Page 6: Chapter 10 Security and Encryption

Threat Model ComponentOnline Ticketing System

• Threat: Attacker gains root control of system• Possible methods: Buffer overflow attack• Objectives: Gain root authority, enabling attacker to run

arbitrary commands• Attacker (goal, experience, resources): Attacker is a

professional criminal, seeking to gain financially from theft of tickets or to cause financial harm to company. Attacker may have access to a botnet, and information about recently discovered vulnerabilities.

• Likely harm: Attacker steals tickets, causing financial loss to the system, or attacker compromises the system, causing down-time and ultimate loss of business.

Page 7: Chapter 10 Security and Encryption

Common Attacks on Web Applications

• Buffer Overflow• Cross-Site Scripting• Denial of Service• Insider Misuse• Password Guessing• Sniffing• Spoofing• SQL Injection

Page 8: Chapter 10 Security and Encryption

Buffer Overflow

• Buffer: a memory allocation intended to hold input or output

• Buffer overflow: input is too large; excess input overflows into subsequent memory

• If the overflow areacontains instructions,the attacker can effectively take controlof the application byrewriting critical parts

Page 9: Chapter 10 Security and Encryption

Protection against Buffer Overflow

1. Use safe languages (Java, C#, etc.) that do not allow buffer overflow

• (C++ is the WORST choice)

2. If the language allows overflows, check each buffer operation against size limits.

Page 10: Chapter 10 Security and Encryption

Cross-Site Scripting (XSS)

• The attacker embeds malicious HTML code in a public website

• The victim (another user) clicks on a link in that code, causing the victim's cookie to be sent to the attacker's website

• The attacker then uses the victims cookie to misuse the victim's open session – improper transaction, theft of information,etc.

Page 11: Chapter 10 Security and Encryption

Attacker'sserver

Cross-Site Scripting

ApplicationWebsite

(e-commerce,bank, etc.)

attacker

victim

1. embed malicious HTML

2a. click on malicious link

2b. send victim'scookie (as a resultof clicking the link)

3. misusevictim's session

Page 12: Chapter 10 Security and Encryption

Protection Against XSS

• Any text posted by users (comments, reviews, etc.), must be filtered

• Only legal characters should be allowed; delimiters in particular should not be allowed

• All illigeal characters should be deleted or replaced by escape characters– for example, replace < and > by &lt; and &gt;

Page 13: Chapter 10 Security and Encryption

Denial of Service

• The attacker bombards the victim's server with spurious internet traffic, so that it is unable to carry out normal operations

bot

bot

bot

Attacker'sbotnet ServerIP Traffic

legitimateuser

Page 14: Chapter 10 Security and Encryption

Protection Against DOS Attack

• Use multiple internet portals, from different vendors

• Use a firewall to filter suspicious IP traffic

Page 15: Chapter 10 Security and Encryption

Insider Misuse

• Corporate insiders are the source of many attacks, including– theft– espionage– sabotage (revenge)

• Security mechanisms are often directed at external attackers only, leaving the door open to inside attacks

Page 16: Chapter 10 Security and Encryption

Protection Against Insider Misuse

• A so-called "demilitarized zone" protects the application with firewalls from both outside and inside attack

• Insiders are restricted to authorized and monitored access only

Page 17: Chapter 10 Security and Encryption

Password Guessing

• People often create passwords from familiar words, dates, names, etc.

• Password guessing uses combinations of these in repeated attempts to login

• Account-ids may be guessed also, or may be derived from scanning other sources (e.g., email addresses)

Page 18: Chapter 10 Security and Encryption

Protection Against Password Guessing

• Insist on strong passwords– include digits, special symbols

• Delay response for a few seconds after a failed login, to slow down guessing

• Lock the user's account for a short period after repeated failed attempts – e.g., 1-hour lock after five consecutive failed

attempts

Page 19: Chapter 10 Security and Encryption

Sniffing

• Internet traffic also passes through local networks, where it can be monitored

• Sensitive information that is transmitted in plain text (unencrypted) can be read by other parties on a local network or at an intermediate internet hub

InternetGateway

Internet

Workstation local area network

Page 20: Chapter 10 Security and Encryption

Protection against Sniffing

• Use HTTPS for any transactions containing sensitive information– login credentials– financial information– personal information– etc.

Page 21: Chapter 10 Security and Encryption

Spoofing

• The attacker creates a phony website that spoofs a real website (bank, etc.)

• Victims are tricked into logging in to the phony site

• The attacker uses stolen credentials to access victims' accounts

• With real-timespoofing, theattacker's websitecommunicateswith thespoofed website

Page 22: Chapter 10 Security and Encryption

Protection Against Spoofing

• Educate users never to click on emailed hyperlinks, and to use their own bookmarks or a typed URL instead

• Use a challenge-response test to verify user identify – (doesn't help with real-time spoofing)

Page 23: Chapter 10 Security and Encryption

SQL Injection

• Attacker inserts SQL into an input field• The application embeds the inserted

syntax into its own SQL commands• The attackers SQL is executed

xyzUserid:

Password: 1' OR 'x'='x

String sqlCommand = "SELECT user FROM users" + "WHERE userid = ' " + userid_in + " AND password = ' " + password_in;

Resulting SQL Command: SELECT user FROM users WHERE userid = 'xyz' AND password = '1' OR 'x' = 'x'

Always TRUE!

Page 24: Chapter 10 Security and Encryption

Protection Against SQL Injection

• Filter input when received• Allow only legal characters

• For example,boolean validPassword =

Pattern.matches("[a-zA-Z0-9~!@#$%^&*]+);if (! validPassword) { … reject login attempt …} Java regular expression

defininglegal password characters

Page 25: Chapter 10 Security and Encryption

Secure HTTP (HTTPS)

• HTTPS uses Transport Layer Security (TLS) to encrypt the contents of an HTTP transaction– TLS goes between HTTP and IP– TLS is similar to Secure Sockets Layer (SSL)

HTTP

TLS

TCP

IP

Page 26: Chapter 10 Security and Encryption

Transport Layer Security (TLS)

• TLS includes authentication through certificate exchange, and encryption using a negotiated secret key

Page 27: Chapter 10 Security and Encryption

HTTP Authentication

• The web server sets up security realms, and authenticates users when a realm is first accessed (within a session)

• Authentication is via a standard form:

Page 28: Chapter 10 Security and Encryption

HTTP Authentication

• HTTP Authentication uses no encryption, so it is not a substitute for HTTPS/TLS

• HTTP Authentication is OK for low-security needs, such as keeping random browsers or web crawlers out of a private area

• It is not acceptable for applications that require real privacy, however!

Page 29: Chapter 10 Security and Encryption

Principles for Secure Design

1. Develop a realistic threat model – know the potential attackers

2. Follow a reliable design pattern, such as MVC3. Limit user capabilities to only what is needed

(least privilege)4. Require and enforce authorization

(don't allow users to sneak past login pages!)5. Require and enforce HTTPS access for secure

resources

Page 30: Chapter 10 Security and Encryption

Review

• Threat Model• Common Threats• Principles for Secure Design