Module: Future of Secure Programming

Size: px
Start display at page:

Download "Module: Future of Secure Programming"

Transcription

1 Module: Future of Secure Programming Professor Trent Jaeger Penn State University Systems and Internet Infrastructure Security Laboratory (SIIS) 1

2 Programmer s Little Survey Problem What does program for security mean? Implement a program Have you ever programmed for security? Without creating vulnerabilities When What is do a vulnerability? you start to consider security when you program? What do you try to do to make your code secure? When do you know you are done making your code secure? Should a programmer fix every flaw in their programs? Systems and and Internet Infrastructure Security Security (SIIS) (SIIS) Laboratory Laboratory 22

3 Programmer s Problem Implement a program Without creating vulnerabilities What is a vulnerability? Systems and Internet Infrastructure Security (SIIS) Laboratory 3

4 Software Vulnerabilities Vulnerability combines A flaw Accessible to an adversary Who can exploit that flaw Which would you focus on to prevent vulnerabilities? Systems and Internet Infrastructure Security Laboratory (SIIS) 4

5 Buffer Overflow Detection For C code where char dest[len]; int n;... n = input();... strncpy(dest, src, n); Can this code cause a buffer overflow? Systems and Internet Infrastructure Security Laboratory (SIIS) 5

6 Runtime Analysis One approach is to run the program to determine how it behaves Analysis Inputs Input Values - command line arguments Environment - state of file system, environment variables, etc. Question Can any input value in any environment cause a vulnerability (e.g., exploit a buffer overflow)? What are limitations of runtime analysis? Systems and Internet Infrastructure Security Laboratory (SIIS) 6

7 Fuzz Testing Dynamic software testing technique Run the software Where invalid, unlikely, and/or random inputs are provided to the program See what happens To detect crashes, exceptions, etc. Which may be indicate of flaws that can be exploited How would this detect a buffer overflow? Fuzz testing is black-box testing do not need to examine the program code to run Research in grey/white-box testing, but industry uses fuzzing Systems and Internet Infrastructure Security Laboratory (SIIS) 7

8 Runtime Static Analysis Analysis One approach is to run the program to determine how it behaves Explore all possible executions of a program! Analysis Inputs All possible inputs! Input Values - command line arguments All possible states! Environment - state of file system, environment variables, etc. Question Can any input value in any environment cause a flaw (e.g., buffer overflow)? What are limitations of runtime analysis? Systems and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 8 8

9 Runtime Static Analysis Provides an approximation of behavior! One approach is to run the program to determine how it behaves Analysis Inputs Run in the aggregate! Input Values - command line arguments Rather than executing on ordinary states! Environment - state of file system, environment variables, etc. Finite-sized descriptors representing a collection of states! Question Run in non-standard way! Can any input value in any environment cause a flaw (e.g., buffer overflow)? Run in fragments! What are limitations of runtime analysis? Stitch them together to cover all paths! Runtime testing is inherently incomplete, but static analysis can cover all paths! Systems and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 10 9

10 Runtime Static Analysis Example Descriptors represent the sign of a value! One approach is to run the program to determine how it behaves Analysis Inputs Positive, negative, zero, unknown! Input Values - command line arguments For an expression, c = a * b! Environment - state of file system, environment variables, etc. If a has a descriptor pos! Question And b has a descriptor neg! Can any input value in any environment cause a flaw (e.g., buffer overflow)? What is the descriptor for c after that instruction?! What are limitations of runtime analysis? How might this help?! Systems and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 11 10

11 Runtime Descriptors Analysis Choose a set of descriptors that! One approach is to run the program to determine how it behaves Analysis Abstracts Inputsaway details to make analysis tractable! Input Preserves Values enough - command information line arguments that key properties hold! Environment - state of file system, environment variables, etc. Can determine interesting results! Question Using sign as a descriptor! Can any input value in any environment cause a flaw (e.g., buffer overflow)? Abstracts away specific integer values (billions to four)! What Guarantees are limitations when of a*b runtime = 0 it analysis? will be zero in all executions! Choosing descriptors is one key step in static analysis! Systems and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 12 11

12 Buffer Overflow Static Analysis For C code where char dest[len]; int n; n = input(); strncpy(dest, src, n); Static analysis will try all paths of the program that impact variable n and flow to strncpy May be complex in general because Paths: Exponential number of program paths Interprocedural: n may be assigned in another function Aliasing: n s memory may be accessed from many places What descriptor values do you care about for n? Systems and Internet Infrastructure Security Laboratory (SIIS) 12

13 Limitations of Static Analysis Scalability Can be expensive to reason about all executions of complex programs False positives Overapproximation means that executions that are not really possible may be found Accuracy Alias analysis and other imprecision may lead to false negatives Sound methods (no false negatives) can exacerbate scalability and false positives problems Bottom line: Static analysis often must be directed Systems and Internet Infrastructure Security Laboratory (SIIS) 13

14 Preventing These Vulnerabilities What can the programmer do to secure their program in such cases? Systems and Internet Infrastructure Security Laboratory (SIIS) 14

