CS 155 Final Exam. CS 155: Spring 2015 June 5, 2015

Similar documents
CS 155 Final Exam. CS 155: Spring 2013 June 11, 2013

Firewalls. Firewalls. Idea: separate local network from the Internet 2/24/15. Intranet DMZ. Trusted hosts and networks. Firewall.

Firewalls. configuring a sophisticated GNU/Linux firewall involves understanding

Session Hijacking Exploiting TCP, UDP and HTTP Sessions

CS5008: Internet Computing

Overview. Securing TCP/IP. Introduction to TCP/IP (cont d) Introduction to TCP/IP

CS 356 Lecture 27 Internet Security Protocols. Spring 2013

Solution of Exercise Sheet 5

Firewalls, NAT and Intrusion Detection and Prevention Systems (IDS)

20-CS X Network Security Spring, An Introduction To. Network Security. Week 1. January 7

CSE331: Introduction to Networks and Security. Lecture 12 Fall 2006

What is a Firewall? A choke point of control and monitoring Interconnects networks with differing trust Imposes restrictions on network services

Chapter 8 Security Pt 2

SOFTWARE ENGINEERING 4C03. Computer Networks & Computer Security. Network Firewall

CS 665: Computer System Security. Network Security. Usage environment. Sources of vulnerabilities. Information Assurance Module

FIREWALLS. Firewall: isolates organization s internal net from larger Internet, allowing some packets to pass, blocking others

First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring

IPsec Details 1 / 43. IPsec Details

Chapter 8 Network Security

Firewalls and Intrusion Detection

Firewalls, IDS and IPS

We will give some overview of firewalls. Figure 1 explains the position of a firewall. Figure 1: A Firewall

Midterm. Name: Andrew user id:

CPS221 Lecture: Layered Network Architecture

Security: Attack and Defense

Cryptography and network security

How do I get to


TCP/IP Security Problems. History that still teaches

Networks: IP and TCP. Internet Protocol

A host-based firewall can be used in addition to a network-based firewall to provide multiple layers of protection.

CS 155 Final Exam. 1. (21 points)... Short Answer. CS 155: Spring 2006 June 2006

Linux Network Security

Overview of Network Security The need for network security Desirable security properties Common vulnerabilities Security policy designs

Network Security - ISA 656 Application Firewalls

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

Protocol Rollback and Network Security

ΕΠΛ 674: Εργαστήριο 5 Firewalls

CSE 4482 Computer Security Management: Assessment and Forensics. Protection Mechanisms: Firewalls

Insecure network services

Summary of the SEED Labs For Authors and Publishers

Final exam review, Fall 2005 FSU (CIS-5357) Network Security

Collax Mail Server. Howto. This howto describes the setup of a Collax server as mail server.

Outline. CSc 466/566. Computer Security. 18 : Network Security Introduction. Network Topology. Network Topology. Christian Collberg

True False questions (25 points + 5 points extra credit)

Course Overview: Learn the essential skills needed to set up, configure, support, and troubleshoot your TCP/IP-based network.

Learn Ethical Hacking, Become a Pentester

12/8/2015. Review. Final Exam. Network Basics. Network Basics. Network Basics. Network Basics. 12/10/2015 Thursday 5:30~6:30pm Science S-3-028

Firewalls. Basic Firewall Concept. Why firewalls? Firewall goals. Two Separable Topics. Firewall Design & Architecture Issues

How To Protect Your Network From Attack From Outside From Inside And Outside

Web application security

SSL A discussion of the Secure Socket Layer

Stateful Firewalls. Hank and Foo

Architecture. The DMZ is a portion of a network that separates a purely internal network from an external network.

Networking Test 4 Study Guide

The OSI model has seven layers. The principles that were applied to arrive at the seven layers can be briefly summarized as follows:

Intro to Firewalls. Summary

1 hours, 30 minutes, 38 seconds Heavy scan. All scanned network resources. Copyright 2001, FTP access obtained

OLD VULNERABILITIES IN NEW PROTOCOLS? HEADACHES ABOUT IPV6 FRAGMENTS

Advanced Computer Networks. Layer-7-Switching and Loadbalancing

CS155 - Firewalls. Simon Cooper <sc@sgi.com> CS155 Firewalls 22 May 2003

Computer Security CS 426 Lecture 36. CS426 Fall 2010/Lecture 36 1

Network Intrusion Detection Systems. Beyond packet filtering

Proxy Server, Network Address Translator, Firewall. Proxy Server

Classification of Firewalls and Proxies

ΕΠΛ 475: Εργαστήριο 9 Firewalls Τοίχοι πυρασφάλειας. University of Cyprus Department of Computer Science

