Security & Trusting Trust Swarun Kumar Based on slides courtesy: Jorge Simosa MIT 6.033 Spring 2013.

Slides:



Advertisements
Similar presentations
COS 461 Fall 1997 Todays Lecture u intro to security in networking –confidentiality –integrity –authentication –authorization u orientation for assignment.
Advertisements

Last Class: The Problem BobAlice Eve Private Message Eavesdropping.
More on SSL/TLS. Internet security: TLS TLS is one of the more prominent internet security protocols. TLS is one of the more prominent internet security.
Countering Trusting Trust with Diverse Double-Compiling (by David A Wheeler) Dan Frohlich.
1 Topic 1 – Lesson 3 Network Attacks Summary. 2 Questions ► Compare passive attacks and active attacks ► How do packet sniffers work? How to mitigate?
Reflections on Trusting Trust Ken Thompson. Communication of the ACM, Vol. 27, No. 8, August 1984, pp Copyright 1984, Association for Computing.
Mar 12, 2002Mårten Trolin1 This lecture Diffie-Hellman key agreement Authentication Certificates Certificate Authorities SSL/TLS.
19.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 19: Security The Security Problem Authentication Program Threats.
Security: Attacks. 2 Trojan Horse Malicious program disguised as an innocent one –Could modify/delete user’s file, send important info to cracker, etc.
Block Ciphers 1 Block Ciphers Block Ciphers 2 Block Ciphers  Modern version of a codebook cipher  In effect, a block cipher algorithm yields a huge.
CMSC 414 Computer and Network Security Lecture 6 Jonathan Katz.
UCB Security Jean Walrand EECS. UCB Outline Threats Cryptography Basic Mechanisms Secret Key Public Key Hashing Security Systems Integrity Key Management.
CMSC 414 Computer (and Network) Security Lecture 2 Jonathan Katz.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Analysis of Algorithms. Time and space To analyze an algorithm means: –developing a formula for predicting how fast an algorithm is, based on the size.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
EEC 693/793 Special Topics in Electrical Engineering Secure and Dependable Computing Lecture 7 Wenbing Zhao Department of Electrical and Computer Engineering.
CSE331: Introduction to Networks and Security Lecture 24 Fall 2002.
CMSC 414 Computer and Network Security Lecture 19 Jonathan Katz.
CMSC 414 Computer and Network Security Lecture 24 Jonathan Katz.
More on AuthenticationCS-4513 D-term More on Authentication CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
EEC 688/788 Secure and Dependable Computing Lecture 7 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
CMSC 414 Computer and Network Security Lecture 6 Jonathan Katz.
Introduction Algorithms and Programming. Computer Programming  A form of problem solving  Or, more accurately, a way to solve problems  What we will.
CPSC 441 TUTORIAL TA: FANG WANG NETWORK SECURITY.
Lecture 6: Public Key Cryptography
13.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 13 Digital Signature.
1 Chapter-01 Introduction to Computers and C++ Programming.
CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Networks and Security. Types of Attacks/Security Issues  Malware  Viruses  Worms  Trojan Horse  Rootkit  Phishing  Spyware  Denial of Service.
Malicious Code Brian E. Brzezicki. Malicious Code (from Chapter 13 and 11)
1 Precise Enforcement of Policies After we have a policy, is there always a mechanism to enforce it? If so, can we devise a generic procedure for developing.
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
Chapter 31 Cryptography And Network Security Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Presented by: Suparita Parakarn Kinzang Wangdi Research Report Presentation Computer Network Security.
Network Security – Special Topic on Skype Security.
The TAOS Authentication System: Reasoning Formally About Security Brad Karp UCL Computer Science CS GZ03 / M th November, 2008.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
Linux Security. Authors:- Advanced Linux Programming by Mark Mitchell, Jeffrey Oldham, and Alex Samuel, of CodeSourcery LLC published by New Riders Publishing.
Digital Signatures, Message Digest and Authentication Week-9.
Security CS Introduction to Operating Systems.
1 Needham-Schroeder A --> S: A,B, N A S --> A: {N A,B,K AB,{K AB,A} KBS } KAS A --> B:{K AB,A} KBS B --> A:{N B } KAB A --> B:{N B -1} KAB.
Authentication Issues and Solutions CSCI 5857: Encoding and Encryption.
CRYPTOGRAPHY. WHAT IS PUBLIC-KEY ENCRYPTION? Encryption is the key to information security The main idea- by using only public information, a sender can.
Public Key Infrastructure (PKI) Chien-Chung Shen
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Network Security Continued. Digital Signature You want to sign a document. Three conditions. – 1. The receiver can verify the identity of the sender.
Agenda Computer Languages How to Write a Simple C Program
By: Cheryl Mok & Sarah Tan. Java is partially interpreted. 1. Programmer writes a program in textual form 2. Runs the compiler, which converts the textual.
27-Jan-16 Analysis of Algorithms. 2 Time and space To analyze an algorithm means: developing a formula for predicting how fast an algorithm is, based.
SEMINAR ON IP SPOOFING. IP spoofing is the creation of IP packets using forged (spoofed) source IP address. In the April 1989, AT & T Bell a lab was among.
Reflections on Trusting Trust Ken Thompson. Overview Introduction Introduction “Cutest Program” “Cutest Program” Stage 1 Stage 1 Stage 2 Stage 2 Stage.
Identify Friend or Foe (IFF) Chapter 9 Simple Authentication protocols Namibia Angola 1. N 2. E(N,K) SAAF Impala Russian MIG 1 Military needs many specialized.
Quiz 2 Post-Mortem Bruce Maggs. 2 Create a new BitCoin address, and use it only once. E.g., create a new wallet. Create a new address and mine a BitCoin.
SECURITY. Security Threats, Policies, and Mechanisms There are four types of security threats to consider 1. Interception 2 Interruption 3. Modification.
CIS 234: Object-Oriented Programming with Java
Why don’t programmers have to program in machine code?
Computational Thinking, Problem-solving and Programming: General Principals IB Computer Science.
Computer Programming.
Introduction to Information Security
Assembler, Compiler, Interpreter
Computers: Hardware and Software
Assembler, Compiler, Interpreter
Analysis of Algorithms
CS-3013 Operating Systems Hugh C. Lauer
Analysis of Algorithms
Crisis and Aftermath Morris worm.
Reflections on Trusting Trust by Ken Thomson
Analysis of Algorithms
Presentation transcript:

Security & Trusting Trust Swarun Kumar Based on slides courtesy: Jorge Simosa MIT Spring 2013

Reflections on Trusting Trust By Ken Thompson (UNIX paper, co-invented C and UNIX) Key Ideas: Difficult to know what the software you use actually does. So write all of software yourself!... but that’s overwhelmingly impractical! No choice but to trust software from certain sources.

What’s a compiler? Transforms a code written in one language to another … usually from higher-level language (e.g. C) into machine code New Compilers provide new features, new optimizations C.1 App.c (written in C.1) App.exe Input: Source Code Output: New Compiler Binary Program: A Compiler (e.g. gcc)

But where do compilers come from? To write a new compiler say for C.2 (C version 2.0) Write the program source for C.2 in the C.1 language Feed it into the C.1 compiler Resulting binary is a new compiler C.2 Chicken-and-egg: But where did the first compiler C.0 come from? C.1 C.2 (written in C.1) C.2 Input: Source Code Output: New Compiler Binary Program: Old Compiler

Example: C.2 has a new feature! C.2: Accepts vertical tab ‘\v’ as a special character, like ‘\n’ and ‘\t’ Source of C.2 (written in C.1): if(c[0] == ‘\\’ && c[1] == ‘n’) return ‘\n’; if(c[0] == ‘\\’ && c[1] == ‘v’) return 11; // Note we are using 11, since C.1 doesn’t recognize ‘\v’ Output: The new compiler (C.2) can compile programs with ‘\v’

Interestingly, C.2 can now compile itself! if(c[0] == ‘\\’ && c[1] == ‘n’) return ‘\n’; if(c[0] == ‘\\’ && c[1] == ‘v’) return 11; if(c[0] == ‘\\’ && c[1] == ‘n’) return ‘\n’; if(c[0] == ‘\\’ && c[1] == ‘v’) return ‘\v’; Input: Source of C.2 written in C.1 Input: Source of C.2 written in C.2! C.1 C.2 Program: Output:

So, can we discard old source of C.1/C.2? No! Because: C.2 may contain a hidden backdoor! e.g. a “master” password for all UNIX logins So what? … Why not patch that up in C.3? C.2 can infect C.3, C.4, etc… without leaving any evidence in their source code

How can C.2 infect other compilers? Source of C.2+Trojan: if(matches login code) return (login with master password); if(matches C compiler) return (C compiler with hidden backdoor); Input: Login Code => Output: Login with master password Input: C.3 compiler => Output: C.3 compiler backdoor Input: Regular C code => Output: Regular executable

How can we detect Trojans? C.2 C.3 C.2’ C.3 C.3’ Do we expect C.3 == C.3’ ? Output-1 Output-2 Not necessary C.2, C.2’ may differ in optimizations But must be functionally identical C.3 C.3’’ C.3’ C.3 C.3’’’ Output-1 Output-2 Do we expect C.3’’ == C.3’’’ ? Yes, absolutely! C.3, C.3’ give same output with same input If not, one of C.2, C.2’ has a Trojan/bug