15 Information Denning s Lattice Flow Model Control Formalizes information flow models! What is it? FM = {N, P, SC, /, >} Simple security & -property Shows that the information flow model instances form a lattice! N are objects, P are processes,! {SC, >} is a partial ordered set,! SC, the set of security classes is finite,! SC has a lower bound,! and / is a lub operator! Implicit and explicit information flows! Semantics for verifying that a configuration is secure! Static and dynamic binding considered! Biba and BLP are among the simplest models of this type Systems and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 15

16 Implicit and explicit flows Information Flow Control Explicit! What is it? Direct transfer to b from a (e.g., b = a)! Simple security & -property Implicit! Where value of b may depend on value of a indirectly (e.g., if a = 0, then b = c)! Model covers all programs! Statement S! Sequence S1, S2! Conditional c: S1,, Sm! Implicit flows only occur in conditionals! Systems and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 16

17 Information Semantics Flow Control Program What is it? is secure if:! Simple Explicit security flow from & -property S is secure! Explicit flow of all statements in a sequence are secure (e.g., S1; S2)! Conditional c: S1,, Sm is secure if:! The explicit flows of all statements S1,, Sm are secure! The implicit flows between c and the objects in Si are secure! Systems and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 17

18 Build on Type Safety A type-safe language maintains the semantics of types. E.g., can t add int s to Object s. Type-safety is compositional. A function promises to maintain type safety. Systems and Internet Infrastructure Security Laboratory (SIIS) Example 1 Object obj; int i; obj = obj X+ i; Example 2 String proc_obj(object o);... main() { Object obj; String s = proc_obj(obj);... } 18

19 Labeling Types Example 1 int{high} h1,h2; int{low} l; l = 5; h2 = l; h1 = h2 + 10; l = h2 + l; X Key insight: label types with security levels Security-typing is compositional Example 2 String{low} proc_obj(object{high} o);... main() { Object{high} obj; String{low} s; s = proc_obj(obj);... } Systems and Internet Infrastructure Security Laboratory (SIIS) 19

20 Implicit Flows Static (virtual) tagging int Low mydata = 0; int Low mydata2 = 0; if (test High ) mydata = 1; else mydata = 2; mydata2 = 0; print Low (mydata2); print Low (mydata); Systems and Internet Infrastructure Security Laboratory (SIIS) mydata contains information about test so it can no longer be Low,but mydata2 is outside the conditional, so it is untainted by test Causes type error at compile-time 20

21 Retrofitting for Security Take the code written in a language of the programmers choice (for functionality) and retrofit with security code (mostly-automated) Consider authorization bypass vulnerabilities In these vulnerabilities, programmers forget to add code to control access to program resources!! What!is!authoriza,on?!! Resource user! Operation request! Response! Resource manager! Authorization Hooks! Reference monitor! Allowed?! YES/NO! Authorization policy! Alice, /etc/passwd, File_Read! Systems and Internet Infrastructure Security Laboratory (SIIS) 21

22 X Server & Many X Clients Retrofitting for Security Take the code written in a language of the programmers choice (for functionality) and retrofit with security code (mostly-automated) Consider authorization bypass vulnerabilities In these vulnerabilities, programmers forget to add code to control access to program resources REMOTE LOCAL Systems and and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 22

23 Retrofitting for Security Malicious Remote X Client Take the code written in a language of the programmers choice (for functionality) and retrofit with security code (mostly-automated) Consider authorization bypass vulnerabilities In these vulnerabilities, programmers forget to add code to control access to program resources REMOTE LOCAL Systems and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 23

24 Illegal Information Flow Retrofitting for Security Take the code written in a language of the programmers choice (for functionality) and retrofit with security code (mostly-automated) Consider authorization bypass vulnerabilities In these vulnerabilities, programmers forget to add code to control access to program resources REMOTE LOCAL Systems and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 24

25 Retrofitting for Security Desirable Information Flow Take the code written in a language of the programmers choice (for functionality) and retrofit with security code (mostly-automated) Consider authorization bypass vulnerabilities In these vulnerabilities, programmers forget to add code to control access to program resources LOCAL REMOTE Systems and and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 25

26 What Should a Programmer Do? How would you ensure that all accesses to window objects in the X Server are authorized? Systems and Internet Infrastructure Security Laboratory (SIIS) 26

27 Inferring Sensitive Operations What Should a Programmer Do? How would you ensure that all accesses to window objects in the X Server are authorized? Program Program Challenges Challenges User A User B Request Interface i Program A B o1 A. Identify securitysensitive resources F H C D E I J K L o2 o3 o4... on Programs manipulate many variables 7800 in X Server Of over 400 structures Many, many structuremember accesses Systems and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 27

28 What Should a Programmer Do? Solution How would you ensure that all accesses to window objects in the X Server Requests are authorized? make choices In servers, client-request determines choices that client subjects can make in the program Choice : Resources: Determine which elements are chosen from containers. Operations: Determine which program path is selected for execution. Systems and and Internet Infrastructure Security Security (SIIS) Laboratory (SIIS) 28

