EURECOM 6/2/2012 SYSTEM SECURITY Σ

Similar documents
EURECOM 6/2/2012 SYSTEM SECURITY Σ

Pointers, Arrays, and Strings. CS449 Spring 2016

Characters, Character Strings, and string-manipulation functions in C

Program Security and Vulnerabilities Class 2

Outline. Classic races: files in /tmp. Race conditions. TOCTTOU example. TOCTTOU gaps. Vulnerabilities in OS interaction

Software Security II: Memory Errors - Attacks & Defenses

Fundamentals of Computer Security

One-Slide Summary. Lecture Outline. Language Security

Computer Programming: Skills & Concepts (CP) Strings

Module: Program Vulnerabilities. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security

CSc 466/566. Computer Security. 20 : Operating Systems Application Security

Secure Programming I. Steven M. Bellovin September 28,

CSCE 548 Building Secure Software Integers & Integer-related Attacks & Format String Attacks. Professor Lisa Luo Spring 2018

Buffer Overflows. Buffers. Administrative. COMP 435 Fall 2017 Prof. Cynthia Sturton. Buffers

Module: Program Vulnerabilities. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security

Module: Program Vulnerabilities. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security

Language Security. Lecture 40

typedef void (*type_fp)(void); int a(char *s) { type_fp hf = (type_fp)(&happy_function); char buf[16]; strncpy(buf, s, 18); (*hf)(); return 0; }

CSCE 548 Building Secure Software Buffer Overflow. Professor Lisa Luo Spring 2018

C strings. (Reek, Ch. 9) 1 CS 3090: Safety Critical Programming in C

Security and Privacy in Computer Systems. Lecture 5: Application Program Security

Secure Systems Engineering

Lecture 08 Control-flow Hijacking Defenses

Software Security: Buffer Overflow Attacks

Software Security: Buffer Overflow Defenses and Miscellaneous

CNIT 127: Exploit Development. Ch 18: Source Code Auditing. Updated

Secure Software Development: Theory and Practice

United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring 2015

Software Security: Buffer Overflow Defenses

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

New York University CSCI-UA : Advanced Computer Systems: Spring 2016 Midterm Exam

IPv4 addressing, NAT. Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley.

Security Analyses For The Lazy Superhero

Midterm Exam, Fall 2015 Date: October 29th, 2015

CSE 565 Computer Security Fall 2018

Arrays and Strings. CS449 Fall 2017

Software security, secure programming

CS 161 Computer Security

Student Number: Instructor: Reid Section: L0101 (10:10-11:00am)

Chair for Network Architectures and Services Department of Informatics TU München Prof. Carle. Network Security. Chapter 8

8. Characters, Strings and Files

CYSE 411/AIT681 Secure Software Engineering Topic #12. Secure Coding: Formatted Output

2/9/18. CYSE 411/AIT681 Secure Software Engineering. Readings. Secure Coding. This lecture: String management Pointer Subterfuge

Lecture 9 Assertions and Error Handling CS240

Security Lab. Episode 6: Format String Vulnerabilities. Jan Nordholz, Matthias Petschick, Julian Vetter

This time. Defenses and other memory safety vulnerabilities. Everything you ve always wanted to know about gdb but were too afraid to ask

MWR InfoSecurity Security Advisory. IBM Lotus Domino Accept- Language Stack Overflow. 20 th May Contents

Changelog. Corrections made in this version not in first posting: 1 April 2017: slide 13: a few more %c s would be needed to skip format string part

Strings(2) CS 201 String. String Constants. Characters. Strings(1) Initializing and Declaring String. Debzani Deb

CMSC 414 Computer and Network Security

CS107 Spring 2019, Lecture 4 C Strings

2 Sadeghi, Davi TU Darmstadt 2012 Secure, Trusted, and Trustworthy Computing Chapter 6: Runtime Attacks

Foundations of Network and Computer Security

Homework 3 CS161 Computer Security, Fall 2008 Assigned 10/07/08 Due 10/13/08

Computer Security. 04r. Pre-exam 1 Concept Review. Paul Krzyzanowski. Rutgers University. Spring 2018

Linux Memory Layout. Lecture 6B Machine-Level Programming V: Miscellaneous Topics. Linux Memory Allocation. Text & Stack Example. Topics.

CMPSC 497 Buffer Overflow Vulnerabilities

Sungkyunkwan University

Buffer overflow background

CS107 Handout 08 Spring 2007 April 9, 2007 The Ins and Outs of C Arrays

CS107, Lecture 4 C Strings

INFLUENTIAL OPERATING SYSTEM RESEARCH: SECURITY MECHANISMS AND HOW TO USE THEM CARSTEN WEINHOLD

CSC 591 Systems Attacks and Defenses Stack Canaries & ASLR

Secure Programming. Buffer Overflows Learning objectives. Type. 3 Buffer Overflows. 4 An Important Vulnerability. 5 Example Overflow