Quiz 3 (2010) – Q8 Answer True/False based on the Trusting Trust paper: A. Thompson believes that self-reproducing programs shouldn’t be trusted. Answer: False. He doesn’t say anything about making them more or less trustworthy. Talks about programs in general.

Quiz 3 (2010) – Q8 Answer True/False based on the Trusting Trust paper: B. A Trojan horse like the one Thompson describes could not have been hidden in a compiler for a more modern language like Java. Answer: False. Backdoor is not language-specific.

Quiz 3 (2010) – Q8 Answer True/False based on the Trusting Trust paper: C. The Trojan horse Thompson embedded in the login program could have been found by looking at the machine instructions being executed by the CPU. Answer: True. Even though it might take a long time to figure out what the binary is doing.

Quiz 3 (2010) – Q8 Answer True/False based on the Trusting Trust paper: D. A programmer can prevent the type of attack Thompson describes by writing all of his or her programs in assembly code. Answer: False. Assembly code is still considered a “higher-language”, since it must be translated to machine code/instructions through an assembler.

Quiz 3 (2012) – Q13 Ben has Ken’s compiler (B) and its “supposed” source (S). He wants to know if it still has the login Trojan. His friend Alyssa has a clean compiler binary (A). The source code for the UNIX login program is L. Give an example of two compilation chains that can be compared to detect a possible Trojan? Notation: X -> Y is the result of using binary X to compile source Y B -> S = A -> S NO, they might make different optimizations, i.e. not the same output

Quiz 3 (2012) – Q13 Ben has Ken’s compiler (B) and its “supposed” source (S). He wants to know if it still has the login Trojan. His friend Alyssa has a clean compiler binary (A). The source code for the UNIX login program is L. Give an example of two compilation chains that can be compared to detect a possible Trojan? Notation: X -> Y is the result of using binary X to compile source Y B -> S -> S = A -> S -> S YES, if A and B have no Trojans, the intermediate output (new binary) should produce the same output when using the same input (S)

Quiz 3 (2012) – Q13 Ben has Ken’s compiler (B) and its “supposed” source (S). He wants to know if it still has the login Trojan. His friend Alyssa has a clean compiler binary (A). The source code for the UNIX login program is L. Give an example of two compilation chains that can be compared to detect a possible Trojan? Notation: X -> Y is the result of using binary X to compile source Y B -> S = A -> S -> S YES, since B should already be a compiled version of S, we can skip the step of B -> S

Quiz 3 (2012) – Q13 Ben has Ken’s compiler (B) and its “supposed” source (S). He wants to know if it still has the login Trojan. His friend Alyssa has a clean compiler binary (A). The source code for the UNIX login program is L. Give an example of two compilation chains that can be compared to detect a possible Trojan? Notation: X -> Y is the result of using binary X to compile source Y B -> S -> L = A -> S -> L YES, similar to second answer, we can instead feed just the login source

Quiz 3 (2012) – Q13 Ben has Ken’s compiler (B) and its “supposed” source (S). He wants to know if it still has the login Trojan. His friend Alyssa has a clean compiler binary (A). The source code for the UNIX login program is L. Give an example of two compilation chains that can be compared to detect a possible Trojan? Notation: X -> Y is the result of using binary X to compile source Y B -> L = A -> S -> L YES, similar to fourth answer, but we can skip the step of B -> S

More Past Quizzes (Trusting Trust) Visit Q3 - #13 (Section 6) 2010 Q3 - # Q3 - #13-15 (Section 3) 2008 Q3 - #5 (Section 3) 2006 Q3 - #2 *There may be more that I have accidentally overlooked.

Security (Part 2)

Secure Channels Alice wants to authenticate message m sent to Bob First cut for security: Let k be a shared key Then Alice, besides m, sends y = H(“m|k”) where | is a delimiter Bob verifies if y == H(“m|k”), since he also has k How can Alice and Bob securely exchange the key k?

Diffie-Hellman key exchange Both Alice and Bob have the same key k, without sending it on the network Alice Bob random a random b k = (g a ) b = g ab mod p k = (g b ) a = g ba mod p g a mod p g b mod p

Taking it a step further… Use Public/Secret Keys (… like many of you in DP2) Can use a PK/SK to authenticate the shared key exchange Can use PK/SK based signatures Many more attacks possible (DOS, TCP SYN flooding, Botnets) Security is an arms-race… So, Fewer assumptions in threat model => stronger security

GOOD LUCK ON QUIZ 2!