29 Idea: Request Choices What Should a Programmer Do? How would you ensure that all accesses to window objects in the X Server are authorized? Program A Lookup Function using tainted variable User A Request Interface i B Container O User B o1 C v = Lookup(O,i) o2 o3 D o4 E F I K H J L Systems and and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 29

30 Idea: Request Choices What Should a Programmer Do? How would you ensure that all accesses to window objects in the X Server are authorized? Program A User A Request Interface i B Container O User B o1 C v = Lookup(O,i) o2 Op 1.0 D o3 o4 E F I K H J L Systems and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 30

31 Idea: Request Choices What Should a Programmer Do? How would you ensure that all accesses to window objects in the Program X Server are authorized? A User A Request Interface i B Container O User B o1 C v = Lookup(O,i) o2 Op 1.0 D o3 o4 E Control Statement Predicated on a tainted variable F I K read v write v H J L Systems and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 31

32 Idea: Request Choices What Should a Programmer Do? How would you ensure that all accesses to window objects in the X Server are authorized? Program A User A Request Interface i B Container O User B o1 C v = Lookup(O,i) o2 Op 1.0 D o3 o4 Choice of operations E F I K read v write v H J L Op1.1 Op1.2 Op1.3 Systems and and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 32

33 Idea: Request Choices What Should a Programmer Do? How would you ensure that all accesses to window objects in the X Server are authorized? Program A User A Request Interface i B Container O User B o1 C v = Lookup(O,i) o2 Op 1.0 D o3 o4 E Security sensitive operation F I K read v write v H J L Op1.1 Op1.2 Op1.3 Systems and and Internet Infrastructure Security (SIIS) Laboratory Laboratory (SIIS) 33

34 Mediate SSOs Where should we place authorization hook checks Mediate all security-sensitive operations found Good: Enforce least-privilege flexibly Bad: Maximal number of hooks means Ensure at least one hook per security-sensitive operation Good: Minimal number of hooks Bad: Must ensure that all authorized subjects pass Idea: Determine if you have blocked enough Suppose OP-1 dominates OP-2, then if policy for OP-1 blocks all the unauthorized subjects for OP-2 Systems and Internet Infrastructure Security Laboratory (SIIS) 34

35 Future of Secure Programming Write your program with functionality in mind Determine security policies to be enforced on the program Semi-automated - e.g., use program analysis to find SSOs Use security policies to guide retrofitting of program with security code automatically Can it be done? Caveat: Some security knowledge is application-specific Caveat: Cannot retrofit for security from program code alone Systems and Internet Infrastructure Security Laboratory (SIIS) 35

36 Take Away Programming for security is difficult Programmers create flaws that are often accessible and exploitable by adversaries (vulnerabilities) Program analysis can find some flaws Static and dynamic, but limitations for each May need to fix program - security types and choice The future of secure programming may look very different Now: use favorite language for achieving function and try to add security code without creating flaws Future: use favorite language for achieving function and retrofit based on a security program Systems and Internet Infrastructure Security Laboratory (SIIS) 36

Module: Future of Secure Programming

Module: Future of Secure Programming Module: Future of Secure Programming Professor Trent Jaeger Penn State University Systems and Internet Infrastructure Security Laboratory (SIIS) 1 Programmer s Little Survey Problem What does program for

More information

Static Analysis. Systems and Internet Infrastructure Security

Static Analysis. Systems and Internet Infrastructure Security Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Static Analysis Trent

More information

CMPSC 497: Static Analysis

CMPSC 497: Static Analysis CMPSC 497: Static Analysis Trent Jaeger Systems and Internet Infrastructure Security (SIIS) Lab Computer Science and Engineering Department Pennsylvania State University Page 1 Our Goal In this course,

More information

CSE Computer Security

CSE Computer Security CSE 543 - Computer Security Lecture 17 - Language-based security October 25, 2007 URL: http://www.cse.psu.edu/~tjaeger/cse543-f07/ 1 Engineering Disaster? Millions of Bots Compromised applications Programming

More information

CSE Computer Security (Fall 2006)

CSE Computer Security (Fall 2006) CSE 543 - Computer Security (Fall 2006) Lecture 22 - Language-based security November 16, 2006 URL: http://www.cse.psu.edu/~tjaeger/cse543-f06/ 1 The Morris Worm Robert Morris, a 23 doctoral student from

More information

CMPSC 497: Static Analysis

CMPSC 497: Static Analysis CMPSC 497: Static Analysis Trent Jaeger Systems and Internet Infrastructure Security (SIIS) Lab Computer Science and Engineering Department Pennsylvania State University Page 1 Our Goal In this course,

More information

Producing Minimal Hook Placements to Enforce Authorization Policies

Producing Minimal Hook Placements to Enforce Authorization Policies Producing Minimal Hook Placements to Enforce Authorization Policies Divya Muthukumaran, Nirupama Talele, and Trent Jaeger Prnn State University With Vinod Ganapathy (Rutgers) and Gang Tan (Lehigh) Security

More information

Advanced Systems Security: Principles

Advanced Systems Security: Principles Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:

More information

