Network Security 18EC821)
Network Security 18EC821)
Transport-Level Security
Mr. Darshan B D
Assistant Professor,
Dept. of ECE
Transport-Level Security
• Note that the MAC is computed before encryption takes place and that the
MAC is then encrypted along with the plaintext or compressed plaintext.
• For block encryption, padding may be added after the MAC prior to
encryption.
• It is the simplest.
• This protocol consists of a single
message which consists of a single byte
with the value 1.
• Purpose of this message is to cause the
pending state to be copied into the
current state
Alert Protocol
• close_notify: Notifies the recipient that the sender will not send
any more messages on this connection. Each party is required to
send a close_ notify alert before closing the write side of a
connection.
SSLv3 uses the same algorithm, except that the padding bytes
are concatenated with the secret key rather than being XORed with
the secret key padded to the block length
• For TLS, the MAC calculation encompasses the fields
indicated in the following expression:
• MAC(MAC_write_secret,seq_num || TLSCompressed.type ||
TLSCompressed.version || TLSCompressed.length ||
TLSCompressed.fragment)
• master_secret =
PRF(pre_master_secret,"master secret",
ClientHello.random || serverHello.random)
SecurityParameters.client_random)
Padding
Host keys
• It is a cryptographic key used for
authenticating computers in the
SSH protocol.
• Host keys are key pairs, typically using
the RSA, DSA, or ECDSA algorithms.
Public host keysare stored on and/or
distributed to SSH clients, and
• private keys are stored on SSH servers.
• Each host (i.e., computer) should have a
unique host key. Sharing host keys is
strongly not recommended, and can result
in vulnerability to
man-in-the-middle attacks. However, in
computing clusters sharing hosts keys may
sometimes be acceptable and practical.
• SSH clients store host keys for hosts they
have ever connected to. These stored host
keys are called known host keys, and the
collection is often called known hosts.
• A server may have multiple host keys
using multiple different asymmetric
encryption algorithms.
• Multiple hosts may share the same host
key. In any case, the server host key is
used during key exchange to authenticate
the identity of the host.
• For this to be possible, the client must
have a priori knowledge of the server’s
public host key.
• 1. The client has a local database that associates each host
name (as typed by the user) with the corresponding public
host key. This method requires no centrally administered
infrastructure and no third-party coordination. The downside
is that the database of name-to-key associations may
become burdensome to maintain.
• 2. The host name-to-key association is certified by a trusted
certification authority (CA). The client only knows the CA root
key and can verify the validity of all host keys certified by
accepted CAs. This alternative eases the maintenance
problem, since ideally, only a single CA key needs to be
securely stored on the client. On the other hand, each host
key must be appropriately certified by a central authority
before authorization is possible.
Packet Exchange:
• Fig illustrates the sequence of events in the
SSH Transport Layer Protocol.
• First, the client establishes a TCP connection
to the server. This is done via the TCP
protocol.
• Once the connection is established, the client
and server exchange data, referred to as
packets, in the data field of a TCP segment.
• Each packet is in the following format .
• Packet length: Length of the
packet in bytes.
• Padding length: Length of the
random padding field.
• Payload: Useful contents of the
packet. Prior to algorithm
negotiation, this field is
uncompressed. If compression is
negotiated, then in subsequent
packets, this field is compressed.
• Random padding: Once an
encryption algorithm has been
negotiated, this field is added. It
contains random bytes of padding
so that that total length of the
packet (excluding the MAC field)
is a multiple of the cipher block
size, or 8 bytes for a stream
cipher.
Message authentication code (MAC):
• If message authentication has been negotiated, this field
contains the MAC value.
• The MAC value is computed over the entire packet plus a
sequence number, excluding the MAC field.
• The sequence number is an implicit 32-bit packet sequence
that is initialized to zero for the first packet and incremented
for every packet.
• sequence number is not included in the packet sent over the
TCP connection.
• Once an encryption algorithm has been negotiated, the
entire packet (excluding the MAC field) is encrypted
after the MAC value is calculated
The SSH Transport Layer packet
exchange
• First step, the identification string exchange, begins
with the client sending a packet with an identification
string of the form:
• SSH-protoversion-softwareversion SP comments CR LF
• where SP, CR, and LF are space character, carriage
return, and line feed, respectively.
• An example of a valid string is
• SSH-2.0-billsSSH_3.6.3q3<CR><LF>.
• The server responds with its own identification string.
These strings are used in the Diffie-Hellman key
exchange.
• Since the protocol being defined in this set of
documents is version 2.0, the 'protoversion' MUST be
"2.0".
• The 'comments' string is OPTIONAL. If the 'comments'
string is included, a 'space' character (denoted above
as SP, ASCII 32) MUST separate the 'softwareversion'
and 'comments' strings.
• The identification MUST be terminated by a single
Carriage Return (CR) and a single Line Feed (LF)
character (ASCII 13 and 10, respectively). Implementers
who wish to maintain
• This identification string does not contain the optional
'comments' string and is thus terminated by a CR and
LF immediately after the 'softwareversion' string.
• algorithm negotiation: Each side sends an
SSH_MSG_KEXINIT containing lists of supported
algorithms.
• The algorithms include key exchange, encryption, MAC
algorithm, and compression algorithm
• key exchange :only two versions of Diffie-Hellman key
exchange are specified. Both versions are defined in
RFC 2409 and require only one packet in each direction.
• C is the client; S is the server;
• V_S is S’s identification string;
• V_C is C’s identification string;
• K_S is S’s public host key;
• I_C is C’s SSH_MSG_KEXINIT message and
• I_S is S’s SSH_MSG_KEXINIT message that have been
exchanged before this part begins.
• The end of key exchange- is signaled by the exchange
of SSH_MSG_NEWKEYS packets. At this point, both sides
may start using the keys generated from K.
• The final step is service request. The client sends an
SSH_MSG_SERVICE_ REQUEST packet to request either
the User Authentication or the Connection Protocol.
• Subsequent to this, all data is exchanged as the
payload of an SSH Transport Layer packet, protected by
encryption and MAC.
Key Generation
• session
• X11
• forwarded-tcpip
• direct-tcpip
• Port Forwarding One of the most useful
features of SSH is port forwarding.
• port forwarding provides the ability to convert
any insecure TCP connection into a secure SSH
connection. This is also referred to as SSH
tunneling.
• A port is an identifier of a user of TCP. So, any
application that runs on top of TCP has a port
number. Incoming TCP traffic is delivered to
the appropriate application on the basis of the
port number. An application may employ
multiple port numbers.
• For example, for the Simple Mail Transfer
Protocol (smtp), the server side generally
listens on port 25, so an incoming SMTP
request uses TCP and addresses the data
to destination port 25. TCP recognizes
that this is the SMTP server address and
routes the data to the SMTP server
application.
concept behind port forwarding
SSH supports two types of port forwarding:
• 1) Local forwarding and
• 2) Remote forwarding.
• Local forwarding- allows the client to set
up a “hijacker” process.
• This will intercept selected application-level
traffic and redirect it from an unsecured TCP
connection to a secure SSH tunnel.
• SSH is configured to listen on selected ports.
• SSH grabs all traffic using a selected port
and sends it through an SSH tunnel.
• On the other end, the SSH server sends the
incoming traffic to the destination port
dictated by the client application.
• Example :Suppose you have an e-mail client on your desktop and
use it to get e-mail from your mail server via the Post Office
Protocol (POP). The assigned port number for POP3 is port 110. We
can secure this traffic in the following way:
1. The SSH client sets up a connection to the remote server.
2. Select an unused local port number, say 9999, and configure SSH
to accept traffic from this port destined for port 110 on the server.
3. The SSH client informs the SSH server to create a connection to
the destination, in this case mail server port 110.
4. The client takes any bits sent to local port 9999 and sends them
to the server inside the encrypted SSH session. The SSH server
decrypts the incoming bits and sends the plaintext to port 110.
5. In the other direction, the SSH server takes any bits received on
port 110 and sends them inside the SSH session back to the client,
who decrypts and sends them to the process connected to port
9999.
• Remote forwarding - the user’s SSH
client acts on the server’s behalf. The
client receives traffic with a given
destination port number, places the
traffic on the correct port and sends it to
the destination the user chooses.
Example: You wish to access a server at work from your home
computer. Because the work server is behind a firewall, it will not
accept an SSH request from your home computer. However, from
work you can set up an SSH tunnel using remote forwarding.
This involves the following steps.
1. From the work computer, set up an SSH connection to your home
computer. The firewall will allow this, because it is a protected
outgoing connection.
2. Configure the SSH server to listen on a local port, say 22, and to
deliver data across the SSH connection addressed to remote port,
say 2222.
3. You can now go to your home computer, and configure SSH to
accept traffic on port 2222.
4. You now have an SSH tunnel that can be used for remote logon
to the work server.
Summary