Network Security. Chapter 9. Attack prevention, detection and response. Attack Prevention. Part I: Attack Prevention

3. Broken Account and Session Management. 4. Cross-Site Scripting (XSS) Flaws. Web browsers execute code sent from websites. Account Management

Note! The problem set consists of two parts: Part I: The problem specifications pages Part II: The answer pages

TCP/IP and the Internet

Technical Support Information Belkin internal use only

CYBER ATTACKS EXPLAINED: PACKET CRAFTING

OS/390 Firewall Technology Overview

A Server and Browser-Transparent CSRF Defense for Web 2.0 Applications. Slides by Connor Schnaith

INTRODUCTION TO FIREWALL SECURITY

Network Security. Chapter 3. Cornelius Diekmann. Version: October 21, Lehrstuhl für Netzarchitekturen und Netzdienste Institut für Informatik

Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme. Firewall

A Very Incomplete Diagram of Network Attacks

Linux MPS Firewall Supplement

Network Security. Mobin Javed. October 5, 2011

Final for ECE374 05/06/13 Solution!!

FIREWALLS & NETWORK SECURITY with Intrusion Detection and VPNs, 2 nd ed. Chapter 5 Firewall Planning and Design

CMPT 471 Networking II

What is Web Security? Motivation

21.4 Network Address Translation (NAT) NAT concept

Criteria for web application security check. Version

Content Distribution Networks (CDN)

RARP: Reverse Address Resolution Protocol

Workday Mobile Security FAQ

Firewalls. Pehr Söderman KTH-CSC

Measurement of the Usage of Several Secure Internet Protocols from Internet Traces

Transport Layer Protocols

Objectives of Lecture. Network Architecture. Protocols. Contents

Where every interaction matters.

Insecure network services. Firewalls. Two separable topics. Packet filtering. Example: blocking forgeries. Example: blocking outgoing mail

Client Server Registration Protocol

Chapter 3: Review of Important Networking Concepts. Magda El Zarki Dept. of CS UC Irvine

Networking Basics and Network Security

Transcription:

CS 155: Spring 2015 June 5, 2015 CS 155 Final Exam This exam is open book and open notes. You may use course notes and documents that you have stored on a laptop, but you may NOT use the network connection on your laptop in any way, especially not to search the web or communicate with a friend. You have 2 hours. Print your name legibly and sign and abide by the honor code written below. All of the intended answers may be written in the space provided. You may use the back of a page for scratch work. If you use the back side of a page to write part of your answer, be sure to mark your answer clearly. The following is a statement of the Stanford University Honor Code: A. The Honor Code is an undertaking of the students, individually and collectively: (1) that they will not give or receive aid in examinations; that they will not give or receive unpermitted aid in class work, in the preparation of reports, or in any other work that is to be used by the instructor as the basis of grading; (2) that they will do their share and take an active part in seeing to it that others as well as themselves uphold the spirit and letter of the Honor Code. B. The faculty on its part manifests its confidence in the honor of its students by refraining from proctoring examinations and from taking unusual and unreasonable precautions to prevent the forms of dishonesty mentioned above. The faculty will also avoid, as far as practicable, academic procedures that create temptations to violate the Honor Code. C. While the faculty alone has the right and obligation to set academic requirements, the students and faculty will work together to establish optimal conditions for honorable academic work. I acknowledge and accept the Honor Code. (Signature) (SUNet ID) (Print your name, legibly!) GRADUATING? Score Prob # 1 # 2 # 3 # 4 # 5 # 6 # 7 Total Max 11 20 11 12 10 10 12 86

1. (11 points)......................................................... True or False (a) Control hijacking attacks can give an attacker shell access to a vulnerable system. (b) ASLR is designed to make it harder to mount XSS attacks. (c) System call interposition is a method to speed up the processing of system calls in modern operating systems. (d) The Same Origin Policy used for the DOM is the same as the Same Origin Policy applied to cookies. (e) A CSRF vulnerability at a bank has the following consequence: a malicious web site can issue requests to the bank on behalf of users visiting the malicious web site. (f) A collision resistant hash function is a hash function designed to prevent collisions in self-driving cars. (g) The TLS session setup protocol uses only symmetric-key cryptography. (h) Pinning the gmail.com certificate in the browser is done so that an attacker who obtains a certificate for gmail.com cannot masquerade as the Gmail server. (i) Small sites can defend themselves against SYN floods by hiding behind a large 3rd party proxy service that only forwards completed TCP connections to the site. (j) The principle of least privilege says that each system component needs to be given the privileges it needs to do its job, but nothing more. (k) Suppose an attacker injects a spurious BGP route that affects traffic from a bank site in the US to a browser located elsewhere (but not in the reverse direction). The attacker can use the route to read a cleartext HTTP response from the bank to the browser even if the response is sent over HTTPS from the bank to that browser. 2

