Nsp Module 3
Nsp Module 3
PROTOCOLS
Prepared By,
Ambily Mohan
Assistant Professor
CSE Dept
ASIET, Kalady
SYLLABUS
• Transport Mode AH
• IPv4:
• AH is inserted after the original IP header and before the IP payload (e.g.,
TCP segment).
• Authentication covers the entire packet, except for mutable fields (set to
zero for MAC calculation).
• IPv6:
• AH is treated as an end-to-end payload (not processed by intermediate
routers).
• AH is placed after the IPv6 base header and follows hop-by-hop, routing,
and fragment extension headers.
• Destination options header may appear before or after AH, depending on
desired behavior.
• Authentication covers the entire packet, excluding mutable fields (zeroed
for MAC calculation).
• Tunnel Mode AH
• AH is inserted between the original (inner) IP header and a new outer IP
header.
• The inner IP header holds the original source and destination IP addresses.
• The outer IP header may contain different IP addresses (e.g., those of security
gateways or firewalls).
• Authentication Scope:
• The entire inner IP packet (including the inner IP header) is authenticated.
• The outer IP header is protected except for mutable fields (which are zeroed).
IPSec ENCAPSULATING SECURITY PAYLOAD(ESP)
• Encapsulating Security Payload (ESP) is a core component of the
IPsec (Internet Protocol Security) suite.
• It provides confidentiality, integrity, and authentication for network
traffic at the IP layer.
• ESP is widely used for securing VPNs (Virtual Private Networks) and
other encrypted communications over untrusted networks.
ESP Packet Format
• Security Parameters Index (32 bits): Identifies a security association.
• Sequence Number (32 bits): A monotonically increasing counter value; this
provides an anti replay function, as discussed for AH.
• Payload Data (variable): This is a transport-level segment (transport mode) or
IP packet (tunnel mode) that is protected by encryption.
• Padding (0255 bytes): Used for block cipher alignment and to obtaining
payload length.
• Pad Length (8 bits): Indicates the number of pad bytes immediately preceding
this field.
• Next Header (8 bits): Identifies the type of data contained in the payload data
field by identifying the first header in that payload (for example, an extension
header in IPv6, or an upper-layer protocol such as TCP
• Authentication Data (variable): A variable-length field (must be an integral
number of 32-bit words) that contains the Integrity Check Value computed
over the ESP packet minus the Authentication Data field
Encryption and Authentication Algorithms
• ESP provides confidentiality, integrity, and authentication for IP packets. It
encrypts the Payload Data, Padding, Pad Length, and Next Header fields,
ensuring data protection during transmission.
• Encryption is used to protect the payload from eavesdropping. If an
encryption algorithm requires an Initialization Vector (IV), it is typically
included at the beginning of the Payload Data field (but remains
unencrypted).
• Supported Encryption Algorithms:
• DES (Data Encryption Standard) in Cipher Block Chaining (CBC) Mode (Mandatory in
older specifications, but now considered weak).
• Triple DES (3DES) – Uses three DES keys for stronger encryption.
• RC5 – A symmetric block cipher with variable key sizes.
• IDEA (International Data Encryption Algorithm) – A strong symmetric encryption
algorithm.
• Triple IDEA – A stronger version of IDEA using multiple keys.
• CAST – A block cipher known for its security and speed.
• Blowfish – A fast, flexible cipher with variable key length.
• Modern ESP implementations commonly use AES (Advanced
Encryption Standard), which has replaced older algorithms like DES
and 3DES.
• ESP optionally supports Message Authentication Codes (MACs) to
ensure data integrity and authenticity.
• Supported Authentication Algorithms:
• HMAC-MD5-96 – Uses the MD5 hashing algorithm with HMAC (producing a
96-bit digest).
• HMAC-SHA-1-96 – Uses SHA-1 with HMAC (also producing a 96-bit digest).
• Modern implementations prefer HMAC-SHA-256, HMAC-SHA-384,
and HMAC-SHA-512 due to stronger security.
IPSec ESP Services: Transport and Tunnel Modes
• IPsec ESP can operate in two different modes: Transport Mode and Tunnel Mode.
These modes determine how encryption and authentication are applied to
network traffic.
• Transport Mode (Host-to-Host Security)
• Encryption and authentication are applied directly between two hosts
(endpoints).
• Only the payload (Transport Layer segment, e.g., TCP, UDP data) is encrypted
and/or authenticated.
• The original IP header remains unchanged (not encrypted).
• Used when both sender and receiver support IPsec.
• Tunnel Mode (Gateway-to-Gateway Security, VPNs)
• Entire original IP packet (header + payload) is encrypted.
• A new IP header is added, encapsulating the original packet.
• Used in VPNs (Virtual Private Networks) where end-hosts do not need to
implement IPsec.
• Transport-Mode vs. Tunnel-Mode Encryption
• Transport Mode ESP
• Transport mode operation may be summarized as follows:
• Step 1: Encryption at the Source
• The ESP Trailer + Transport Layer Segment (TCP/UDP payload) is encrypted.
• The plaintext transport segment is replaced with ciphertext.
• If authentication is enabled, an ESP Authentication Data field is added.
• The original IP header remains unchanged.
• Step 2: Packet Routing
• The packet is forwarded through the network like a regular IP packet.
• Routers process the IP header to determine where to send the packet.
• The ESP-encrypted payload remains hidden from routers.
• Step 3: Decryption at the Destination
• The receiving destination host reads the Security Parameters Index (SPI) from
the ESP Header.
• The ESP payload is decrypted, restoring the original transport-layer segment.
• If authentication is enabled, integrity is verified before decryption.
• Tunnel Mode ESP
• Tunnel mode ESP operation may be summarized as follows
• Step 1: Packet Preparation (At the Source)
• The original IP packet (IP Header + Transport Data) is created.
• The ESP header is added before encryption.
• The entire inner IP packet (IP Header + ESP Header + Encrypted Data + ESP Trailer) is
encrypted.
• If authentication is enabled, an ESP Authentication Data field is added.
• A new outer IP header is added, allowing the packet to be routed.
• Step 2: Packet Routing (Through the Internet)
• The packet is routed across the public network to the destination gateway.
• Routers process only the outer IP header (they cannot inspect the encrypted inner IP
packet).
• Traffic analysis is countered because the original IP addresses and data remain hidden.
• step 3: Decryption at the Security Gateway
• The receiving firewall (or VPN gateway) processes the outer IP header and decrypts the
ESP payload.
• The original inner IP packet is extracted and sent into the internal network.
COMBINING SECURITY ASSOCIATIONS
• IPsec uses Security Associations (SAs) to define how security
services (AH, ESP) are applied to traffic.
• However, a single SA can only implement either AH or ESP, not
both.
• In cases where both authentication and confidentiality are
required, SA bundling is used.
• A Security Association Bundle refers to a sequence of multiple SAs
applied to the same traffic flow to provide layered security. These SAs
can either:
• Terminate at different endpoints (e.g., host-to-firewall and then
firewall-to-host).
• Terminate at the same endpoints but apply multiple layers of security.
Methods of Combining Security Associations
• IPsec provides two ways to combine SAs:
1. Transport Adjacency (Multiple Security Protocols on the Same IP
Packet)
• AH and ESP are both applied to a packet, without tunneling.
• ESP encrypts the payload, while AH authenticates more of the packet
(including the IP header).
• Only one level of combination is possible because both protocols operate at
the same IPsec instance.
• Example:
• ESP Transport Mode is applied first → Encrypts the payload.
• AH Transport Mode is applied second → Authenticates the ESP-encrypted payload and
the IP header.
• Advantage: More fields are authenticated (source/destination IPs are
included).
• Disadvantage: Higher overhead due to two security protocols.
2.Iterated Tunneling (Multiple Layers of Security via IP
Tunneling)
• Multiple nested tunnels are used, where each tunnel applies a
security layer.
• Each tunnel may originate or terminate at different security
gateways or hosts.
• Example:
• A VPN uses ESP Tunnel Mode between firewalls to encrypt entire IP
packets.
• Inside the tunnel, another ESP or AH SA is applied for end-to-end security
between hosts.
• Advantage: Multiple layers of encryption and authentication
protect against attacks.
• Disadvantage: More computational overhead and processing
time.
Authentication Plus Confidentiality (Combining Encryption & Authentication)
• Encryption (ESP) and authentication (AH) can be combined in different ways
to secure IP packets.
1. ESP with Authentication Option
• ESP encrypts the payload and adds authentication for integrity verification.
• Authentication applies to the ciphertext (not the plaintext).
• Modes
• ESP Transport Mode: Encrypts only the payload; authentication covers
encrypted data.
• ESP Tunnel Mode: Encrypts the entire IP packet; authentication applies
to the entire encrypted packet.
• Benefit: Protects against tampering and ensures confidentiality in one
protocol.
2. Transport Adjacency (ESP + AH)
• Uses two transport-mode SAs:
• Inner SA: ESP (without authentication) → Encrypts the payload.
• Outer SA: AH → Authenticates the ESP packet plus the original IP header.
• Benefit:
• Stronger authentication (since AH covers the IP header).
• Drawback:
• More overhead (two SAs instead of one).
3. Transport-Tunnel Bundle (AH Transport + ESP Tunnel)
• AH is applied first in Transport Mode → Authenticates the payload and IP
header.
• ESP Tunnel Mode is applied next → Encrypts the entire authenticated
packet and encapsulates it in a new IP header
• Benefit:
• Authentication data is protected by encryption, preventing alteration.
• Ideal for VPNs where authentication is needed before encryption.
WEB SECURITY
WEB SECURITY CONSIDERATIONS
• The Web operates on a client/server model over the Internet and
TCP/IP intranets.
• Web security is crucial to protect data, users, and business operations.
• Unique Web Security Challenges
• Two-Way Nature of the Internet : Unlike traditional publishing, Web servers
can be attacked over the Internet.
• High Visibility & Business Risk : Security breaches can damage reputations and
cause financial losses.
• Complexity of Web Software : Complex systems may hide security
vulnerabilities.
• Web Servers as Attack Entry Points : A compromised web server can expose an
entire organization's IT infrastructure.
• Untrained Users & Security Risks : Many users are unaware of security threats
and lack the tools to mitigate them.
Web Security Threats
• Security Threat Classification
1. Passive Attacks:
• Eavesdropping – Monitoring network traffic between browser and server.
2. Active Attacks:
• Impersonation – Pretending to be another user.
1. Network Level
• One way to provide Web security is to use IP security (IPsec)
• Advantage of using IPsec: it is transparent to end users and
applications and provides a general-purpose solution
• IPsec includes a filtering capability so that only selected
traffic need incur the overhead of IPsec processing
2. Transport level
• Secure Sockets Layer (SSL) and the follow-on
Internet standard known as Transport Layer
Security (TLS)
• At this level, there are two implementation
choices
• For full generality, SSL (or TLS) could be provided
as part of the underlying protocol suite and
therefore be transparent to applications
• Alternatively, SSL can be embedded in specific
packages
3. Application level
• Application-specific security services are embedded within the particular
application
• Advantage: service can be tailored to the specific needs of a given
application
SECURE SOCKET LAYER AND TRANSPORT LAYER
SECURITY (SSL/TLS)
• Secure socket layer (SSL) provides security services between TCP and
applications that use TCP.
• The Internet standard version is called transport layer service (TLS).
• SSL/TLS provides confidentiality using symmetric encryption and
message integrity using a message authentication code.
• SSL/TLS includes protocol mechanisms to enable two TCP users to
determine the security mechanisms and services they will use.
SSL Architecture
• SSL is designed to make use of TCP to provide a reliable end-to-end
secure service.
• SSL is not a single protocol but rather two layers of protocols.
• The SSL Record Protocol provides basic security services to various
higher-layer protocols.
• Hypertext Transfer Protocol (HTTP), which provides the transfer
service for Web client/server interaction, can operate on top of SSL.
• Three higher-layer protocols are defined as part of SSL:
• The Handshake Protocol,
• The Change Cipher Spec Protocol,
• The Alert Protocol.
• SSL Protocol Stack
• Two important SSL concepts
• SSL Connection
• A connection is a transport (in the OSI layering model definition) that provides a suitable
type of service.
• Each connections are peer-to-peer relationships.
• The connections are transient.
• Every connection is associated with one session.
• SSL Session
• An SSL session is an association between a client and a server.
• Sessions are created by the Handshake Protocol.
• Sessions define a set of cryptographic security parameters, which can be shared among
multiple connections.
• Sessions are used to avoid the expensive negotiation of new security parameters for
each connection.
• A session state is defined by the following parameters.
• Session identifier: An arbitrary byte sequence chosen by the server to
identify an active or resumable session state.
• Peer certificate: An X509.v3 certificate of the peer. This element of the state
may be null.
• Compression method: The algorithm used to compress data prior to
encryption.
• Cipher spec: Specifies the bulk data encryption algorithm (such as null, AES,
etc.) and a hash algorithm (such as MD5 or SHA-1) used for MAC calculation.
It also defines cryptographic attributes such as the hash_size.
• Master secret: 48-byte secret shared between the client and server.
• Is resumable: A flag indicating whether the session can be used to initiate
new connections.
• A connection state is defined by the following parameters:
• Server and client random: Byte sequences that are chosen by the server and client
for each connection.
• Server write MAC secret: The secret key used in MAC operations on data sent by the
server.
• Client write MAC secret: The secret key used in MAC operations on data sent by the
client.
• Server write key: The conventional encryption key for data encrypted by the server
and decrypted by the client.
• Client write key: The conventional encryption key for data encrypted by the client
and decrypted by the server.
• Initialization vectors: When a block cipher in CBC mode is used, an initialization
vector (IV) is maintained for each key. This field is first initialized by the SSL
Handshake Protocol. Thereafter the final ciphertext block from each record is
preserved for use as the IV with the following record.
• Sequence numbers: Each party maintains separate sequence numbers for
transmitted and received messages for each connection. When a party sends or
receives a change cipher spec message, the appropriate sequence number is set to
zero. Sequence numbers may not exceed 264 1
1. SSL Record Protocol
• The SSL Record Protocol provides two services for SSL connections:
• Confidentiality:
• The Handshake Protocol defines a shared secret key that is used
for conventional encryption of SSL payloads.
• Message Integrity:
• The Handshake Protocol also defines a shared secret key that is
used to form a message authentication code (MAC).
• SSL Record Protocol operation
• The Record Protocol takes an application
message to be transmitted.
• First step is fragmentation. Each upper-
layer message is fragments the data into
manageable blocks of214 bytes.
• Next optionally compresses the data,
Compression must be lossless and may
not increase the content length by more
than 1024 bytes.
• applies a MAC, encrypts, adds a header,
and transmits the resulting unit in a TCP
segment.
• Received data are decrypted, verified,
decompressed, and reassembled and
then delivered to higher-level users.
• The calculation is defined as
hash(MAC_write_secret || pad_2 ||
hash(MAC_write_secret || pad_1 || seq_num ||
SSLCompressed.type ||
SSLCompressed.length ||
SSLCompressed.fragment))
• SSL Record Format
2. SSL Change Cipher Spec Protocol
• The Change Cipher Spec Protocol is one of the three SSL-specific protocols
(alongside the Handshake Protocol and the Alert Protocol) that operate within
the SSL Record Protocol.
• It plays a crucial role in transitioning from the initial handshake phase to an
encrypted session.
• The Change Cipher Spec message is a single byte with a value of 1.
• It is sent by both the client and server during the SSL/TLS handshake after the
handshake parameters (like encryption keys and algorithms) have been
agreed upon.
• The purpose of this message is to copy the pending security parameters
(negotiated during the handshake) into the current security state.
• This means that all subsequent messages sent over the connection will be
encrypted using the newly established cipher suite.
3. Alert Protocol
• Purpose: Sends SSL-related alerts between client and server.
• Encryption: Alerts are compressed and encrypted as per the current session
state.
• Message Structure