Module: Programming Language Security. Professor Patrick McDaniel Spring CMPSC443 - Introduction to Computer and Network Security

Module: Programming Language Security. Professor Patrick McDaniel Spring CMPSC443 - Introduction to Computer and Network Security CMPSC443 - Introduction to Computer and Network Security Module: Programming Language Security Professor Patrick McDaniel Spring 2009 1 Engineering Disaster? Millions of Bots Compromised applications Programming

More information

Advanced Systems Security: Ordinary Operating Systems

Advanced Systems Security: Ordinary Operating Systems Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:

More information

Static Vulnerability Analysis

Static Vulnerability Analysis Static Vulnerability Analysis Static Vulnerability Detection helps in finding vulnerabilities in code that can be extracted by malicious input. There are different static analysis tools for different kinds

More information

Advanced Systems Security: Symbolic Execution

Advanced Systems Security: Symbolic Execution Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:

More information

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

Module: Safe Programming. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security CSE543 - Introduction to Computer and Network Security Module: Safe Programming Professor Trent Jaeger 1 1 Avoiding Vulnerabilities How do we write programs to avoid mistakes that lead to vulnerabilities?

More information

Securing Software Applications Using Dynamic Dataflow Analysis. OWASP June 16, The OWASP Foundation

Securing Software Applications Using Dynamic Dataflow Analysis. OWASP June 16, The OWASP Foundation Securing Software Applications Using Dynamic Dataflow Analysis Steve Cook OWASP June 16, 2010 0 Southwest Research Institute scook@swri.org (210) 522-6322 Copyright The OWASP Foundation Permission is granted

More information

Advanced Programming Methods. Introduction in program analysis

Advanced Programming Methods. Introduction in program analysis Advanced Programming Methods Introduction in program analysis What is Program Analysis? Very broad topic, but generally speaking, automated analysis of program behavior Program analysis is about developing

More information

Advanced Systems Security: Multics

Advanced Systems Security: Multics Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:

More information

A Gentle Introduction to Program Analysis

A Gentle Introduction to Program Analysis A Gentle Introduction to Program Analysis Işıl Dillig University of Texas, Austin January 21, 2014 Programming Languages Mentoring Workshop 1 / 24 What is Program Analysis? Very broad topic, but generally

More information

Operational Semantics of Cool

Operational Semantics of Cool Operational Semantics of Cool Key Concepts semantics: the meaning of a program, what does program do? how the code is executed? operational semantics: high level code generation steps of calculating values

More information

Advanced Systems Security: New Threats

Advanced Systems Security: New Threats Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:

More information

Today Program Analysis for finding bugs, especially security bugs problem specification motivation approaches remaining issues

Today Program Analysis for finding bugs, especially security bugs problem specification motivation approaches remaining issues Finding Bugs Last time Run-time reordering transformations Today Program Analysis for finding bugs, especially security bugs problem specification motivation approaches remaining issues CS553 Lecture Finding

More information

MoonShine: Optimizing OS Fuzzer Seed Selection with Trace Distillation. Shankara Pailoor, Andrew Aday, Suman Jana Columbia University

MoonShine: Optimizing OS Fuzzer Seed Selection with Trace Distillation. Shankara Pailoor, Andrew Aday, Suman Jana Columbia University MoonShine: Optimizing OS Fuzzer Seed Selection with Trace Distillation Shankara Pailoor, Andrew Aday, Suman Jana Columbia University 1 OS Fuzzing Popular technique to find OS vulnerabilities Primarily

More information

Advanced Systems Security: Ordinary Operating Systems

Advanced Systems Security: Ordinary Operating Systems Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:

More information

Finding Vulnerabilities in Web Applications

Finding Vulnerabilities in Web Applications Finding Vulnerabilities in Web Applications Christopher Kruegel, Technical University Vienna Evolving Networks, Evolving Threats The past few years have witnessed a significant increase in the number of

More information

CMPSC 497 Other Memory Vulnerabilities

CMPSC 497 Other Memory Vulnerabilities Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA CMPSC 497 Other Memory

More information

Programming Languages and Compilers Qualifying Examination. Answer 4 of 6 questions.

Programming Languages and Compilers Qualifying Examination. Answer 4 of 6 questions. Programming Languages and Compilers Qualifying Examination Fall 2017 Answer 4 of 6 questions. GENERAL INSTRUCTIONS 1. Answer each question in a separate book. 2. Indicate on the cover of each book the

More information

CSE 544 Advanced Systems Security

CSE 544 Advanced Systems Security Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA CSE 544 Advanced Systems

More information

CMPSC 497 Buffer Overflow Vulnerabilities

CMPSC 497 Buffer Overflow Vulnerabilities Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA CMPSC 497 Buffer Overflow

More information

Advanced Systems Security: Integrity

Advanced Systems Security: Integrity Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:

More information

CSCI-GA Scripting Languages

CSCI-GA Scripting Languages CSCI-GA.3033.003 Scripting Languages 12/02/2013 OCaml 1 Acknowledgement The material on these slides is based on notes provided by Dexter Kozen. 2 About OCaml A functional programming language All computation

More information

Static Analysis Basics II

