Mcsaimlcs304 Notes Unit-4
Mcsaimlcs304 Notes Unit-4
Course- MCSAIMLCS
Subject- Cryptography and Network Security
Subject Code – MCSAIMLCS 304 Sem- III
UNIT 4
IP Security (IPSec)
IP Security (IPSec) refers to a collection of communication rules or protocols used to establish
secure network connections. Internet Protocol (IP) is the common standard that controls how data
is transmitted across the internet. IPSec enhances the protocol security by
introducing encryption and authentication. IPSec encrypts data at the source and then decrypts
it at the destination. It also verifies the source of the data.
Importance of IPSec
IPSec (Internet Protocol Security) is important because it helps keep your data safe and secure
when you send it over the Internet or any network. Here are some of the important aspects why
IPSec is Important:
IPSec protects the data through Data Encryption.
IPSec provides Data Integrity.
IPSec is often used in Virtual Private Networks (VPNs) to create secure, private
connections.
IPSec protects from Cyber Attacks.
Features of IPSec
Authentication: IPSec provides authentication of IP packets using digital signatures or
shared secrets. This helps ensure that the packets are not tampered with or forged.
Confidentiality: IPSec provides confidentiality by encrypting IP packets,
preventing eavesdropping on the network traffic.
Integrity: IPSec provides integrity by ensuring that IP packets have not been modified or
corrupted during transmission.
Key management: IPSec provides key management services, including key exchange
and key revocation, to ensure that cryptographic keys are securely managed.
Tunneling: IPSec supports tunneling, allowing IP packets to be encapsulated within
another protocol, such as GRE (Generic Routing Encapsulation) or L2TP (Layer 2
Tunneling Protocol).
Flexibility: IPSec can be configured to provide security for a wide range of network
topologies, including point-to-point, site-to-site, and remote access connections.
Interoperability: IPSec is an open standard protocol, which means that it is supported by
a wide range of vendors and can be used in heterogeneous environments.
Key Components of IPsec
1. Protocols:
o Authentication Header (AH): Provides data integrity, authentication, and anti-
replay protection. It ensures that the data has not been altered during transmission
but does not encrypt the data.
o Encapsulating Security Payload (ESP): Provides confidentiality by encrypting the
data, as well as authentication and integrity. ESP is more commonly used than AH
because it supports encryption.
2. Security Associations (SA):
o An SA is a set of policies and keys that determine how traffic will be secured. It
defines the security services to be applied to the IP packets and is unidirectional,
meaning each direction of traffic has its own SA.
3. Key Management:
o IPsec can use protocols like the Internet Key Exchange (IKE and IKEv2) to
negotiate SAs and manage keys securely.
Modes of IPsec
1. Transport Mode:
o Only the payload of the IP packet is encrypted and/or authenticated. The IP header
remains intact. This mode is typically used for end-to-end communication between
hosts.
2. Tunnel Mode:
o The entire original IP packet is encrypted and encapsulated within a new IP packet
with a new IP header. This mode is often used for Virtual Private Networks (VPNs),
allowing secure communication between networks.
Advantages of IPsec
Strong security: IPSec provides strong cryptographic security services that help protect
sensitive data and ensure network privacy and integrity.
Wide compatibility: IPSec is an open standard protocol that is widely supported by
vendors and can be used in heterogeneous environments.
Flexibility: IPSec can be configured to provide security for a wide range of network
topologies, including point-to-point, site-to-site, and remote access connections.
Scalability: IPSec can be used to secure large-scale networks and can be scaled up or
down as needed.
Improved network performance: IPSec can help improve network performance by
reducing network congestion and improving network efficiency.
Comprehensive Security: Provides authentication, integrity, and confidentiality for IP
traffic, making it suitable for securing sensitive data.
Transparent to Applications: IPsec operates at the network layer, so applications do not
need to be modified to benefit from its security features.
Interoperability: As a standard protocol suite, IPsec can be implemented across different
devices and platforms, ensuring compatibility.
Disadvantages of IPSec
Configuration Complexity: IPSec can be complex to configure and requires specialized
knowledge and skills.
Compatibility Issues: IPSec can have compatibility issues with some network devices
and applications, which can lead to interoperability problems.
Performance Impact: IPSec can impact network performance due to the overhead of
encryption and decryption of IP packets.
Key Management: IPSec requires effective key management to ensure the security of the
cryptographic keys used for encryption and authentication.
Limited Protection: IPSec only provides protection for IP traffic, and other protocols
such as ICMP, DNS, and routing protocols may still be vulnerable to attacks.
Applications of IPsec
Virtual Private Networks (VPNs): Commonly used to create secure tunnels over the
Internet for remote access or connecting branch offices to a corporate network.
Secure Communication: Protects sensitive data in transit for applications such as VoIP
and online transactions.
Site-to-Site Connections: Facilitates secure communication between different networks
across the Internet.
IP Security (IPsec) is a robust and versatile protocol suite designed to secure IP communications
through authentication and encryption. Its ability to protect data at the network layer, combined
with its support for various applications, makes it a critical component of modern network security
strategies, particularly in the context of VPNs and secure communications. Proper implementation
and management of IPsec are essential for maximizing its security benefits while minimizing
potential challenges.
Components of IPsec
1. Protocols:
o Authentication Header (AH): Provides integrity and authentication but does not
encrypt the payload.
o Encapsulating Security Payload (ESP): Provides encryption, along with integrity
and authentication, making it more commonly used.
2. Security Associations (SA):
o Defines the parameters for secure communication, including encryption and
authentication methods. Each direction of traffic has its own SA.
3. Key Management:
o Utilizes protocols like Internet Key Exchange (IKE) to establish SAs and manage
keys securely.
IP Security (IPsec) Architecture
IPSec (IP Security) architecture uses two protocols to secure the traffic or data flow. These
protocols are ESP (Encapsulation Security Payload) and AH (Authentication Header). IPSec
Architecture includes protocols, algorithms, DOI, and Key Management. All these components
are very important in order to provide the three main services:
Confidentiality
Authentication
Integrity
IP Security Architecture:
Packet Format:
Security Parameter Index(SPI): This parameter is used by Security Association. It is
used to give a unique number to the connection built between the Client and Server.
Sequence Number: Unique Sequence numbers are allotted to every packet so that on the
receiver side packets can be arranged properly.
Payload Data: Payload data means the actual data or the actual message. The Payload
data is in an encrypted format to achieve confidentiality.
Padding: Extra bits of space are added to the original message in order to ensure
confidentiality. Padding length is the size of the added bits of space in the original
message.
Next Header: Next header means the next payload or next actual data.
Authentication Data This field is optional in ESP protocol packet format.
3. Encryption algorithm: The encryption algorithm is the document that describes various
encryption algorithms used for Encapsulation Security Payload.
Authentication Header covers the packet format and general issues related to the use of AH for
packet authentication and integrity.
5. Authentication Algorithm: The authentication Algorithm contains the set of documents that
describe the authentication algorithm used for AH and for the authentication option of
ESP.
6. DOI (Domain of Interpretation): DOI is the identifier that supports both AH and ESP
protocols. It contains values needed for documentation related to each other.
7. Key Management: Key Management contains the document that describes how the keys are
exchanged between sender and receiver.
AUTHENTICATION HEADER
The Authentication Header (AH) is a security protocol used within the IPsec suite. Its primary
function is to ensure that the message remains unmodified during transmission from the source
and it confirms that the data originates from the expected source. Authentication Header achieves
this by adding a header to IP packets, containing a checksum and a digital signature. Its main
functions are:
Message Integrity - It means, the message is not modified while coming from the source.
Source Authentication - It means, the source is exactly the source from whom we were
expecting data.
When a packet is sent from source A to Destination B, it consists of data that we need to send
and a header that consists of packet information. The Authentication Header verifies the origin of
data and also the payload to confirm if there has been modification done in between, during
transmission between source and destination. However, in transit, values of some IP header fields
might change (like- Hop count, options, extension headers). So, the values of such fields cannot
be protected from Authentication header. Authentication header cannot protect every field of IP
header. It provides protection to fields which are essential to be protected.
Reserved - This is 16-bit field which is set to “zero” by sender as this field is reserved for
future use.
Security Parameter Index (SPI) - It is arbitrary 32-bit field. It is very important field which
identifies all packets which belongs to present connection. If we’re sending data from Source
A to Destination B. Both A and B will already know algorithm and key they are going to use.
So for Authentication, hashing function and key will be required which only source and
destination will know about. Secret key between A and B is exchanged by method of Diffie
Hellman algorithm. So Hashing algorithm and secret key for Security parameter index of
connection will be fixed. Before data transfer starts security association needs to be
established. In Security Association, both parties needs to communicate prior to data
exchange. Security association tells what is security parameter index, hashing algorithm and
secret key that are being used.
Sequence Number - This unsigned 32-bit field contains counter value that increases by one
for each packet sent. Every packet will need sequence number. It will start from 0 and will go
till 232 232 – 1 and there will be no wrap around. Say, if all sequence numbers are over
and none of it is left but we cannot wrap around as it is not allowed. So, we will end
connection and re-establish connection again to resume transfer of remaining data from
sequence number 0. Basically sequence numbers are used to stop replay attack. In Replay
attack, if same message is sent twice or more, receiver won’t be able to know if both
messages are sent from a single source or not. Say, I am requesting 100$ from receiver and
Intruder in between asked for another 100$. Receiver won’t be able to know that there is
intruder in between.
Authentication Data (Integrity Check Value) - Authentication data is variable length field
that contains Integrity Check Value (ICV) for packet. Using hashing algorithm and secret
key, sender will create message digest which will be sent to receiver. Receiver on other hand
will use same hashing algorithm and secret key. If both message digest matches then receiver
will accept data. Otherwise, receiver will discard it by saying that message has been modified
in between. So basically, authentication data is used to verify integrity of transmission. Also
length of Authentication data depends upon hashing algorithm you choose.
Encapsulating security payload, also abbreviated as ESP plays a very important role in network
security. ESP or Encapsulating security payload is an individual protocol in IPSec. ESP is
responsible for the CIA triad of security (Confidentiality, Integrity, Availability), which is
considered significant only when encryption is carried along with them. Securing all payload/
packets/ content in IPv4 and IPv6 is the responsibility of ESP.
As the name suggests, it involves encapsulation of the content/ payload encrypts it to suitable
form and then there a security check or authentication takes place for payload in IP Network.
Encryption/ encapsulation and security/ authentication make the payload extremely secure and
safe from any kind of harm or threat to content/ data/ payload being stolen by any third party.
The encryption process is performed by authenticated user, similarly, the decryption process is
carried out only when the receiver is verified, thus making the entire process very smooth and
secure. The entire encryption that is performed by ESP is carried on the principle of the integrity
of payload and not on the typical IP header.
Modes in ESP:
Encapsulating Security Payload supports two modes, i.e. Transport mode, and tunnel mode.
Tunnel mode:
1. Mandatory in Gateway, tunnel mode holds utmost importance.
2. Here, a new IP Header is created which is used as the outer IP Header followed by ESP.
Transport mode:
1. Here, IP Header is not protected via encryption or authentication, making it vulnerable to
threats
2. Less processing is seen in this mode, so the inclusion of ESP is preferred
Advantages:
Below listed are the advantages of Encapsulating Security Payload:
1. Encrypting data to provide security
2. Maintaining a secure gateway for data/ message transmission
3. Properly authenticating the origin of data
4. Providing needed data integrity
5. Maintaining data confidentiality
6. Helping with antireplay service using authentication header
Disadvantages:
Below listed are the disadvantages of Encapsulating Security Payload:
1. There is a restriction on the encryption method to be used
2. For global use and implementation, weaker encryptions are mandatory to use
1. IP Header:
o The original IP header precedes the ESP header.
2. ESP Header:
o Contains:
Security Parameters Index (SPI): Identifies the security association.
Sequence Number: Provides anti-replay protection.
3. Payload:
o This is the original data being transmitted, which is encrypted for confidentiality.
4. ESP Trailer:
o Added after the payload and contains:
Padding: Ensures the payload is aligned to the required block size for
encryption.
Padding Length: Indicates the size of the padding.
Next Header: Indicates the protocol of the next header (e.g., TCP, UDP).
5. ESP Authentication Data:
o A hash-based message authentication code (HMAC) is appended to provide
integrity and authentication for the entire packet.
1. Encryption:
o The original payload (data) is encrypted using a symmetric encryption algorithm
(e.g., AES, 3DES) before transmission. The encryption key is derived from the
Security Association.
2. Integrity Check:
o An HMAC is calculated over the entire ESP packet (including the ESP header,
payload, and trailer) to ensure data integrity and authentication.
3. Transmission:
o The complete ESP packet is sent over the network to the intended recipient.
4. Decryption and Verification:
o Upon receiving the ESP packet, the recipient first verifies the integrity by checking
the HMAC. If it is valid, the recipient then decrypts the payload to retrieve the
original data.
Advantages of ESP
Comprehensive Security: Provides confidentiality, integrity, and authentication in a single
protocol.
Flexibility: Supports various encryption and authentication algorithms, allowing
customization based on security requirements.
Widely Supported: ESP is a standard part of IPsec and is implemented across many
platforms and devices, facilitating interoperability.
Applications of ESP
Virtual Private Networks (VPNs): Commonly used to create secure tunnels for remote
access or site-to-site connections.
Secure Communication: Protects sensitive data transmitted across public networks, such
as financial transactions and personal information.
Secure VoIP: Ensures the confidentiality and integrity of voice communications over IP.
Encapsulating Security Payload (ESP) is a vital component of the IPsec suite, providing a robust
framework for securing IP communications. By offering encryption, integrity, and authentication,
ESP ensures that sensitive data remains protected during transmission over potentially insecure
networks. Understanding its structure and functionality is essential for implementing effective
security measures in modern networking environments.
A Security Association is a set of parameters that define how IPsec will secure communication
between two parties. Each SA includes:
Web security refers to the measures and practices used to protect websites, web applications, and
online services from various threats and vulnerabilities. As online interactions increase, securing
web environments has become critical to protect sensitive data and maintain user trust.
SSL or Secure Sockets Layer, is an Internet security protocol that encrypts data to keep it safe. It
was created by Netscape in 1995 to ensure privacy, authentication, and data integrity in online
communications. SSL is the older version of what we now call TLS (Transport Layer Security).
Working of SSL
Encryption: SSL encrypts data transmitted over the web, ensuring privacy. If someone
intercepts the data, they will see only a jumble of characters that is nearly impossible to
decode.
Authentication: SSL starts an authentication process called a handshake between two
devices to confirm their identities, making sure both parties are who they claim to be.
Data Integrity: SSL digitally signs data to ensure it hasn't been tampered with, verifying
that the data received is exactly what was sent by the sender.
o
SSL Certificates
SSL certificates are issued by Certificate Authorities (CAs) and are essential for
establishing trust in SSL connections. There are different types of certificates:
o Domain Validated (DV): Verifies the ownership of the domain.
o Organization Validated (OV): Includes verification of the organization’s identity.
o Extended Validation (EV): Provides the highest level of assurance by thoroughly
vetting the organization.
SSL Certificate
SSL (Secure Sockets Layer) certificate is a digital certificate used to secure and verify the
identity of a website or an online service. The certificate is issued by a trusted third-party called a
Certificate Authority (CA), who verifies the identity of the website or service before issuing the
certificate.
The SSL certificate has several important characteristics that make it a reliable solution for
securing online transactions :
Encryption: The SSL certificate uses encryption algorithms to secure the communication
between the website or service and its users. This ensures that the sensitive information,
such as login credentials and credit card information, is protected from being intercepted
and read by unauthorized parties.
Authentication: The SSL certificate verifies the identity of the website or service,
ensuring that users are communicating with the intended party and not with an impostor.
This provides assurance to users that their information is being transmitted to a trusted
entity.
Integrity: The SSL certificate uses message authentication codes (MACs) to detect any
tampering with the data during transmission. This ensures that the data being transmitted is
not modified in any way, preserving its integrity.
Non-repudiation: SSL certificates provide non-repudiation of data, meaning that the
recipient of the data cannot deny having received it. This is important in situations where
the authenticity of the information needs to be established, such as in e-commerce
transactions.
Public-key cryptography: SSL certificates use public-key cryptography for secure key
exchange between the client and server. This allows the client and server to securely
exchange encryption keys, ensuring that the encrypted information can only be decrypted
by the intended recipient.
Session management: SSL certificates allow for the management of secure sessions,
allowing for the resumption of secure sessions after interruption. This helps to reduce the
overhead of establishing a new secure connection each time a user accesses a website or
service.
Certificates issued by trusted CAs: SSL certificates are issued by trusted CAs, who are
responsible for verifying the identity of the website or service before issuing the
certificate. This provides a high level of trust and assurance to users that the website or
service they are communicating with is authentic and trustworthy.
Encryption:
TLS/SSL can help to secure transmitted data using encryption.
Interoperability:
TLS/SSL works with most web browsers, including Microsoft Internet Explorer and on
most operating systems and web servers.
Algorithm flexibility:
TLS/SSL provides operations for authentication mechanism, encryption algorithms and
hashing algorithm that are used during the secure session.
Ease of Deployment:
Many applications TLS/SSL temporarily on a windows server 2003 operating systems.
Ease of Use:
Because we implement TLS/SSL beneath the application layer, most of its operations are
completely invisible to client.
Limitations of SET
Complexity: The protocol is considered complex and requires substantial infrastructure,
which can deter its widespread adoption.
Cost: The need for digital certificates and associated infrastructure can be costly for smaller
merchants.
Limited Adoption: While SET was an early attempt at secure online transactions, it was
eventually overshadowed by simpler protocols like SSL/TLS, which became the standard
for secure web communications.
SET was a pioneering effort to secure online credit card transactions, emphasizing confidentiality,
authentication, and integrity. While it introduced valuable concepts in payment security, its
complexity and costs limited its adoption in favour of simpler, more efficient protocols like
SSL/TLS. Understanding SET's principles can still provide insight into the evolution of online
payment security.
Network management security involves safeguarding the processes, tools, and protocols used to
monitor, manage, and maintain computer networks. As networks grow in complexity and scale,
securing their management aspects becomes critical to prevent unauthorized access, data breaches,
and other malicious activities.
Network management security is essential for protecting the integrity, confidentiality, and
availability of networked resources. By implementing robust security measures, organizations can
safeguard their network management systems against unauthorized access, vulnerabilities, and
other security threats, ensuring a stable and secure network environment.
Architecture of SNMP
There are mainly three main components in SNMP architecture:
SNMP Manager: It is a centralized system used to monitor the network. It is also known
as a Network Management Station (NMS). A router that runs the SNMP server program is
called an agent, while a host that runs the SNMP client program is called a manager.
SNMP agent: It is a software management software module installed on a managed
device. The manager accesses the values stored in the database, whereas the agent
maintains the information in the database. To ascertain if the router is congested or not,
for instance, a manager can examine the relevant variables that a router stores, such as the
quantity of packets received and transmitted.
Management Information Base: MIB consists of information on resources that are to be
managed. This information is organized hierarchically. It consists of objects instances
which are essentially variables. A MIB, or collection of all the objects under management
by the manager, is unique to each agent. System, interface, address translation, IP, UDP ,
and EGP , ICMP , TCP are the eight categories that make up MIB. The MIB object is
home to these groups.
SNMP Messages
GetRequest : It is simply used to retrieve data from SNMP agents. In response to this, the
SNMP agent responds with the requested value through a response message.
GetNextRequest : To get the value of a variable, the manager sends the agent the
GetNextRequest message. The values of the entries in a table are retrieved using this kind
of communication. The manager won't be able to access the values if it doesn't know the
entries' indices. The GetNextRequest message is used to define an object in certain
circumstances.
SetRequest : It is used by the SNMP manager to set the value of an object instance on the
SNMP agent.
Response : When sent in response to the Set message, it will contain the newly set value
as confirmation that the value has been set.
Trap : These are the message sent by the agent without being requested by the manager.
It is sent when a fault has occurred.
InformRequest : It was added to SNMPv2c and is used to determine if the manager has
received the trap message or not. It is the same as a trap but adds an acknowledgement
that the trap doesn't provide.
SNMPv1 Community Facility:-
In SNMPv1 (Simple Network Management Protocol version 1), the community facility serves
as a basic method for authentication and access control between the SNMP manager and the
managed devices (agents). Community strings act as "passwords" that allow or restrict access to the
information on the managed devices.
1. Community Strings:
o These are plain text strings used to authenticate messages between the SNMP
manager and the SNMP agent. There are typically two types of community strings:
Read Community: Grants read-only access to the SNMP agent. This allows
the manager to retrieve data from the device.
Write Community: Grants read-write access to the SNMP agent. This
allows the manager to modify the device's configuration and settings.
2. Default Community Strings:
o Many devices come with default community strings (e.g., "public" for read access
and "private" for write access). Leaving these unchanged can pose significant
security risks.
3. Access Control:
o Community strings provide a basic level of access control but lack the strong
security measures found in later SNMP versions. They do not encrypt the data or
authenticate the source of the request beyond the community string.
4. SNMP Messages:
o When the SNMP manager sends a request to a managed device, it includes the
relevant community string. The device checks this string to determine if the request
is valid and whether the manager has the appropriate permissions.
SNMPv3 is the latest version of the Simple Network Management Protocol, designed to address
the security limitations of its predecessors, SNMPv1 and SNMPv2c. It introduces significant
enhancements in security and administration, making it more suitable for modern network
environments.
Key Features of SNMPv3
1. Security Enhancements:
o SNMPv3 provides three main security features:
Authentication: Verifies the identity of users accessing the SNMP data. It
ensures that only authorized users can send requests or receive information.
Privacy (Encryption): Encrypts the SNMP messages to protect sensitive
information during transmission. This ensures that intercepted messages
cannot be read by unauthorized parties.
Integrity: Ensures that the data has not been altered during transmission.
SNMPv3 uses hashing to verify that messages are intact.
2. User-Based Security Model (USM):
o SNMPv3 uses a User-Based Security Model, where security settings are associated
with specific users rather than community strings. Each user can have different
access rights and security configurations.
3. View-Based Access Control Model (VACM):
o VACM provides fine-grained access control, allowing administrators to define
which users have access to which parts of the MIB (Management Information Base).
This enables more tailored security policies.
4. Inform Requests:
o SNMPv3 introduces inform requests, which allow for more reliable message
delivery. Unlike traps, inform requests require an acknowledgment from the
manager, ensuring that critical alerts are received.