Project #4: MITM Attacks and Authentication



Similar documents
CS255 Programming Project 2

Programming Project #1

Introduction to Mobile Access Gateway Installation

Accessing PostgreSQL through JDBC via a Java SSL tunnel

CHAPTER 7 SSL CONFIGURATION AND TESTING

SSL Configuration on Weblogic Oracle FLEXCUBE Universal Banking Release [August] [2014]

PowerChute TM Network Shutdown Security Features & Deployment

Configuration Manual

DEVELOPING CERTIFICATE-BASED PROJECTS FOR WEB SECURITY CLASSES *

Integrating EJBCA and OpenSSO

SafeNet KMIP and Google Cloud Storage Integration Guide

Design Notes for an Efficient Password-Authenticated Key Exchange Implementation Using Human-Memorable Passwords

MassTransit 6.0 Enterprise Web Configuration for Macintosh OS 10.5 Server

Universal Content Management Version 10gR3. Security Providers Component Administration Guide

TIBCO Runtime Agent Domain Utility User s Guide Software Release November 2012

Citrix Receiver for Mobile Devices Troubleshooting Guide

NAT & Secure Sockets SSL/ TLS. ICW: Lecture 6 Tom Chothia

Enabling SSL and Client Certificates on the SAP J2EE Engine

Remote Access for LAPD Users Using Aventail SSL VPN

KMIP installation Guide. DataSecure and KeySecure Version SafeNet, Inc

Project 4: IP over DNS Due: 11:59 PM, Dec 14, 2015

all you need to know about Node Manager for by Jacco H. Landlust zaterdag 8 december 12

RHEV 2.2: REST API INSTALLATION

Programming Project #2. Network Security (TCP/IP and DNS) Overview. Overview. Man in the Middle. Proxy Server. Tadayoshi Kohno

Implementing and Administering Security in a Microsoft Windows Server 2003 Network

SSL SSL VPN

Network Security (TCP/IP and DNS)

Astaro Security Gateway V8. Remote Access via SSL Configuring ASG and Client

SafeNet KMIP and Amazon S3 Integration Guide

Copyright 2013 EMC Corporation. All Rights Reserved.

Configuring Secure Socket Layer (SSL)

Tech Titans: Lock it down, securing your Costpoint 7 deployments. Drew Roman, IT Solutions Director WJ Technologies L.L.C. GC-518

To install and configure SSL support on Tomcat 6, you need to follow these simple steps. For more information, read the rest of this HOW-TO.

Preface. Limitations. Disclaimers. Technical Support. Luna SA and IBM HTTP Server/IBM Web Sphere Application Server Integration Guide

Configuration Guide. BlackBerry Enterprise Service 12. Version 12.0

GoToMyPC Corporate Advanced Firewall Support Features

Using Entrust certificates with VPN

What in the heck am I getting myself into! Capitalware's MQ Technical Conference v

Use Enterprise SSO as the Credential Server for Protected Sites

JAVA 2 Network Security

Using RADIUS Agent for Transparent User Identification

7.1. Remote Access Connection

Angel Dichev RIG, SAP Labs

Unifying Information Security. Implementing TLS on the CLEARSWIFT SECURE Gateway

Server Software Installation Guide

Introduction to Network Security Lab 1 - Wireshark

Integrated SSL Scanning

Installation valid SSL certificate

Setup Guide Access Manager 3.2 SP3

Sun Java System Web Server 6.1 Using Self-Signed OpenSSL Certificate. Brent Wagner, Seeds of Genius October 2007

DMH remote access. Table of Contents. Project : remote_access_dmh Date: 29/05/12 pg. 1

How to Secure a Groove Manager Web Site

Configuration Guide BES12. Version 12.1

Appendix D: Configuring Firewalls and Network Address Translation

LDAP User Guide PowerSchool Premier 5.1 Student Information System

Using LDAP Authentication in a PowerCenter Domain

Installing and Configuring vcloud Connector

Table of Contents. Chapter 1: Installing Endpoint Application Control. Chapter 2: Getting Support. Index

CA Performance Center

Clearswift Information Governance

Chapter 1: How to Configure Certificate-Based Authentication

Configuration Guide BES12. Version 12.2