Static Analysis Basics II Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Static Analysis Basics

More information

Applications. Cloud. See voting example (DC Internet voting pilot) Select * from userinfo WHERE id = %%% (variable)

Applications. Cloud. See voting example (DC Internet voting pilot) Select * from userinfo WHERE id = %%% (variable) Software Security Requirements General Methodologies Hardware Firmware Software Protocols Procedure s Applications OS Cloud Attack Trees is one of the inside requirement 1. Attacks 2. Evaluation 3. Mitigation

More information

Runtime Analysis. November 28, Systems and Internet Infrastructure Security Laboratory (SIIS) Page 1

Runtime Analysis. November 28, Systems and Internet Infrastructure Security Laboratory (SIIS) Page 1 Runtime Analysis November 28, 2011 Page 1 Analysis So Far Prove whether a property always holds May analysis Prove whether a property can hold Must analysis Key step: abstract interpretation to overapproximate

More information

A program execution is memory safe so long as memory access errors never occur:

A program execution is memory safe so long as memory access errors never occur: A program execution is memory safe so long as memory access errors never occur: Buffer overflows, null pointer dereference, use after free, use of uninitialized memory, illegal free Memory safety categories

More information

COS 320. Compiling Techniques

COS 320. Compiling Techniques Topic 5: Types COS 320 Compiling Techniques Princeton University Spring 2016 Lennart Beringer 1 Types: potential benefits (I) 2 For programmers: help to eliminate common programming mistakes, particularly

More information

Secure Software Development: Theory and Practice

Secure Software Development: Theory and Practice Secure Software Development: Theory and Practice Suman Jana MW 2:40-3:55pm 415 Schapiro [SCEP] *Some slides are borrowed from Dan Boneh and John Mitchell Software Security is a major problem! Why writing

More information

Program Security and Vulnerabilities Class 2

Program Security and Vulnerabilities Class 2 Program Security and Vulnerabilities Class 2 CEN-5079: 28.August.2017 1 Secure Programs Programs Operating System Device Drivers Network Software (TCP stack, web servers ) Database Management Systems Integrity

More information

CSCI 420: Mobile Application Security. Lecture 7. Prof. Adwait Nadkarni. Derived from slides by William Enck, Patrick McDaniel and Trent Jaeger

CSCI 420: Mobile Application Security. Lecture 7. Prof. Adwait Nadkarni. Derived from slides by William Enck, Patrick McDaniel and Trent Jaeger CSCI 420: Mobile Application Security Lecture 7 Prof. Adwait Nadkarni Derived from slides by William Enck, Patrick McDaniel and Trent Jaeger 1 cryptography < security Cryptography isn't the solution to

More information

CMPSC 497 Attack Surface

CMPSC 497 Attack Surface Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA CMPSC 497 Attack Surface

More information

Program verification. Generalities about software Verification Model Checking. September 20, 2016

Program verification. Generalities about software Verification Model Checking. September 20, 2016 Program verification Generalities about software Verification Model Checking Laure Gonnord David Monniaux September 20, 2016 1 / 43 The teaching staff Laure Gonnord, associate professor, LIP laboratory,

More information

Cryptographically Sound Implementations for Typed Information-Flow Security

Cryptographically Sound Implementations for Typed Information-Flow Security FormaCrypt, Nov 30. 2007 Cryptographically Sound Implementations for Typed Information-Flow Security Cédric Fournet Tamara Rezk Microsoft Research INRIA Joint Centre http://msr-inria.inria.fr/projects/sec/cflow

More information

Buffer overflow background

Buffer overflow background and heap buffer background Comp Sci 3600 Security Heap Outline and heap buffer Heap 1 and heap 2 3 buffer 4 5 Heap Outline and heap buffer Heap 1 and heap 2 3 buffer 4 5 Heap Address Space and heap buffer

More information

Advanced Systems Security: Control-Flow Integrity

Advanced Systems Security: Control-Flow Integrity Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Values and Types We divide the universe of values according to types A type is a set of values and

More information

Advanced System Security: Vulnerabilities

Advanced System Security: Vulnerabilities Advanced System Security: Vulnerabilities Trent Jaeger Systems and Internet Infrastructure Security (SIIS) Lab Computer Science and Engineering Department Pennsylvania State University CSE544 -Advanced

More information

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

CSCE 548 Building Secure Software Integers & Integer-related Attacks & Format String Attacks. Professor Lisa Luo Spring 2018 CSCE 548 Building Secure Software Integers & Integer-related Attacks & Format String Attacks Professor Lisa Luo Spring 2018 Previous Class Buffer overflows can be devastating It occurs when the access

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 21 Tuesday, April 15, 2014 1 Static program analyses For the last few weeks, we have been considering type systems.

More information

CYSE 411/AIT 681 Secure Software Engineering. Topic #6. Seven Software Security Touchpoints (III) Instructor: Dr. Kun Sun

CYSE 411/AIT 681 Secure Software Engineering. Topic #6. Seven Software Security Touchpoints (III) Instructor: Dr. Kun Sun CYSE 411/AIT 681 Secure Software Engineering Topic #6. Seven Software Security Touchpoints (III) Instructor: Dr. Kun Sun Reading This lecture [McGraw]: Ch. 7-9 2 Seven Touchpoints 1. Code review 2. Architectural