ECE 471 Embedded Systems Lecture 22

Getting Started. Project 1

Static Vulnerability Analysis

Software Security: Buffer Overflow Attacks (continued)

ECS 153 Discussion Section. April 6, 2015

Other array problems. Integer overflow. Outline. Integer overflow example. Signed and unsigned

Module: Safe Programming. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security

Verification & Validation of Open Source

Student Number: Instructor: Reid Section: L5101 (6:10-7:00pm)

IS THERE A HOLE IN YOUR RISC-V SECURITY STACK? JOTHY ROSENBERG DOVER MICROSYSTEMS

C and C++ Secure Coding 4-day course. Syllabus

U23 - Binary Exploitation

A Better Space Mission Systems threat assessment by leveraging the National Cyber Range

C Characters and Strings

Detecting and exploiting integer overflows

Rooting Routers Using Symbolic Execution. Mathy HITB DXB 2018, Dubai, 27 November 2018

UMSSIA LECTURE I: SOFTWARE SECURITY

Security and Authentication

18-642: Code Style for Compilers

Software Vulnerabilities August 31, 2011 / CS261 Computer Security

CSE / / 60567: Computer Security. Software Security 4

Student Number: Instructor: Reid Section: L0201 (12:10-1:00pm)

Slide Set 3. for ENCM 339 Fall 2017 Section 01. Steve Norman, PhD, PEng

CIS 551 / TCOM 401 Computer and Network Security. Spring 2007 Lecture 2

(a) Which of these two conditions (high or low) is considered more serious? Justify your answer.

[6 marks] All parts of this question assume the following C statement. Parts (b) through (e) assume a variable called ptrs.

Memory Safety (cont d) Software Security

Reading Assignment. Strings. K.N. King Chapter 13. K.N. King Sections 23.4, Supplementary reading. Harbison & Steele Chapter 12, 13, 14

Copyright (2004) Purdue Research Foundation. All rights reserved.

Buffer Overflow. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

BUFFER OVERFLOW. Jo, Heeseung

Buffer Overflow. Jo, Heeseung

Buffer overflows (a security interlude) Address space layout the stack discipline + C's lack of bounds-checking HUGE PROBLEM

Buffer Overflow. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Why bother? Default configurations Buffer overflows Authentication mechanisms Reverse engineering Questions?

Why bother? Default configurations Buffer overflows Authentication mechanisms Reverse engineering Questions?

Transcription:

EURECOM 6/2/2012 Name SYSTEM SECURITY 5 5 5 5 5 5 5 5 10 50 1 2 3 4 5 6 7 8 9 Σ Course material is not allowed during the exam. Try to keep your answers precise and short. You will not get extra points by giving very long answers or by writing down what you know instead of what is asked. Just answer the question that is asked. Take 10 seconds to think about what you are going to write before writing it. [...]

1. Race conditions. a) Explain what is a race condition in one sentence. b) Give an example of an attack using a race condition to attack a system. c) Cite 2 methods to prevent, or mitigate, race conditions. 2. Terminology. a) What is a threat? b) What is a vulnerability? c ) What is an exploit?

3. Check the boxes to say whether the assertions below are valid or not (good answer 1, bad answer -1, result for this question between 0 and 5) : An integer overflow can lead to a stack-based buffer overflow. Return Oriented Programming defeats non executable stacks (W xor X). Return Oriented Programming defeats ASLR. Memory leaks helps to bypass ASLR. Memory leaks helps to bypass stack canaries. String format bugs are still exploitable today, despite the presence of mitigation techniques (PAX, ASLR). True False 4. In the 70's Saltzer and Schroeder defined 8 security principles, among them Least privilege and Separation of privilege. Explain the difference between the two. 5. What is the attack surface of a system? 6. Explain under which circumstances a null pointer dereference bug can be exploited. 7. What is a Dynamic root of trust?

8. CAPTCHAs are often used by online services to prevent automated access. Describe one class of attacks against graphical CAPTCHAs that is highly efficient. 9. The first page of the exam contains a screen-shoot of a recent news about vulnerabilities in Universal Plug And Play (UPNP) as used in many devices and computers. While there is some sensationalism in there, the issue is actually severe. A recent report from HD Moore ( UPnP unplug and pray? ) discloses several facts about a reference implementation of UPNP. Here are a few excerpts : Universal Plug and Play (UPnP) is a protocol standard that allows easy communication between computers and network-enabled devices. This protocol is enabled by default on millions of systems, including routers, printers, media servers, IP cameras, smart TVs, home automation systems, and network storage servers. UPnP support is enabled by default on Microsoft Windows, Mac OS X, and many distributions of Linux. The UPnP protocol suffers from a number of basic security problems [...]. Authentication is rarely implemented by device manufacturers, privileged capabilities are often exposed to untrusted networks, and common programming flaws plague common UPnP software implementations. These issues are endemic across UPnP-enabled applications and network devices. The statistics in this paper were derived from five and a half months of active scanning. UpnP discovery requests were sent to every routable IPv4 address approximately once a week from June 1 to November 17, 2012. This process identified over 81 million unique IP addresses that responded to a standard UPnP discovery request. [..] This paper quantifies the exposure of UPnP-enabled systems to the internet at large, classifies these systems by vendor, identifies specific products, and describes a number of new vulnerabilities that were identified in common UPnP implementations. Over 1,500 vendors and 6,900 products were identified that are vulnerable to least one of the security flaws outlined in this paper. Over 23 million systems were vulnerable to a single remote code execution flaw that was discovered during the course of this research. [ ] 1 UDP packet is all it takes to exploit any of the 8 newly-discovered libupnp vulnerabilities. a) Given the above news what should be the steps to take to protect oneself against such attacks?