2. (20 points)............. Questions From All Over With a Short Answer (a) (4 points) Briefly explain the purpose of ASLR. (b) (4 points) Briefly explain why HSTS prevents ssl strip attacks. (c) (4 points) Suppose a web page /site.com/index.php contains the following PHP script: <?php echo "Hello ".$_GET["name"];?> What vulnerability does this cause? Give an example exploit URL (do not URL encode your example). 3

(d) (4 points) On some laptops, a USB device plugged into the USB port can write to any physical memory location using Direct Memory Access (DMA). Explain why this is a security risk. What attacks are possible? (e) (4 points) It is possible to download an employee s W-2 tax form using the employee s 9-digit social security number and an 8-digit PIN assigned by the employer. (This is really true.) Assume that each employer assigns PINs truly at random. One of the sites providing this service has a security page that says, This site has security measures in place to protect against the loss, misuse or alteration of the information under our control. Our site make extensive use of Secure Sockets Layer (SSL) encryption... In addition, we take great care to safeguard all information that is transmitted to us and stored by us on our computers, servers, and databases. This protection includes the use of network intrusion prevention and detection technology as well as other industry accepted security practices. We protect the physical location of our systems through the use of access control and monitoring technologies... Question: How secure is your W-2 form? What is the simplest attack enabling an attacker to obtain your W-2 form, assuming he knows your social security number but not your PIN? How would you defend against the attack you propose? 4

3. (11 points).................................................. Control flow guard (a) (3 points) Suppose a function pointer fp is allocated on the stack. Explain how a stack buffer overflow can let an attacker mount a return-oriented-programming (ROP) attack despite the presence of stack canaries and DEP. Make sure the attack you describe is an ROP attack. Throughout this question you may assume that ASLR is not used. (b) (4 points) Windows 10 introduces a mechanism called control flow guard (CFG). CFG embeds a bitmap in the executable file that contains one bit for every eight bytes of executable code. The bit is set to 1 if the corresponding eight bytes of code contain the entry point to a function and is set to 0 otherwise. Before a function pointer fp is called, the program code checks that the address stored in fp corresponds to a bit in the CFG bitmap that is set to 1. If not, the program is terminated. Does this check prevent your attack from part (a)? If so explain why. If not explain why not. (c) (4 points) Does CFG ensure that in the example from part (a) control flow always proceeds to where the program intended? That is, can an attacker cause the program to jump to the wrong location without being terminated? If so, please provide example pseudo-code where this could lead to an attack. If not, explain why not. 5

4. (12 points).......................... Packet fragmentation and firewalls The IP protocol supports fragmentation, which allows a packet to be broken into smaller fragments as needed and re-assembled when the fragments reach their destination. When a packet is fragmented it is assigned a 16-bit packet ID; each fragment is identified by its offset within the original packet. The fragments travel to the destination as separate packets. At the destination they are grouped by their packet ID and assembled into a complete packet using the packet offset of each fragment. The IP packet format is often drawn with 32 bits per line: Version IP HL TOS Total length Identification Flags Fragment offset TTL Protocol Header Checksum Source Address Destination Address Options Data Pad The Identification field is 16 bits and is a value assigned by the sender of an IP datagram to aid in reassembling the fragments of a datagram. The Protocol field specifies the nextlayer protocol (e.g., TCP, UDP, ICMP) and is byte 9 if we start the packet with byte 0. The fragment offset is 13 bits and indicates where a fragment belongs in the original IP datagram. This value is a multiple of eight. In the flags field of the IP header, bit 1 is the DF bit (0 = may fragment, 1 = don t fragment ). Bit 2 is the MF bit (0 = last fragment, 1 = more fragments ). If this is a TCP packet, for example, then the TCP header is contained in the portion of the packet shown here as Data. A specification saying which higher level protocol (e.g., HTTP, SMTP) is used is also in the Data portion of the IP format. (a) (4 points) Suppose you want to install a stateless packet filter and block incoming SMTP packets but allow HTTP packets. Why is fragmenting a problem? 6

(b) (4 points) Suppose you are building a possibly stateful or application layer filtering engine. Your goals include: (i) block incoming SMTP traffic, but (ii) allow HTTP traffic. We noted in class that when fragments with overlapping segments are reassembled at the destination, the results can vary from OS to OS. One OS may use the data from the last received fragment for the overlapping segment while another OS may use the data in the first fragment received. Give an example of how overlapping fragments can cause the filtering engine to incorrectly allow some SMTP traffic through. (c) (4 points) How should your filtering engine designed to meet the requirements stated in the part (b) handle overlapping fragments? 7