More information

4. Risk-Based Security Testing. Reading. CYSE 411/AIT 681 Secure Software Engineering. Seven Touchpoints. Application of Touchpoints

4. Risk-Based Security Testing. Reading. CYSE 411/AIT 681 Secure Software Engineering. Seven Touchpoints. Application of Touchpoints Reading This lecture [McGraw]: Ch. 7-9 CYSE 411/AIT 681 Secure Software Engineering Topic #6. Seven Software Security Touchpoints (III) Instructor: Dr. Kun Sun 2 Seven Touchpoints Application of Touchpoints

More information

Simple Overflow. #include <stdio.h> int main(void){ unsigned int num = 0xffffffff;

Simple Overflow. #include <stdio.h> int main(void){ unsigned int num = 0xffffffff; Simple Overflow 1 #include int main(void){ unsigned int num = 0xffffffff; printf("num is %d bits long\n", sizeof(num) * 8); printf("num = 0x%x\n", num); printf("num + 1 = 0x%x\n", num + 1); }

More information

Memory Safety (cont d) Software Security

Memory Safety (cont d) Software Security Memory Safety (cont d) Software Security CS 161: Computer Security Prof. Raluca Ada Popa January 17, 2016 Some slides credit to David Wagner and Nick Weaver Announcements Discussion sections and office

More information

Singularity Technical Report 1: Singularity Design Motivation

Singularity Technical Report 1: Singularity Design Motivation Singularity Technical Report 1: Singularity Design Motivation Galen C. Hunt James R. Larus December 17, 2004 MSR-TR-2004-105 Microsoft Research Microsoft Corporation One Microsoft Way Redmond, WA 98052

More information

SECURE PROGRAMMING A.A. 2018/2019

SECURE PROGRAMMING A.A. 2018/2019 SECURE PROGRAMMING A.A. 2018/2019 INTEGER SECURITY SECURITY FLAWS The integers are formed by the natural numbers including 0 (0, 1, 2, 3,...) together with the negatives of the nonzero natural numbers

More information

Secure Programming Lecture 15: Information Leakage

Secure Programming Lecture 15: Information Leakage Secure Programming Lecture 15: Information Leakage David Aspinall 21st March 2017 Outline Overview Language Based Security Taint tracking Information flow security by type-checking Summary Recap We have

More information

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012 CS-XXX: Graduate Programming Languages Lecture 9 Simply Typed Lambda Calculus Dan Grossman 2012 Types Major new topic worthy of several lectures: Type systems Continue to use (CBV) Lambda Caluclus as our

More information

Static Analysis and Bugfinding

Static Analysis and Bugfinding Static Analysis and Bugfinding Alex Kantchelian 09/12/2011 Last week we talked about runtime checking methods: tools for detecting vulnerabilities being exploited in deployment. So far, these tools have

More information

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; }

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; } Dawn Song Fall 2012 CS 161 Computer Security Practice Questions 1. (6 points) Control Hijacking Indicate whether the statement is always valid. Indicate true or false, and give a one sentence explanation.

More information

Lecture 10. Pointless Tainting? Evaluating the Practicality of Pointer Tainting. Asia Slowinska, Herbert Bos. Advanced Operating Systems

Lecture 10. Pointless Tainting? Evaluating the Practicality of Pointer Tainting. Asia Slowinska, Herbert Bos. Advanced Operating Systems Lecture 10 Pointless Tainting? Evaluating the Practicality of Pointer Tainting Asia Slowinska, Herbert Bos Advanced Operating Systems December 15, 2010 SOA/OS Lecture 10, Pointer Tainting 1/40 Introduction

More information

Advanced Systems Security: Securing Commercial Systems

Advanced Systems Security: Securing Commercial Systems Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:

More information

Buffer overflow prevention, and other attacks

Buffer overflow prevention, and other attacks Buffer prevention, and other attacks Comp Sci 3600 Security Outline 1 2 Two approaches to buffer defense Aim to harden programs to resist attacks in new programs Run time Aim to detect and abort attacks

More information

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

Module: Return-oriented Programming. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security CSE543 - Introduction to Computer and Network Security Module: Return-oriented Programming Professor Trent Jaeger 1 Anatomy of Control-Flow Exploits 2 Anatomy of Control-Flow Exploits Two steps in control-flow

More information

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 CSE543 - Introduction to Computer and Network Security Module: Program Vulnerabilities Professor Trent Jaeger 1 1 Programming Why do we write programs? Function What functions do we enable via our programs?

More information

CSE 565 Computer Security Fall 2018

CSE 565 Computer Security Fall 2018 CSE 565 Computer Security Fall 2018 Lecture 16: Building Secure Software Department of Computer Science and Engineering University at Buffalo 1 Review A large number of software vulnerabilities various

More information

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

