Secure Remote Access: SSH. 2 What is SSH?  SSH – Secure Shell  SSH is a protocol for secure remote login and other secure network services over an insecure.

Slides:



Advertisements
Similar presentations
Cryptography and Network Security Chapter 16
Advertisements

Web security: SSL and TLS
Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
TLS Introduction 14.2 TLS Record Protocol 14.3 TLS Handshake Protocol 14.4 Summary.
Secure Socket Layer.
SSL CS772 Fall Secure Socket layer Design Goals: SSLv2) SSL should work well with the main web protocols such as HTTP. Confidentiality is the top.
Socket Layer Security. In this Presentation: need for web security SSL/TLS transport layer security protocols HTTPS secure shell (SSH)
An Introduction to Secure Sockets Layer (SSL). Overview Types of encryption SSL History Design Goals Protocol Problems Competing Technologies.
Transport Layer Security (TLS) Protocol Introduction to networks and communications(CS555) Prof : Dr Kurt maly Student:Abhinav y.
BASIC CRYPTOGRAPHY CONCEPT. Secure Socket Layer (SSL)  SSL was first used by Netscape.  To ensure security of data sent through HTTP, LDAP or POP3.
1 Supplement III: Security Controls What security services should network systems provide? Confidentiality Access Control Integrity Non-repudiation Authentication.
Cryptography and Network Security
CMPE208 Presentation Terminal Access Controller Access Control System Plus (TACACS+) By MARVEL (Libing, Bhavana, Ramya, Maggie, Nitin)
Chapter 5 Network Security Protocols in Practice Part I
IP Security IPSec 2 * Essential Network Security Book Slides. IT352 | Network Security |Najwa AlGhamdi 1.
Lecture 5: security: PGP Anish Arora CIS694K Introduction to Network Security.
Apr 2, 2002Mårten Trolin1 Previous lecture On the assignment Certificates and key management –Obtaining a certificate –Verifying a certificate –Certificate.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Cunsheng Ding HKUST, Hong Kong, CHINA
Telnet/SSH Tim Jansen, Mike Stanislawski. TELNET is short for Terminal Network Enables the establishment of a connection to a remote system, so that the.
SSH : The Secure Shell By Rachana Maheswari CS265 Spring 2003.
Secure Remote Access: SSH. K. Salah 2 What is SSH?  SSH – Secure Shell  SSH is a protocol for secure remote login and other secure network services.
EEC 688/788 Secure and Dependable Computing Lecture 8 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
EEC 688/788 Secure and Dependable Computing Lecture 7 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
The Secure Shell Protocol Jia Zhu Seminar WS 06/07 Computer Security Chair holder : Prof. Dr. Joachim von zur Gathen Tutor: Michael Nüsken, Daniel.
EEC 693/793 Special Topics in Electrical Engineering Secure and Dependable Computing Lecture 8 Wenbing Zhao Department of Electrical and Computer Engineering.
Alexander Potapov.  Authentication definition  Protocol architectures  Cryptographic properties  Freshness  Types of attack on protocols  Two-way.
Key-Stroke Timing and Timing Attack on SSH Yonit Shabtai and Michael Lustig supervisor: Yoram Yihyie Technion - Israel Institute of Technology Computer.
SSH Secure Login Connections over the Internet
Secure Socket Layer (SSL)
SSL / TLS in ITDS Arun Vishwanathan 23 rd Dec 2003.
Shell Protocols Elly Bornstein Hiral Patel Pranav Patel Priyank Desai Swar Shah.
Behzad Akbari Spring 2012 (These slides are based on lecture slides by Lawrie Brown)
Andreas Steffen, , 11-SSH.pptx 1 Internet Security 1 (IntSi1) Prof. Dr. Andreas Steffen M. Liebi Institute for Internet Technologies and Applications.
1 Chapter 8 Copyright 2003 Prentice-Hall Cryptographic Systems: SSL/TLS, VPNs, and Kerberos.
Cosc 4765 SSL/TLS and VPN. SSL and TLS We can apply this generally, but also from a prospective of web services. Multi-layered: –S-http (secure http),
Introduction to Secure Sockets Layer (SSL) Protocol Based on:
Network Security Essentials Chapter 5
Web Security : Secure Socket Layer Secure Electronic Transaction.
CSCE 815 Network Security Lecture 26 SSH and SSH Implementation April 24, 2003.
1 SSL - Secure Sockets Layer The Internet Engineering Task Force (IETF) standard called Transport Layer Security (TLS) is based on SSL.
Tunneling and Securing TCP Services Nathan Green.
1 Security Protocols in the Internet Source: Chapter 31 Data Communications & Networking Forouzan Third Edition.
Karlstad University IP security Ge Zhang
IPsec IPsec (IP security) Security for transmission over IP networks –The Internet –Internal corporate IP networks –IP packets sent over public switched.
Secure Shell (SSH) Presented By Scott Duckworth April 19, 2007.
SARVAJANIK COLLEGE OF ENGINEERING & TECHNOLOGY. Secure Sockets Layer (SSL) Protocol Presented By Shivangi Modi Presented By Shivangi ModiCo-M(Shift-1)En.No
1 SSH / SSL Supplementary material. 2 Secure Shell (SSH) One of the primary goals of the ARPANET was remote access Several different connections allowed.
IP security Ge Zhang Packet-switched network is not Secure! The protocols were designed in the late 70s to early 80s –Very small network.
SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.
IPSec and TLS Lesson Introduction ●IPSec and the Internet key exchange protocol ●Transport layer security protocol.
Group 9 Chapter 8.3 – 8.6. Public Key Algorithms  Symmetric Key Algorithms face an inherent problem  Keys must be distributed to all parties but kept.
1 SSL/TLS. 2 Web security Security requirements Secrecy to prevent eavesdroppers to learn sensitive information Entity authentication Message authentication.
Cryptography and Network Security (CS435) Part Thirteen (IP Security)
IPSec is a suite of protocols defined by the Internet Engineering Task Force (IETF) to provide security services at the network layer. standard protocol.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
SSH. 2 SSH – Secure Shell SSH is a cryptographic protocol – Implemented in software originally for remote login applications – One most popular software.
DMET 602: Networks and Media Lab Amr El Mougy Yasmeen EssamAlaa Tarek.
@Yuan Xue CS 285 Network Security Secure Socket Layer Yuan Xue Fall 2013.
Cryptography CSS 329 Lecture 13:SSL.
1 Example security systems n Kerberos n Secure shell.
PRESENTATION ON SECURE SOCKET LAYER (SSL) BY: ARZOO THAKUR M.E. C.S.E (REGULAR) BATCH
DMET 602: Networks and Media Lab
CSCI 555 Adv Computer Security
Secure Sockets Layer (SSL)
Module 4 Remote Login.
Originally by Yu Yang and Lilly Wang Modified by T. A. Yang
SSH: SECURE LOGIN CONNECTIONS OVER THE INTERNET
SSH – the practical solution
Presentation transcript:

Secure Remote Access: SSH

2 What is SSH?  SSH – Secure Shell  SSH is a protocol for secure remote login and other secure network services over an insecure network  developed by SSH Communications Security Corp., Finland  two distributions are available: – commercial version – freeware (  specified in a set of Internet drafts

3 Major SSH components  SSH Transport Layer Protocol – provides server authentication, confidentiality, and integrity services – it may provide compression too – runs on top of any reliable transport layer (e.g., TCP)  SSH User Authentication Protocol – provides client-side user authentication – runs on top of the SSH Transport Layer Protocol  SSH Connection Protocol – multiplexes the secure tunnel provided by the SSH Transport Layer and User Authentication Protocols into several logical channels – these logical channels can be used for a wide range of purposes secure interactive shell sessions TCP port forwarding carrying X11 connections

4 SSH security features  strong algorithms – uses well established strong algorithms for encryption, integrity, key exchange, and public key management  large key size – requires encryption to be used with at least 128 bit keys – supports larger keys too  algorithm negotiation – encryption, integrity, key exchange, and public key algorithms are negotiated – it is easy to switch to some other algorithm without modifying the base protocol

5 SSH TLP – Overview clientserver TCP connection setup SSH version string exchange SSH key exchange (includes algorithm negotiation) SSH data exchange termination of the TCP connection SSH Transport Layer Protocol

6 Connection setup and version string exchange  TCP connection setup – the server listens on port 22 – the client initiates the connection  SSH version string exchange – both side must send a version string of the following form: “SSH-protoversion-softwareversion comments” \CR \LF – used to indicate the capabilities of an implementation – triggers compatibility extensions – current protocol version is 2.0 – all packets that follow the version string exchange is sent using the Binary Packet Protocol SSH Transport Layer Protocol

7 Binary Packet Protocol – packet length: length of the packet not including the MAC and the packet length field – padding length: length of padding – payload: useful contents might be compressed max payload size is – random padding: 4 – 255 bytes total length of packet not including the MAC must be multiple of max(8, cipher block size) even if a stream cipher is used – MAC: message authentication code computed over the clear packet and an implicit sequence number packet length (4) padding length (1) random padding MAC payload (may be compressed) compression encryption SSH Transport Layer Protocol

8 Encryption  the encryption algorithm is negotiated during the key exchange  supported algorithms – 3des-cbc (required) (168 bit key) – blowfish-cbc (recommended) – twofish256-cbc (opt) / twofish192-cbc (opt) / twofish128-cbc (recomm) – aes256-cbc (opt) / aes192-cbc (opt) / aes128-cbc (recomm) – serpent256-cbc (opt) / serpent192-cbc (opt) / serpent128-cbc (opt) – arcfour (opt) (RC4) – idea-cbc (opt) / cast128-cbc (opt)  key and IV are also established during the key exchange  all packets sent in one direction is considered a single data stream – IV is passed from the end of one packet to the beginning of the next one  encryption algorithm can be different in each direction SSH Transport Layer Protocol

9 MAC  MAC algorithm and key are negotiated during the key exchange  supported algorithms – hmac-sha1 (required) [MAC length = key length = 160 bits] – hmac-sha1-96 (recomm) [MAC length = 96, key length = 160 bits] – hmac-md5 (opt) [MAC length = key length = 128 bits] – hmac-md5-96 (opt) [MAC length = 96, key length = 128 bits]  MAC algorithms used in each direction can be different  MAC = mac( key, seq. number | clear packet ) – sequence number is implicit, not sent with the packet – sequence number is represented on 4 bytes – sequence number initialized to 0 and incremented after each packet – it is never reset (even if keys and algs are renegotiated later) SSH Transport Layer Protocol

10 Key exchange - Overview clientserver execution of the selected key exchange protocol SSH_MSG_KEXINIT SSH_MSG_NEWKEYS uses new keys and algorithms for sending uses new keys and algorithms for receiving SSH Transport Layer Protocol

11 Algorithm negotiation  SSH_MSG_KEXINIT – kex_algorithms (comma separated list of names) – server_host_key_algorithms – encryption_algorithms_client_to_server – encryption_algorithms_server_to_client – mac_algorithms_client_to_server – mac_algorithms_server_to_client – compression_algorithms_client_to_server – compression_algorithms_server_to_client – first_kex_packet_follows (boolean) – random cookie (16 bytes)  algorithm lists – the server list the algorithms it supports – the client lists the algorithms that it is willing to accept – algorithms are listed in order of preference – selection: first algorithm on the client’s list that is also on the server’s list SSH Transport Layer Protocol

12 Deriving keys and IVs  any key exchange algorithm produces two values – a shared secret K – an exchange hash H  H from the first key exchange is used as the session ID  keys and IVs are derived from K and H as follows: – IV client to server = HASH( K | H | “A” | session ID ) – IV server to client = HASH( K | H | “B” | session ID ) – encryption key client to server = HASH( K | H | “C” | session ID ) – encryption key server to client = HASH( K | H | “D” | session ID ) – MAC key client to server = HASH( K | H | “E” | session ID ) – MAC key server to client = HASH( K | H | “F” | session ID )  where HASH is the hash function specified by the key exchange method (e.g., diffie-hellman-group1-sha1)  if the key length is longer than the output of HASH… – K1 = HASH( K | H | X | session ID ) – K2 = HASH( K | H | K1 ) – K3 = HASH( K | H | K1 | K2 ) – … – key = K1 | K2 | K3 | … SSH Transport Layer Protocol

13 Diffie-Hellman key exchange 1. – the client generates a random number x and computes e = g x mod p – the client sends e to the server 2. – the server generates a random number y and computes f = g y mod p – the server receives e from the client – it computes K = e y mod p = g xy mod p and H = HASH( client version string | server version string | client kex init msg | server kex init msg | server host key K srv | e | f | K ) – it generates a signature s on H using the private part of the server host key (may involve additional hash computation on H) – it sends ( K srv | f | s ) to the client 3. – the client verifies that K srv is really the host key of the server – the client computes K = f x mod p = g xy mod p and the exchange hash H – the client verifies the signature s on H SSH Transport Layer Protocol

14 Server authentication  based on the server’s host key K srv  the client must check that K srv is really the host key of the server  models – the client has a local database that associates each host name with the corresponding public host key – the host name – to – key association is certified by a trusted CA and the server provides the necessary certificates or the client obtains them from elsewhere – check fingerprint of the key over an external channel (e.g., phone) – best effort: accept host key without check when connecting the first time to the server save the host key in the local database, and check against the saved key on all future connections to the same server SSH Transport Layer Protocol

15 Key re-exchange  either party may initiate a key re-exchange – sending an SSH_MSG_KEXINIT packet when not already doing a key exchange  key re-exchange is processed identically to the initial key exchange – except for the session ID, which will remain unchanged  algorithms may be changed  keys and IVs are recomputed  encryption contexts are reset  it is recommended to change keys after each gigabyte of transmitted data or after each hour of connection time SSH Transport Layer Protocol

16 Service request  after key exchange the client requests a service  services – ssh-userauth – ssh-connection  when the service starts, it has access to the session ID established during the first key exchange SSH Transport Layer Protocol

17 SSH – User Authentication Protocol  the protocol assumes that the underlying transport protocol provides integrity and confidentiality (e.g., SSH Transport Layer Protocol)  the protocol has access to the session ID  the server should have a timeout for authentication and disconnect if the authentication has not been accepted within the timeout period – recommended value is 10 minutes  the server should limit the number of failed authentication attempts a client may perform in a single session – recommended value is 20 attempts  three authentication methods are supported – publickey – password – hostbased SSH User Authentication Protocol

18 User authentication overview  USERAUTH_REQUEST – user name – service name – method name – … method specific fields …  USERAUTH_FAILURE – list of authentication methods that can continue – partial success flag TRUE: previous request was successful, but further authentication is needed FALSE: previous request was not successful  USERAUTH_SUCCESS (authentication is complete, the server starts the requested service) clientserver SSH_MSG_USERAUTH_REQUEST SSH_MSG_USERAUTH_FAILURE (further authentication needed) SSH_MSG_USERAUTH_REQUEST SSH_MSG_USERAUTH_FAILURE (further authentication needed) … SSH_MSG_USERAUTH_REQUEST SSH_MSG_USERAUTH_SUCCESS SSH User Authentication Protocol

19 The “publickey” method  all implementations must support this method  however, most local policies will not require authentication with this method in the near future, as users don’t have public keys  authentication is based on demonstration of the knowledge of the private key (the client signs with the private key)  the server verifies that – the public key really belongs to the user specified in the authentication request – the signature is correct SSH User Authentication Protocol

20 The “publickey” method cont’d  SSH_MSG_USERAUTH_REQUEST – user name – service name – “publickey” – TRUE (a flag set to TRUE) – public key algorithm name (e.g., ssh-dss) – public key – signature (computed over the session ID and the data in the request)  the server responds with SSH_MSG_USERAUTH_FAILURE if the request failed or more authentication is needed, or SSH_MSG_USERAUTH_SUCCESS otherwise SSH User Authentication Protocol

21 The “publickey” method cont’d  using the private key – involves expensive computations – may require the user to type a password if the private key is stored in encrypted form on the client machine  in order to avoid unnecessary processing, the client may check whether authentication using the public key would be acceptable – SSH_MSG_USERAUTH_REQUEST user name service name “publickey” FALSE public key algorithm name public key – if OK then the server responds with SSH_MSG_USERAUTH_PK_OK SSH User Authentication Protocol

22 The “password” method  all implementations should support this method  this method is likely the most widely used  SSH_MSG_USERAUTH_REQUEST – user name – service name – “password” – FALSE (a flag set to FALSE) – password (plaintext)  the server may respond with SSH_MSG_USERAUTH_FAILURE, SSH_MSG_USERAUTH_SUCCESS, or SSH_MSG_USERAUTH_PASSWD_CHANGEREQ SSH User Authentication Protocol

23 The “password” method cont’d  changing the password – SSH_MSG_USERAUTH_REQUEST user name service name “password” TRUE old password (plaintext) new password (plaintext) SSH User Authentication Protocol

24 The “hostbased” method  authentication is based on the host where the user is coming from  this method is optional  the client sends a signature that has been generated with the private host key of the client  the server verifies that – the public key really belongs to the host specified in the authentication request – the signature is correct SSH User Authentication Protocol

25 The “hostbased” method cont’d  SSH_MSG_USERAUTH_REQUEST – user name – service name – “hostbased” – public key algorithm name – public key and certificates for client host – client host name – user name on client host – signature (computed over the session ID and the data in the request) SSH User Authentication Protocol

26 SSH – Connection Protocol  provides – interactive login sessions – remote execution of commands – forwarded TCP/IP connections – forwarded X11 connections  all these applications are implemented as “channels”  all channels are multiplexed into the single encrypted tunnel provided by the SSH Transport Layer Protocol  channels are identified by channel numbers at both ends of the connection  channel numbers for the same channel at the client and server sides may differ SSH Connection Protocol

27 Channel mechanisms  opening a channel – SSH_MSG_CHANNEL_OPEN channel type sender channel number initial window size maximum packet size … channel type specific data … – SSH_MSG_CHANNEL_OPEN_CONFIRMATION recipient channel number (sender channel number from the open request) sender channel number initial window size maximum packet size … channel type specific data … – SSH_MSG_CHANNEL_OPEN_FAILURE recipient channel number (sender channel number from the open request) reason code and additional textual information SSH Connection Protocol

28 Channel mechanisms cont’d  data transfer over a channel – SSH_MSG_CHANNEL_DATA recipient channel number data – SSH_MSG_CHANNEL_WINDOW_ADJUST recipient channel number bytes to add to the window size  closing a channel – SSH_MSG_CHANNEL_EOF recipient channel number (sent if the party doesn’t want to send more data) – SSH_MSG_CHANNEL_CLOSE recipient channel (receiving party must respond with an SSH_MSG_CHANNEL_CLOSE, the channel is closed if the party has sent and received the closing msg) SSH Connection Protocol

29 Channel mechanisms cont’d  channel type specific requests – SSH_MSG_CHANNEL_REQUEST recipient channel number request type want reply flag (TRUE if reply is needed) … request type specific data … – SSH_MSG_CHANNEL_SUCCESS recipient channel – SSH_MSG_CHANNEL_FAILURE recipient channel SSH Connection Protocol

30 Example: Starting a remote shell C  S: SSH_MSG_CHANNEL_OPEN channel type = “session” sender channel number = 5 initial window size maximum packet size C  S: SSH_MSG_CHANNEL_OPEN_CONFIRMATION recipient channel number = 5 sender channel number = 21 initial window size maximum packet size SSH Connection Protocol

31 Example: Starting a remote shell cont’d C  S: SSH_MSG_CHANNEL_REQUEST recipient channel number = 21 request type = “pty-req” (pseudo terminal request) want reply flag = TRUE TERM environment variable value (e.g., vt100) terminal width in characters (e.g., 80) terminal height in rows (e.g., 24) … C  S: SSH_MSG_CHANNEL_SUCCESS recipient channel number = 5 SSH Connection Protocol

32 Example: Starting a remote shell cont’d C  S: SSH_MSG_CHANNEL_REQUEST recipient channel number = 21 request type = “shell” want reply flag = TRUE C  S: SSH_MSG_CHANNEL_SUCCESS recipient channel number = 5 C  S: SSH_MSG_CHANNEL_DATA, SSH_MSG_CHANNEL_WINDOW_ADJUST … SSH Connection Protocol