5. (10 points).............................. The.bank Top Level DNS Domain The.bank top-level-domain (TLD) is scheduled to open to the general public in 2015. This top level domain is only open to verified bank organizations, through a process supported by the American Bankers Association (ABA) and BITS, the technology policy arm of the Financial Services Roundtable. Under this new plan, Wells Fargo Bank could be assigned wellsfargo.bank and use this in place of wellsfargo.com. Financial institutions that use the.bank TLD will be required to adhere to a list of requirements, including: (i) Domain names will not be activated or resolve in the.bank DNS unless they match the trade name of a bank that registers them and are not deemed to be deceptive or confusing. (ii) DNSSEC must be deployed at each zone and subsequent sub-zones for domains that resolve in the.bank DNS. (iii) DNS Resource Records (e.g., CNAME, DNAME, SRV) are prohibited from aliasing to DNS records outside of the secure zone. This question asks you to understand and explain some of the reasons for these.bank requirements. (a) (3 points) What general protections does DNSSEC provide? (b) (3 points) Why might the banking industry consider using DNSSEC with opt-out for.bank? (the reasons may not be for improved security) (c) (4 points) Why do the regulations require DNSSEC at all sub-zones? 8

6. (10 points)..................... Cross Site Script Inclusion (XSSI) Attacks In this problem we look at a common Web vulnerability. Consider a banking web site bank.com. After login the user is taken to a user information page https://bank.com/accountinfo.html that shows the user s account balances. accountinfo.html is a static page: it contains the page layout, but no user data. Towards the bottom of the page a script is included as <script src="//bank.com/userdata.js"> (1) The contents of userdata.js is as follows: displaydata({"name": "John Doe", "AccountNumber": 12345, "Balance": 45}) The function displaydata is defined in accountinfo.html and uses the provided data to populate the page with user data. The script userdata.js is generated dynamically and is the only part of the page that contains user data. Everything else is static content. Keep in mind that line (1) causes the script userdata.js to be executed in the context of the page that includes it. Suppose that after the user logs in to his or her account at bank.com the site stores the user s session token in a browser cookie. (a) (6 points) Consider user John Doe who logs into his account at bank.com and then visits the URL https://evil.com/. Explain how the page at evil.com can cause all of John Doe s data to be sent to evil.com. Please provide the code contained in the page at evil.com (b) (4 points) How would you keep accountinfo.html as a static page, but prevent the attack from part (a)? You need only change line (1) and userdata.js. Make sure to explain why your defense prevents the attack. Hint: Try loading the user s data in a way that gives bank.com access to the data, but does not give evil.com access. In particular, userdata.js need not be a Javascript file. 9

7. (12 points)........................................................ Email spoofing Sender Policy Framework (SPF) is a simple email validation system designed to detect email spoofing. It works as follows: a site like gmail.com publishes in its DNS record an SPF entry specifying all the IP addresses that can send email on behalf of Gmail. These SPF records are used as follows. An email server, say mail.stanford.edu, receives an email claiming to be from Gmail. Let P be the IP address of the server from which the incoming email is sent. The mail.stanford.edu server looks up the SPF record for gmail.com and rejects the incoming email if P is not on the list of authorized IP addresses who can send email on behalf of Gmail. SPF is designed to prevent non-gmail machines from sending email claiming to be from Gmail. Recall that the mail protocol SMTP runs over TCP: the sending server connects to the recipient s TCP port 25 and transmits the email. Establishing the TCP connection requires a 3-way handshake. (a) (2 points) Without SPF, any machine on the Internet can send mail pretending to come from a Gmail user. Name one way this is widely used maliciously. (b) (3 points) Suppose mail.stanford.edu always chooses its initial TCP sequence number as 0. Explain how this makes it possible for an attacker to completely bypass the SPF check. The attacker need only send packets to mail.stanford.edu. No eavesdropping is needed. 10

(c) (3 points) The attack from part (b) is not possible if mail.stanford.edu chooses a random initial TCP sequence number. Does this mean that SPF prevents every non-gmail machine from sending mail on behalf of Gmail to mail.stanford.edu? (Hint: What if the attacker can eavesdrop on packets sent from mail.stanford.edu?) (d) (4 points) Another spoofing defense called DKIM has Gmail digitally sign every outgoing email. Gmail publishes its public verification key in the gmail.com DNS record. When mail.stanford.edu receives an email claiming to be from Gmail it first fetches Gmail s public key from DNS, verifies the signature on the incoming email, and accepts the mail only if the signature verifies. Does DKIM prevent a network attacker from sending mail on behalf of Gmail users? If so explain why, if not explain why not. 11