Why bother? Default configurations Buffer overflows Authentication mechanisms Reverse engineering Questions? Jeroen van Beek 1 Why bother? Default configurations Buffer overflows Authentication mechanisms Reverse engineering Questions? 2 Inadequate OS and application security: Data abuse Stolen information Bandwidth

More information

Static Analysis and Dataflow Analysis

Static Analysis and Dataflow Analysis Static Analysis and Dataflow Analysis Static Analysis Static analyses consider all possible behaviors of a program without running it. 2 Static Analysis Static analyses consider all possible behaviors

More information

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far Lecture Outline Operational Semantics of Cool Lecture 13 COOL operational semantics Motivation Notation The rules Prof. Aiken CS 143 Lecture 13 1 Prof. Aiken CS 143 Lecture 13 2 Motivation We must specify

More information

Lecture 3 Notes Arrays

Lecture 3 Notes Arrays Lecture 3 Notes Arrays 15-122: Principles of Imperative Computation (Summer 1 2015) Frank Pfenning, André Platzer 1 Introduction So far we have seen how to process primitive data like integers in imperative

More information

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall Quiz I

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall Quiz I Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.858 Fall 2010 Quiz I All problems are open-ended questions. In order to receive credit you must answer

More information

Topics in Systems and Program Security

Topics in Systems and Program Security Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Topics in Systems and

More information

Automatic Placement of Authorization Hooks in the Linux Security Modules Framework

Automatic Placement of Authorization Hooks in the Linux Security Modules Framework Automatic Placement of Authorization Hooks in the Linux Security Modules Framework Vinod Ganapathy vg@cs.wisc.edu University of Wisconsin, Madison Joint work with Trent Jaeger tjaeger@cse.psu.edu Pennsylvania

More information

Exploits and gdb. Tutorial 5

Exploits and gdb. Tutorial 5 Exploits and gdb Tutorial 5 Exploits and gdb 1. Buffer Vulnerabilities 2. Code Injection 3. Integer Attacks 4. Advanced Exploitation 5. GNU Debugger (gdb) Buffer Vulnerabilities Basic Idea Overflow or

More information

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G.

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G. Scheme: Data CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, 2017 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks ggchappell@alaska.edu

More information

Software Security: Vulnerability Analysis

Software Security: Vulnerability Analysis Computer Security Course. Software Security: Vulnerability Analysis Program Verification Program Verification How to prove a program free of buffer overflows? Precondition Postcondition Loop invariants

More information

Operational Semantics. One-Slide Summary. Lecture Outline

Operational Semantics. One-Slide Summary. Lecture Outline Operational Semantics #1 One-Slide Summary Operational semantics are a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:

More information

Pointers (continued), arrays and strings

Pointers (continued), arrays and strings Pointers (continued), arrays and strings 1 Last week We have seen pointers, e.g. of type char *p with the operators * and & These are tricky to understand, unless you draw pictures 2 Pointer arithmetic

More information

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 CSE543 - Introduction to Computer and Network Security Module: Program Vulnerabilities Professor Trent Jaeger 1 Programming Why do we write programs? Function What functions do we enable via our programs?

More information

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Notation. The rules. Evaluation Rules So Far.

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Notation. The rules. Evaluation Rules So Far. Lecture Outline Operational Semantics of Cool COOL operational semantics Motivation Adapted from Lectures by Profs. Alex Aiken and George Necula (UCB) Notation The rules CS781(Prasad) L24CG 1 CS781(Prasad)

More information

Runtime Defenses against Memory Corruption

Runtime Defenses against Memory Corruption CS 380S Runtime Defenses against Memory Corruption Vitaly Shmatikov slide 1 Reading Assignment Cowan et al. Buffer overflows: Attacks and defenses for the vulnerability of the decade (DISCEX 2000). Avijit,

More information

CONTENTS: Array Usage Multi-Dimensional Arrays Reference Types. COMP-202 Unit 6: Arrays

CONTENTS: Array Usage Multi-Dimensional Arrays Reference Types. COMP-202 Unit 6: Arrays CONTENTS: Array Usage Multi-Dimensional Arrays Reference Types COMP-202 Unit 6: Arrays Introduction (1) Suppose you want to write a program that asks the user to enter the numeric final grades of 350 COMP-202

More information

Reading assignment: Reviews and Inspections

Reading assignment: Reviews and Inspections Foundations for SE Analysis Reading assignment: Reviews and Inspections M. E. Fagan, "Design and code inspections to reduce error in program development, IBM Systems Journal, 38 (2&3), 1999, pp. 258-287.

More information

Rubicon: Scalable Bounded Verification of Web Applications

Rubicon: Scalable Bounded Verification of Web Applications Joseph P. Near Research Statement My research focuses on developing domain-specific static analyses to improve software security and reliability. In contrast to existing approaches, my techniques leverage

More information

Advanced Systems Security: Principles

Advanced Systems Security: Principles Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:

More information

Lecture Notes on Arrays

Lecture Notes on Arrays Lecture Notes on Arrays 15-122: Principles of Imperative Computation July 2, 2013 1 Introduction So far we have seen how to process primitive data like integers in imperative programs. That is useful,

More information

A Smart Fuzzer for x86 Executables