b) What is the big risk, knowing that 1 UDP packet is enough to exploit the flaw and that there are millions of devices vulnerables? c) Below is a piece of code, the complete copy of one single function, in a popular implementation of UPNP. This function is vulnerable to several attacks. Mark each vulnerabilities you can find together with a very brief explanation/decription of the vulnerability, write your anwser directly on the listing. There are 7, and most of them are basic buffer overflows! (If needed, check the man pages sample material at the end of the page). d) Explain, very briefly, how you would exploit one of those bugs? Provide an example of a string to exploit one vulnerability (of course exact offsets and the shell code are not needed, a sketch of the string is fine).

/************************************************************************ * Function : unique_service_name * * Parameters: * IN char *cmd: Service Name string * OUT SsdpEvent *Evt: The SSDP event structure partially filled * by all the function. * * Description: * This function fills the fields of the event structure like DeviceType, * Device UDN and Service Type * * Returns: int * 0 if successful else -1 ***************************************************************************/ int unique_service_name( IN char *cmd, IN SsdpEvent * Evt ) { char *TempPtr, TempBuf[COMMAND_LEN], *Ptr, *ptr1, *ptr2, *ptr3; int CommandFound = 0; if( ( TempPtr = strstr( cmd, "uuid:schemas" ) )!= NULL ) { ptr1 = strstr( cmd, ":device" ); if( ptr1!= NULL ) { ptr2 = strstr( ptr1 + 1, ":" ); else { if( ptr2!= NULL ) { ptr3 = strstr( ptr2 + 1, ":" ); else { if( ptr3!= NULL ) { sprintf( Evt->UDN, "uuid:%s", ptr3 + 1 ); else { ptr1 = strstr( cmd, ":" ); if( ptr1!= NULL ) { strncpy( TempBuf, ptr1, ptr3 - ptr1 ); TempBuf[ptr3 - ptr1] = '\0'; sprintf( Evt->DeviceType, "urn%s", TempBuf ); else { return 0; if( ( TempPtr = strstr( cmd, "uuid" ) )!= NULL ) { //printf("cmd = %s\n",cmd); if( ( Ptr = strstr( cmd, "::" ) )!= NULL ) { strncpy( Evt->UDN, TempPtr, Ptr - TempPtr ); Evt->UDN[Ptr - TempPtr] = '\0'; else { strcpy( Evt->UDN, TempPtr );

CommandFound = 1; if( strstr( cmd, "urn:" )!= NULL && strstr( cmd, ":service:" )!= NULL ) { if( ( TempPtr = strstr( cmd, "urn" ) )!= NULL ) { strcpy( Evt->ServiceType, TempPtr ); CommandFound = 1; if( strstr( cmd, "urn:" )!= NULL && strstr( cmd, ":device:" )!= NULL ) { if( ( TempPtr = strstr( cmd, "urn" ) )!= NULL ) { strcpy( Evt->DeviceType, TempPtr ); CommandFound = 1; if( CommandFound == 0 ) { return 0; Some background: This code path is reachable before authentication, with UDP packets, the cmd variable is controolled by the attacker Sample material from the man page of the strncpy function : char *strcpy(char *dest, const char *src); char *strncpy(char *dest, const char *src, unsigned int n); DESCRIPTION The strcpy() function copies the string pointed to by src, including the terminating null byte ('\0'), to the buffer pointed to by dest. The strings may not overlap, and the destination string dest must be large enough to receive the copy. The strncpy() function is similar, except that at most n bytes of src are copied. Warning: If there is no null byte among the first n bytes of src, the string placed in dest will not be null-terminated. If the length of src is less than n, strncpy() pads the remainder of dest with null bytes. RETURN VALUE The strcpy() and strncpy() functions return a pointer to the destination string dest. From the man page of the strstr function: char *strstr(const char *haystack, const char *needle); DESCRIPTION The strstr() function finds the first occurrence of the substring needle in the string haystack. The terminating null bytes ('\0') are not compared. RETURN VALUE strstr() returns a pointer to the beginning of the substring, or NULL if the substring is not found.