Cns 5
Cns 5
Content Type (8 bits): The higher-layer protocol used to process the enclosed fragment.
Major Version (8 bits): Indicates major version of SSL in use. For SSLv3, the value is 3.
Minor Version (8 bits): Indicates minor version in use. For SSLv3, the value is 0.
Compressed Length (16 bits): The length in bytes of the plaintext fragment (or compressed fragment if
compression is used). The maximum value is 214 + 2048.
The content types that have been defined are change_cipher_spec, alert, handshake, and application_data.
The one difference is in version values. For the current version of TLS, the major version is 3 and
the minor version is 3.
Message Authentication Code: There are two differences between the SSLv3 and TLS MAC schemes: the actual algorithm and the scope of the MAC
calculation. TLS makes use of the HMAC algorithm.
HMACK(M)= H[(K+ ⊕ opad)||H[(K+ ⊕ ipad)||M]]
Where,
H = embedded hash function (for TLS, either MD5 or SHA-1).
M = message input to HMAC.
K+ = secret key padded with zeros on the left so that the result is equal to the block length of the hash code
(for MD5 and SHA-1, block length = 512 bits).
ipad = 00110110 (36 in hexadecimal) repeated 64 times (512 bits).
opad = 01011100 (5C in hexadecimal) repeated 64 times (512 bits).
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).
The MAC calculation covers all of the fields covered by the SSLv3 calculation, plus the field TLSCompressed.version,
which is the version of the protocol being employed.
Pseudorandom Function: TLS makes use of a pseudorandom function referred to as PRF to expand secrets into blocks of data for purposes of key
generation or validation.
The PRF is based on the data expansion function given as,
P_hash(secret,seed)= HMAC_hash(secret,A(1)||seed)||HMAC_hash(secret, A(2)||seed)|| HMAC_hash(secret,
A(3) || seed) ||...
where A() is defined as
A(0) = seed
A(i) = HMAC_hash(secret, A(i – 1))
Figure below shows TLS Function P_hash(secret, seed):
The data expansion function makes use of the HMAC algorithm with either MD5 or
SHA-1 as the underlying hash function.
To make PRF as secure as possible, it uses two hash algorithms in a way that should
guarantee its security if either algorithm remains secure. PRF is defined as:
PRF(secret, label, seed) = P_hash(S1,label || seed)
PRF takes as input a secret value, an identifying label, and a seed value and
produces an output of arbitrary length.
Alert Codes: TLS supports all of the alert codes defined in SSLv3 with the exception
of no_certificate. A number of additional codes are defined in TLS;
record_overflow: A TLS record was received with a payload (ciphertext) whose
length exceeds 214+2048 bytes, or the ciphertext decrypted to a length of greater
than 214+2048 bytes.
unknown_ca: A valid certificate chain or partial chain was received, but the
certificate was not accepted because the CA certificate could not be located or
could not be matched with a known, trusted CA.
access_denied: A valid certificate was received, but when access control was applied, the sender decided not to proceed with the
negotiation.
Dr. B Lakshmi Narayana Reddy/Cryptography and Network Security
decode_error: A message could not be decoded, because either a field was out of its specified range or the length of the message was
incorrect.
protocol_version: The protocol version the client attempted to negotiate is recognized but not supported.
insufficient_security: Returned instead of handshake_failure when a negotiation has failed specifically because the server requires ciphers
more secure than those supported by the client.
unsupported_extension: Sent by clients that receive an extended server hello containing an extension not in the corresponding client
hello.
internal_error: An internal error unrelated to the peer or the correct ness of the protocol makes it impossible to con nue.
decrypt_error: A handshake cryptographic operation failed, including being unable to verify a signature, decrypt a key exchange, or validate
a finished message.
The remaining alerts include the following.
user_canceled: This handshake is being canceled for some reason unre lated to a protocol failure.
no_renegotiation: Sent by a client in response to a hello request or by the server in response to a client hello after initial handshaking.
Either of these messages would normally result in renegotiation, but this alert indicates that the sender is not able to renegotiate. This
message is always a warning.
Cipher Suites:
There are several small differences between the cipher suites available under SSLv3 and under TLS:
Key Exchange: TLS supports all of the key exchange techniques of SSLv3 with the exception of Fortezza.
Symmetric Encryption Algorithms: TLS includes all of the symmetric encryption algorithms found in SSLv3, with the exception of Fortezza
Client Certificate Types: TLS defines the following certificate types to be requested in a certificate_request
message: rsa_sign, dss_sign, rsa_fixed_dh, and dss_fixed_dh. These are all defined in SSLv3. In addition, SSLv3 includes
rsa_ephemeral_dh, dss_ephemeral_dh, and fortezza_kea.
certificate_verify and Finished Messages: In the TLS certificate_verify message, the MD5 and SHA-1 hashes are calculated only over
handshake_messages.
As with the finished message in SSLv3, the finished message in TLS is a hash based on the shared master_secret, the previous handshake messages,
and a label that identifies client or server. The calculation is somewhat different. For TLS, we have
PRF (master_secret,finished_label, MD5(handshake_messages)|| SHA-1(handshake_messages))
where finished_label is the string “client finished” for the client and “server finished” for the server.
Cryptographic Computations: The pre_master_secret for TLS is calculated in the same way as in SSLv3.As in SSLv3, the master_secret in TLS is
calculated as a hash function of the pre_master_secret and the two hello random numbers. The form of the TLS calculation is different from that of
SSLv3 and is defined as
master_secret= PRF(pre_master_secret,"master secret",ClientHello.random||ServerHello.random)
The algorithm is performed until 48 bytes of pseudorandom output are produced. The calculation of the key block material (MAC secret keys, session
encryption keys, and IVs) is defined as
key_block = PRF(master_secret, "key expansion", SecurityParameters.server_random || SecurityParameters.client_random)
5.1.3 HTTPS
HTTPS stands for Hyper Text Transfer Protocol Secure. HTTPS (HTTP over SSL) refers to the combination of HTTP and SSL to implement secure
communication between a Web browser and a Web server. HTTPS uses the Secure Socket Layer (SSL) and Transport Layer Security (TLS).
When HTTPS is used, the following elements of the communication are encrypted:
URL of the requested document
Contents of the document
Contents of browser forms (filled in by browser user)
Cookies sent from browser to server and from server to browser
Contents of HTTP header
5.1.3.1 Connection Initiation:
1. Client Initiation:
a. The client initiates a connection to the server on the appropriate port (usually port 443 for HTTPS).
b. Sends the TLS ClientHello message to begin the TLS handshake.
2. TLS Handshake:
a. This is a process where the client and server establish a secure connection.
b. It involves a series of messages exchanged between the client and server to negotiate parameters, exchange cryptographic
information, and agree on a shared secret key.
c. Once the TLS handshake is complete, the communication channel is secured.
Dr. B Lakshmi Narayana Reddy/Cryptography and Network Security
3. HTTP Request:
a. After the TLS handshake, the client can initiate the first HTTP request.
b. All subsequent HTTP data is sent as TLS application data.
c. Normal HTTP behavior, including retained connections, should be followed within the secured TLS connection.
4. Levels of Awareness:
a. At the HTTP level, an HTTP client requests a connection to an HTTP server.
b. This request is sent to the next lowest layer, which can be TCP or TLS/SSL.
c. At the TLS level, a session is established between the TLS client and server, supporting one or more connections.
5. TCP Connection:
a. The TLS request to establish a connection begins with the establishment of a TCP connection between the client and server's TCP
entities.
5.1.3.2 Connection Termination:
1. HTTP Record: Connection: close:
An HTTP record may include the header Connection: close.
This indicates that the connection should be closed after the current request/response cycle.
2. Close_notify Alert:
This is a specific TLS alert message.
Indicates that the sender is going to close the connection.
Part of the TLS protocol to gracefully close the secure connection.
3. Connection: close Header:
An HTTP header that can be used to signal that the connection should be closed.
HTTPS involves the initiation of a secure connection through the TLS handshake after the client initiates a connection. The secured connection
follows normal HTTP behaviour. Connection closure can be indicated through HTTP headers and TLS alerts, ensuring a graceful termination of the
secure connection.
SSH1 was the first version of the Secure Shell protocol, released in 1996. It was designed to provide a secure remote logon facility to replace TELNET,
which was considered to be insecure. SSH1 uses a number of cryptographic algorithms, including RSA, DSS, and Blowfish. However, SSH1 has some
known security vulnerabilities, and it is no longer considered to be secure for most purposes.
SSH2 is the current version of the Secure Shell protocol, released in 2006. It was designed to address the security vulnerabilities of SSH1. SSH2 uses a
number of stronger cryptographic algorithms, including Diffie-Hellman key exchange, AES, and SHA-2. SSH2 is also more flexible than SSH1, and it
supports a wider range of features, such as port forwarding and X11 forwarding.
SSH is organized as three protocols that typically run on top of TCP. Figure below shows SSH Protocol stack:
1. SSH Transport Layer Protocol (SSH-TRANS): This protocol is responsible for providing a
secure communication channel between the client and server. It establishes a secure connection
using public-key cryptography and symmetric encryption.
2. SSH User Authentication Protocol (SSH-AUTH): This protocol is responsible for
authenticating the client to the server. It supports a variety of authentication methods, including
passwords, public-key authentication, and keyboard-interactive authentication.
3. SSH Connection Protocol (SSH-CONNECT): This protocol is responsible for multiplexing
multiple logical channels over the secure connection established by SSH-TRANS. This allows for
multiple concurrent sessions, such as a remote shell session and a file transfer session, to be run
over a single TCP connection.
SSH Packet Format: Each SSH packet consists of a header and a payload.
->SSH Header Format: The header contains information about the packet type, length, and other control fields, while the payload carries the actual
message content.
Header Structure:
1. Packet length (4 bytes): Indicates the total length of the packet, including the header, payload, and MAC.
2. Packet type (1 byte): Identifies the type of message being conveyed, such as SSH_MSG_KEX_INIT for key exchange initiation or
SSH_MSG_USERAUTH_REQUEST for user authentication.
3. Padding length (1 byte): Specifies the amount of padding added to the packet to ensure a minimum packet size for efficient data transfer.
4. Payload (variable length): Contains the actual message content, which is specific to the packet type.
Dr. B Lakshmi Narayana Reddy/Cryptography and Network Security
5. MAC (variable length): A message authentication code generated using a shared secret key, ensuring data integrity and preventing
tampering.
->SSH Message Format: Within the payload of each packet, SSH messages follow a structured format to encapsulate specific information for various
communication tasks. The format typically includes fields for message type, sequence number, and message-specific data.
Message Structure:
1. Message type (1 byte): Identifies the type of message within the payload, such as SSH_MSG_DISCONNECT for connection termination
or SSH_MSG_CHANNEL_EOF for closing a channel.
2. Sequence number (4 bytes): A unique identifier for the message, ensuring message order and preventing duplicate or out-of-order
messages.
3. Message-specific data (variable length): Contains the message-specific data relevant to the message type, such as user authentication
credentials or channel data.
Figure below shows SSH Transport Layer Protocol Packet Formation: Figure below shows SSH Transport Layer Protocol Packet Exchanges:
Figure illustrates the basic concept behind port forwarding. We have a client
application that is identified by port number x and a server application
identified by port number y.
To secure this connection, SSH is configured so that the SSH Transport Layer
Protocol establishes a TCP connection between the SSH client and server
entities with TCP port numbers and, respectively. A secure SSH tunnel is
established over this TCP connection.
Dr. B Lakshmi Narayana Reddy/Cryptography and Network Security
5.2 Firewalls
A firewall is a network security device that monitors and controls incoming and outgoing network traffic based on predetermined security rules. It acts
as a barrier between a trusted network, such as a corporate or home network, and an untrusted network, such as the Internet. Firewalls can be
hardware devices, software applications, or a combination of both. They are designed to prevent unauthorized access to a network, protect against
malicious software, and filter out unwanted traffic.
One or more internal firewalls further protect your sensitive data and applications. Between these two firewalls is a DMZ (demilitarized zone) network.
Firewalls play a crucial role in securing Virtual Private Networks (VPNs). They act as gatekeepers, controlling
and filtering traffic entering and exiting the VPN tunnel. The location of firewalls within a VPN setup can vary
depending on the specific architecture and security requirements. Here are some common locations:
Client-side: In this scenario, a firewall is installed directly on the client device (e.g., laptop, smartphone)
connecting to the VPN. This provides a basic level of protection by filtering traffic before it enters the VPN
tunnel.
Dr. B Lakshmi Narayana Reddy/Cryptography and Network Security
Network Access Server (NAS): The firewall is installed on the NAS, the server that manages user access and authentication for the VPN. This allows for
centralized control and filtering of all VPN traffic.
VPN Gateway: The firewall is integrated into the VPN gateway itself, which acts as the entry point for all VPN traffic. This provides the highest level of
security and control.
Some organizations may choose to implement a hybrid approach,
combining different firewall locations. For example, a client-side
firewall could be used for basic filtering, while a network-based
firewall on the NAS or VPN gateway provides additional security.
5.2.4.3 Distributed Firewalls: Distributed firewalls are a type of firewall that is spread across multiple devices in your network. This provides greater
flexibility and scalability than traditional firewalls.
Distributed firewalls are typically used in large networks with multiple locations. They can be used to improve
performance and reliability, and to make it easier to manage security policies across the entire network.