A Smart Fuzzer for x86 Executables Università degli Studi di Milano Facoltà di Scienze Matematiche, Fisiche e Naturali A Smart Fuzzer for x86 Executables Andrea Lanzi, Lorenzo Martignoni, Mattia Monga, Roberto Paleari May 19, 2007 Lanzi,

More information

CMPSC 497: Midterm Review

CMPSC 497: Midterm Review CMPSC 497: Midterm Review Trent Jaeger Systems and Internet Infrastructure Security (SIIS) Lab Computer Science and Engineering Department Pennsylvania State University Page 1 Midterm Format True/False

More information

CSE 565 Computer Security Fall 2018

CSE 565 Computer Security Fall 2018 CSE 565 Computer Security Fall 2018 Lecture 15: Software Security II Department of Computer Science and Engineering University at Buffalo 1 Software Vulnerabilities Buffer overflow vulnerabilities account

More information

Lecture Notes on Memory Layout

Lecture Notes on Memory Layout Lecture Notes on Memory Layout 15-122: Principles of Imperative Computation Frank Pfenning André Platzer Lecture 11 1 Introduction In order to understand how programs work, we can consider the functions,

More information

Page 1. Reading assignment: Reviews and Inspections. Foundations for SE Analysis. Ideally want general models. Formal models

Page 1. Reading assignment: Reviews and Inspections. Foundations for SE Analysis. Ideally want general models. Formal models Reading assignment: Reviews and Inspections Foundations for SE Analysis M. E. Fagan, "Design and code inspections to reduce error in program development, IBM Systems Journal, 38 (2&3), 999, pp. 258-28.

More information

Pointers (continued), arrays and strings

Pointers (continued), arrays and strings Pointers (continued), arrays and strings 1 Last week We have seen pointers, e.g. of type char *p with the operators * and & These are tricky to understand, unless you draw pictures 2 Pointer arithmetic

More information

Information Flow Analysis and Type Systems for Secure C Language (VITC Project) Jun FURUSE. The University of Tokyo

Information Flow Analysis and Type Systems for Secure C Language (VITC Project) Jun FURUSE. The University of Tokyo Information Flow Analysis and Type Systems for Secure C Language (VITC Project) Jun FURUSE The University of Tokyo furuse@yl.is.s.u-tokyo.ac.jp e-society MEXT project toward secure and reliable software

More information

Symbolic Evaluation/Execution

Symbolic Evaluation/Execution Symbolic Evaluation/Execution Reading Assignment *R.W. Floyd, "Assigning Meaning to Programs, Symposium on Applied Mathematics, 1967, pp. 19-32 (Appeared as volume 19 of Mathematical Aspects of Computer

More information

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java

More information

Lecture Notes on Common Subexpression Elimination

Lecture Notes on Common Subexpression Elimination Lecture Notes on Common Subexpression Elimination 15-411: Compiler Design Frank Pfenning Lecture 18 October 29, 2015 1 Introduction Copy propagation allows us to have optimizations with this form: l :

More information

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

Why bother? Default configurations Buffer overflows Authentication mechanisms Reverse engineering Questions? Jeroen van Beek 1 Why bother? Default configurations Buffer overflows Authentication mechanisms Reverse engineering Questions? 2 Inadequate OS and application security: Data abuse Stolen information Bandwidth

More information

A brief introduction to C programming for Java programmers

A brief introduction to C programming for Java programmers A brief introduction to C programming for Java programmers Sven Gestegård Robertz September 2017 There are many similarities between Java and C. The syntax in Java is basically

More information

CS 161 Problem Set 4

CS 161 Problem Set 4 CS 161 Problem Set 4 Spring 2017 Due: May 8, 2017, 3pm Please answer each of the following problems. Refer to the course webpage for the collaboration policy, as well as for helpful advice for how to write

More information

Advanced Systems Security: Integrity

Advanced Systems Security: Integrity Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:

More information

Bouncer: Securing Software by Blocking Bad Input

Bouncer: Securing Software by Blocking Bad Input Bouncer: Securing Software by Blocking Bad Input Sathish Kuppuswamy & Yufei Fu Department of computer Science University of Texas at Dallas March 21 st, 2012 Outline Bouncer Existing Techniques Bouncer

More information

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

Module: Return-oriented Programming. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security CSE543 - Introduction to Computer and Network Security Module: Return-oriented Programming Professor Trent Jaeger 1 1 Anatomy of Control-Flow Exploits Two steps in control-flow exploitation First -- attacker

More information

Practical Verification of System Integrity in Cloud Computing Environments

Practical Verification of System Integrity in Cloud Computing Environments Practical Verification of System Integrity in Cloud Computing Environments Trent Jaeger Penn State NSRC Industry Day April 27 th, 2012 1 Overview Cloud computing even replaces physical infrastructure Is

More information

QUIZ. What is wrong with this code that uses default arguments?

QUIZ. What is wrong with this code that uses default arguments? QUIZ What is wrong with this code that uses default arguments? Solution The value of the default argument should be placed in either declaration or definition, not both! QUIZ What is wrong with this code

More information