Background (

SSL Certificate Generation

LoadMaster SSL Certificate Quickstart Guide

Secure Communication Requirements

Oracle Exam 1z0-102 Oracle Weblogic Server 11g: System Administration I Version: 9.0 [ Total Questions: 111 ]

High Security Online Backup. A Cyphertite White Paper February, Cloud-Based Backup Storage Threat Models

Crypto Lab Public-Key Cryptography and PKI

OnCommand Performance Manager 1.1

Enterprise Content Management System Monitor 5.1 Security Considerations Revision CENIT AG Brandner, Marc

Cyber Security Workshop Ethical Web Hacking

Quick Start Guide. Cerberus FTP is distributed in Canada through C&C Software. Visit us today at

Using EMC Unisphere in a Web Browsing Environment: Browser and Security Settings to Improve the Experience

Exploiting the Web with Tivoli Storage Manager

Server Installation ZENworks Mobile Management 2.7.x August 2013

Configuring TLS Security for Cloudera Manager

SSL VPN Technology White Paper

CSEE 4119: Computer Networks, Spring 2014

The Security Framework 4.1 Programming and Design

What is the Barracuda SSL VPN Server Agent?

Acano solution. Virtualized Deployment R1.1 Installation Guide. Acano. February B

Installing Management Applications on VNX for File

Configuration Guide BES12. Version 12.3

Repeater. BrowserStack Local. browserstack.com 1. BrowserStack Local makes a REST call using the user s access key to browserstack.

Forward proxy server vs reverse proxy server

SSL Inspection Step-by-Step Guide. June 6, 2016

Oracle. NoSQL Database Security Guide. 12c Release 1

IBM Unica emessage Version 8 Release 6 February 13, Startup and Administrator's Guide

Security: Focus of Control. Authentication

An Oracle White Paper September Oracle WebLogic Server 12c on Microsoft Windows Azure

Wakanda Studio Features

PrinterOn Print Delivery Station Admin Guide

Project X Mass interception of encrypted connections

WHITE PAPER Citrix Secure Gateway Startup Guide

FileBench's Multi-Client feature

GlobalSCAPE DMZ Gateway, v1. User Guide

Security Correlation Server Quick Installation Guide

Internet Banking System Web Application Penetration Test Report

Transcription:

Project #4: MITM Attacks and Authentication CS 645: Network Security Due: August 31, 2012 11:59 pm EST August 15, 2013 This project is based on a project designed by Dan Boneh for his class (cs 255) and used by Yoshi Kohno in his class (cse 484). Thanks Dan and Yoshi. 1 Overview 1.1 Introduction For programming project 4, you will implement a man-in-the-middle (MITM) attack on SSL, using an SSL proxy server. You will also implement a simple (command-line) administrative interface for the proxy that will make use of password authentication. This project is for educational purposes only, and should never be used outside of this class. Conducting real attacks in unethical. While the attacks you will be writing are somewhat outdated, as you will see, they can still be effective on some browsers. 1.2 Background Recall that an eavesdropper on an SSL connection has little power because of the encryption being used, but if an attacker is able to trick the user into using the attacker s public key rather than the intended receipient s, this security is lost. While a real attacker would likely intercept and manipulate the network packets direcly to implement this attack, you will be making an SSL proxy. After a client (i.e., a web browser) is configured to make use of an SSL proxy, all client SSL requests are intercepted by the proxy and relayed to the intended remote webserver. After an initial plaintext proxy CONNECT request by the client, normally the proxy just forwards the encrypted data to the server. However, instead of forwarding the initial request to the remote server, your proxy will setup its own connection with the remote server and setup a connection to the client using its own certificate. Then all traffic between the (client AND proxy) and the (proxy AND web-server) is SSL encrypted, but with different keys. This means that the proxy has access to the plaintext data sent and received by the client. Having the proxy use a single, fixed SSL server certificate is not ideal, though, because modern web browsers check the common name (CN) field of the certificate against the domain name of the remote server and check to make sure serial numbers are not duplicated. So, to mount a more transparent MITM attack, the proxy will have to generate new server certificates on the fly, for each new client request. Web browsers will still complain once that the certificate is not trusted, but if the user clicks past this warning, then the attacker wins. Note: this attack will not work well on Firefox 3 or later because it disallows the use of self-signed certificates. You should test your code on another browser (Firefox 2, Konqueror, Safari, IE 7, probably others). You will be learning: keytool (command line utility) to generate and manage keys and certificates. 1

IAIK-JCE APIs to create and sign certificates programmatically. JSSE (Java Secure Socket Extension) to do secure networking. 1.3 Requirements We will provide you with code for a basic SSL proxy, and you will need to do the following : Build and use a public key infrastructure using X509 certificates. Modify the SSL proxy to dynamically generate new SSL server certificates, based on the domain name of the requested remote web server and the serial number of the website s certificate. Implement password authentication, over an SSL connection, for a simple administrative interface. We will examine each of these features in detail below. 2 Description 2.1 Secure communication You will be working with network sockets. The JCE provides an abstraction for secure sockets in the javax.net.ssl package and this relieves us from explicitly performing the key exchange, encryption and integrity of the messages transferred over these sockets. 2.2 Public Key Infrastructure 2.2.1 Offline Key Generation The SSL proxy has a public/private key pair which is generated offline using keytool. The keytool is used to generate a keystore for each entity in the system. Before the system is bootstrapped, you will have to generate a public/private key pair for the SSL proxy. The public key of the proxy is self-signed. 2.2.2 Generating new server certificates After connecting to a remote webserver, the proxy will have to create a new server certificate which has the same common name (CN) field and serial number as the remote webserver s certificate. This new certificate will then be presented to the client, for use in an SSL session. You will use classes from the IAIK library to create and sign these new server certificates. 2.3 Password Authentication In addition to implementing the MITM attack with the proxy server, you will implement a simple remote administrative interface for the proxy server, which uses password authentication. This will allow the hacker to remotely log into the server and issue commands. In order to ensure only those users the attacker has authorized can log in, the interface will use password authentication. To connect to the proxy server, the administrative program will setup an SSL connection to the proxy server and transmit the hacker s username, password, and command. The proxy server maintains a password file, which contains a list of authorized usernames and passwords, stored salted and hashed. When the proxy receives a log in request, it should compare the hash of the received password with the stored hash from the appropriate user, allowing the user to proceed if they match, otherwise closing the connection. Once the admin client is authenticated, the appropriate command should be executed. You will need to implement the following commands: shutdown: shutdown the MITM proxy server 2

stats: List how many requests were proxied These should be easy commands to implement. The most important aspect of this part of the assignment is handling user authentication. 2.4 System Setup There are four main types of entities in our system: the user s web browser, the remote webserver the user is attempting to connect to, the proxy server intercepting the connection, and the administrative client to the proxy server. Once the proxy server is started and begins listening for connections, the user s web browser should be configured to use an SSL proxy with the hostname and port used by the MITMProxyServer. All SSL connections by the web browser will then be routed through the proxy server. (You don t need to proxy non-ssl connections.) When the browser attempts to make an SSL connection, the proxy will parse the CONNECT request and make its own SSL connection to the requested server. The proxy will use the connection to obtain the remote server s certificate. The proxy will then create a forged certificate which copies the entries in the remote server s certificate (e.g., its Common Name and Serial Number). The proxy then signs this generated certificate with its self signed CA certificate (loaded from a keystore specified at startup). It then passes this generated certificate back to the web browser, setting up an SSL connection between itself and the browser. The proxy then passes data, which it of course sees in the clear, between the two connections. In addition to listening for connections from web browsers, the proxy server listens for connections from the admin client on a separate port. When the admin client wants to connect to the proxy server, it opens an SSL connection to the proxy on its hostname and admin port and transmits a username and password. The proxy server then consults its password file (specified at startup and stored on disk) and authenticates the user. The password file should be encrypted using an authenticated encryption scheme and a key derived from a separate password; the password should be specified on startup. 3 Implementation We have provided you with starter code. The starter code illustrates the basic socket and thread programming. See the following section for links of tutorials on socket and thread programming. In addition to Sun Java JCE library, you need IAIK JCE extension library to create and sign X509 certificates. The library is included in the starter code. 3.1 Description of the code Here is a brief description of some of the starter code. The files you need to modify are in bold and have a * in front of them: 3

File Description * Makefile Makefile for the project; modify this file to compile new classes that you add. * MITMProxyServer.java Starts up the SSL proxy server. * HTTPSProxyEngine.java The core SSL proxy code. * MITMSSLSocketFactory.java Used in the creation of new SSL sockets. * MITMAdminClient.java Command line tool for remotely accessing the proxy server. * MITMAdminServer.java Creates connections with authorized admin clients. ProxyDataFilter.java Logs the (plaintext) data exchanged between the client and remote webserver. ConnectionDetails.java Holds information about the two endpoints of a TCP connection. CopyStreamRunnable.java Blindly copies data from an InputStream to an OutputStream. MITMPlainSocketFactory.java Used to create unencrypted sockets, to handle the initial browser proxy CONNECT request. ProxyEngine.java Abstract parent class of HTTPSProxyEngine. StreamThread.java Copies data from an InputStream to an OutputStream, using a ProxyDataFilter to record the data that s being streamed through Of course, you can also add new files. For example,, you will need to add a class which reads a file of admin-client usernames and passwords, and generates an encrypted file using a key generated from the proxy password. This class is run separately from the above framework and is needed to precompute the encrypted file which has a list of usernames and the corresponding authentication information. 3.2 Running the code You should spend some time getting familiar with the provided framework and reading the comments in the starter code. You will need to copy the cs645-pp4.tar.gz file to your account. You will also need to source setup.csh to set your path and classpath correctly. Change your browser settings to make use of an SSL proxy. You don t need to proxy non-ssl traffic. Start the SSL Proxy: % java mitm.mitmproxyserver -keystore [yourkeystore] -keystorepassword [kspwd] -outputfile [logfile] & Run an admin client: %java mitm.mitmadminclient -username [user] -userpassword [pwd] -cmd [cmd]& 3.3 Crypto Libraries and Documentation In addition to java.security and javax.crypto, some classes in iaik.x509 and iaik.asn1.structures are also needed to do certificate management. Important note: We require that your submission work with the Java API version on the Linux machines in the computer lab. Alse, use the version of the IAIK library provided by us. The following are some links to useful documentation : Java API http://java.sun.com/j2se/1.5.0/docs/api IAIK-JCE API http://javadoc.iaik.tugraz.at/iaik_jce/current/index.html Java Keytool Manual http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/keytool.html JCE Reference Guide http://java.sun.com/j2se/1.5.0/docs/guide/security/jce/jcerefguide. html 4

JSSE Reference Guide http://java.sun.com/j2se/1.5.0/docs/guide/security/jsse/jsserefguide. html Sun Tutorial on Socket Programming http://java.sun.com/docs/books/tutorial/networking/ sockets/ Sun Tutorial on Thread Programming http://java.sun.com/docs/books/tutorial/essential/threads/ Some classes/interfaces you may want to take a look at: java.security.securerandom java.security.keystore java.security.publickey java.security.privatekey javax.net.ssl.keymanagerfactory javax.net.ssl.keymanager javax.net.ssl.trustmanagerfactory javax.net.ssl.trustmanager java.net.serversocket java.net.socket javax.net.ssl.sslsocket javax.net.ssl.sslserversocket javax.net.ssl.sslsocketfactory javax.net.ssl.sslcontext javax.net.ssl.sslsessioncontext java.security.cert.certificate java.security.cert.x509certificate iaik.x509.x509certificate iaik.asn1.asn1object iaik.asn1.structures.algorithmid iaik.asn1.structures.name 4 Miscellaneous We encourage you to discuss socket programming, Java, SSL, Java and SSL, etc. The goal is to learn as much as possible, and we firmly believe that people learn by both doing (this project) and by sharing ideas and thoughts with others. You may work in groups of up to three people. You can use the same groups as for the other projects. Or you can form new groups. 5

4.1 Deliverables In addition to your well-decomposed, well-commented solution to the assignment, you should submit a README containing the names of the people in your group. In your README you should also include a description of your final design, as well as any design choices that you made in implementing each of the required security features. Please also include a sequence of steps which will be required to run your system. all the keystores you have created and list their names and passwords in the README. a copy of a proxy log file (take care not to leave any passwords or credit card numbers in it!) If I cannot get your system to work (quickly) on the lab machines, your grade will be lowered. To get (some) credit for the assignment I will arrange for you to demo the project to me in the lab. Finally, please write a short answer to the following: Why is this attack less successful on Firefox 3 (and later)? What are the advantages and disadvantages of their approach? How else might you change a web browser to make it less likely that a user would be fooled by an attack like the one you implemented? This is an important question to ask because when dealing with security, we never just build attacks we also need to think of ways to prevent them. Turn in a.tar.gz of all your files using bbvista. Late policy: Your grade will be reduced by 20% for each day the project is late. 5 Grading The most important aspect of this assignment is the security design choices that you make, so make sure to document that well in your README. Next, the implementation has to be correct and it needs to work as specified. I am not going to debug your setup or java code. Usability matters. Completeness matters: your project should include all required parts. Coding style, elegance, and efficiency will be secondary considerations. 6