NSP M3 Ktunotes - in
NSP M3 Ktunotes - in
• Purpose of IP Security
• Application specific security measures insufficient
• Organizations have needs of security which cut layers
• IP-level security enhances both application security
already in place, and provides to security to applications
lacking security
• What an IP Security system should provide
• Three functional areas
• Authentication
• Confidentiality
• Key management
• Look at security architecture, then each of the functional areas
IP Security Overview 3
5
Benefits of IPSec 6
6
7
Routing Application
IP Security Architecture
8
9
10
•Encapsulating Security Payload (ESP): Covers the packet format and general issues related to the use of
the ESP for packet encryption and, optionally, authentication.
• ● Authentication Header (AH): Covers the packet format and general issues related to the use of AH for
packet authentication.
•● Encryption Algorithm: A set of documents that describe how various encryption algorithms are used for
ESP.
•● Authentication Algorithm: A set of documents that describe how various authentication algorithms are
used for AH and for the authentication option of ESP.
•● Domain of Interpretation (DOI): Contains values needed for the other documents to relate to each other.
These include identifiers for approved encryption and authentication algorithms, as well as operational
parameters such as key lifetime.
11
IPSec Services
IPSec provides security services at the IP layer by enabling a system to select required
security protocols, determine the algorithm(s) to use for the service(s), and put in place
any cryptographic keys required to provide the requested services.
Two protocols are used to provide security: an authentication protocol designated by
the header of the protocol, Authentication Header (AH); and a combined
encryption/authentication protocol designated by the format of the packet for that
protocol, Encapsulating Security Payload (ESP).
11
12
IPSec Services
Access control
Connectionless integrity
Data origin authentication
Rejection of replayed packets
Confidentiality (encryption)
Limited traffic flow confidentiality
12
13
IP Security Policy
A security policy is applied to each IP packet that
transits from a source to a destination
IP sec policy is determined primarily by the
interaction of two databases,
The security association database (SAD)
The security policy database (SPD)
13
14
Security Associations
• A key concept that appears in both the authentication and confidentiality
mechanisms for IP is the security association (SA).
14
15
• ● Security Parameters Index (SPI): A bit string assigned to this SA and having local
significance only. The SPI is carried in AH and ESP headers to enable the receiving
system to select the SA under which a received packet will be processed.
• ● IP Destination Address: Currently, only unicast addresses are allowed; this is the
address of the destination endpoint of the SA, which may be an end user system or a
network system such as a firewall or router.
• ● Security Protocol Identifier: This indicates whether the association is an AH or ESP
security association.
• Hence, in any IP packet, the security association is uniquely identified by the
Destination Address in the IPv4 or IPv6 header and the SPI in the enclosed extension
header (AH or ESP).
Security AssociationDatabase 16
In each IPSec implementation, there is a nominal Security Association Database that defines
the parameters associated with each SA. A security association is normally defined by the
following parameters
16
17
18
19
Security PolicyDatabase
IPSec provides good flexibility in discriminating
between the traffic
that needs IPSec protection and
that is allowed to bypass IPSec
Security Policy Database (SPD) entry called
selectors are used to filter outgoing traffic for a
particular SA
19
20
20
21
IPSec ProtocolMode
•Another important concept reused:
• Transport mode: Protection of packet payload
• Tunnel mode: Protection of entire packet
• Transport mode used in end to end communication between
hosts.
• ESP: encrypts (+ authenticate) payload, not header
• AH: Authenticates payload, selected header bits
• Tunnel mode: new routing info added
• ESP: encrypts (+ authenticate) packet(not outer header)
• AH: authenticates entire packet, selected outer bits
22
23
24
Authentication Header (AH) 25
Provides support for data integrity & authentication of IP
packets
The data integrity feature ensures that undetected
modification to a packet’s content is not possible in transit.
The authentication feature enables an end system or
network device to authenticate the user or application and
filter traffic accordingly.
It also prevents address spoofing attack and replay attack.
Based on use of a MAC
HMAC-MD5-96 or HMAC-SHA-1-96
Parties must share a secret key
26
Authentication Header
27
Anti-Replay Service 28
The Authentication Data field holds a value called Integrity Check Value
ICV is a MAC
Transport & Tunnel Modes 31
32
Figure shows two ways in which the IPSec authentication service can be used.
In one case, authentication is provided directly between a server and client workstations;
the workstation can be either on the same network as the server or on an external network.
As long as the workstation and the server share a protected secret key, the authentication
process is secure.
This case uses a transport mode SA.
In the other case, a remote workstation authenticates itself to the corporate firewall, either
for access to the entire internal network or because the requested server does not support
the authentication feature.
This case uses a tunnel mode SA
33
For transport mode AH using IPv4, the AH is inserted after the original IP header
and before the IP payload (e.g., a TCP segment);
Authentication covers the entire packet, excluding mutable fields in the IPv4 header
that are set to zero for MAC calculation.
For tunnel mode AH, the entire original IP packet is authenticated, and34the AH is inserted
between the original IP header and a new outer IP header .
The inner IP header carries the ultimate source and destination addresses, while an
outer IP header may contain different IP addresses (e.g., addresses of firewalls or other
security gateways).
With tunnel mode, the entire inner IP packet, including the entire inner IP header is protected
by AH. The outer IP header (and in the case of IPv6, the outer IP extension headers) is
protected except for mutable and unpredictable fields.
35
The Payload Data, Padding, Pad Length, and Next Header fields are
encrypted by the ESP service.
● The ESP format requires that the Pad Length and Next Header fields be right
aligned within a 32- bit word. Equivalently, the ciphertext must be an integer multiple
of 32 bits. The Padding field is used to assure this alignment.
• For this mode using IPv4, the ESP header is inserted into the IP packet
immediately prior to the transport-layer header (e.g., TCP, UDP, ICMP) and an ESP
trailer (Padding, Pad Length, and Next Header fields) is placed after the IP packet;
if authentication is selected, the ESP Authentication Data field is added after the
ESP trailer.
• The entire transport-level segment plus the ESP trailer are encrypted.
2. The packet is then routed to the destination. Each intermediate router needs to examine
and process the IP header plus any plaintext IP extension headers but does not need to
examine the ciphertext.
3. The destination node examines and processes the IP header plus any plaintext IP
extension headers. Then, on the basis of the SPI in the ESP header, the destination node
decrypts the remainder of the packet to recover the plaintext transport-layer segment.
Tunnel Mode ESP
43
1. The source prepares an inner IP packet with a destination address of the target
internal host. This packet is prefixed by an ESP header; then the packet and ESP
trailer are encrypted and Authentication Data may be added. The resulting block is
encapsulated with a new IP header (base header plus optional extensions such as
routing and hop-by-hop options for IPv6) whose destination address is the firewall;
this forms the outer IP packet.
2. The outer packet is routed to the destination firewall. Each intermediate router
needs to examine and process the outer IP header plus any outer IP extension
headers but does not need to examine the ciphertext.
3. The destination firewall examines and processes the outer IP header plus any outer
IP extension headers. Then, on the basis of the SPI in the ESP header, the
destination node decrypts the remainder of the packet to recover the plaintext
inner IP packet. This packet is then transmitted in the internal network.
4. The inner packet is routed through zero or more routers in the internal network to
the destination host.
44
29
Combining SecurityAssociations 45
45
Combining SecurityAssociations 46
46
47
Combining Security Associations: Authentication
PlusConfidentiality
Encryption and authentication can be combined in
order to transmit an IP packet that has both
confidentiality and authentication between hosts.
In this approach, the user first applies ESP to the data to be protected and then
appends the authentication data field. There are actually two subcases:
For both cases, authentication applies to the ciphertext rather than the
plaintext.
48
Transport Adjacency 49
Another way to apply authentication after encryption is to use two bundled
transport SAs, with the inner being an ESP SA and the outer being an AH SA.
In this case ESP is used without its authentication option.
Because the inner SA is a transport SA, encryption is applied to the IP payload.
The resulting packet consists of an IP header (and possibly IPv6 header
extensions) followed by an ESP.
AH is then applied in transport mode, so that authentication covers the ESP plus
the original IP header (and extensions) except for mutable fields.
The advantage of this approach over simply using a single ESP SA with the ESP
authentication option is that the authentication covers more fields, including the
source and destination IP addresses.
The disadvantage is the overhead of two SAs versus one SA.
49
Transport-Tunnel Bundle 50
50
Basic Combinations of Security Associations
51
In Case 1, all security is provided between end systems that implement IPSec.
For any two end systems to communicate via an SA, they must share the appropriate
secret keys.
Among the possible combinations:
a. AH in transport mode
b. ESP in transport mode
c. ESP followed by AH in transport mode (an ESP SA inside an AH SA)
d. Any one of a, b, or c inside an AH or ESP in tunnel mode
51
Basic Combinations of Security Associations
52
For Case 2, security is provided only between gateways (routers, firewalls, etc.) and no hosts
implement IPSec. This case illustrates simple virtual private network support. The security
architecture document specifies that only a single tunnel SA is needed for this case. The
tunnel could support AH, ESP, or ESP with the authentication option. Nested tunnels are not
required because the IPSec services apply to the entire inner packet.
52
Basic Combinations ofSecurity Associations
53
Here Case 3 builds on Case 2 by adding end-to-end security.
The same combinations discussed for cases 1 and 2 are allowed here. The gateway-to-gateway
tunnel provides either authentication or confidentiality or both for all traffic between end
systems. When the gateway-to-gateway tunnel is ESP, it also provides a limited form of traffic
confidentiality. Individual hosts can implement any additional IPSec services required for given
applications or given users by means of end-to-end SAs.
53
Basic Combinations ofSecurity Associations
54
Case 4 provides support for a remote host that uses the Internet to reach an
organization's firewall and then to gain access to some server or workstation behind
the firewall. Only tunnel mode is required between the remote host and the firewall.
As in Case 1, one or two SAs may be used between the remote host and the local
host.
40
Key Management 55
The key management portion of IPsec involves the determination and
distribution of secret keys
The IPsec Architecture document mandates support for two types of key
management:
Manual
Automated
The automated key management protocol for IPsec is referred to as
ISAKMP/Oakley
It consists of the following elements:
Oakley Key Determination Protocol
Internet Security Association and Key Management
Protocol (ISAKMP)
55
Oakley Key DeterminationProtocol
56
Oakley Features
57
IKE v2 Exchanges 58
58
59
59
IKE HeaderFormat 60
IKE PayloadTypes
All IKE payloads begin with the same generic payload header
60
61
IKE Payload Types
51
62
Web Security – Web security considerations. Secure Socket Layer and Transport
Layer Security (SSL/TLS) – SSL Architecture, SSL protocols, Cryptographic
computations, Transport layer security.
63
SSL Architecture
ALERT PROTOCOL
83
Handshake Protocol
• The most complex part of SSL is the Handshake Protocol.
• This protocol allows the server and client to authenticate each other and to negotiate an
encryption and MAC algorithm and cryptographic keys to be used to protect data sent in
an SSL record.
• The Handshake Protocol is used before any application data is transmitted.
• The Handshake Protocol consists of a series of messages exchanged by
client and server.
84
Handshake Protocol
Type(1 byte): indicates one of 10 messages (hello_request, client_hello etc)
Length(3 bytes): The length of message in bytes
Content(>-1 byte): Parameters related with the message
Handshake Protocol 85
SSL Handshake Protocol Message Types
86
87
• Phase 1. Establish Security Capabilities.
• This phase is used to initiate a logical connection and to establish the
security capabilities that will be associated with it. The exchange is
initiated by the client, which sends a client_hello message with the
following parameters:.
● Version: The highest SSL version understood by the client.
● Random: A client-generated random structure, consisting of a 32-bit timestamp and
28 bytes generated by a secure random number generator. These values serve as
nonces and are used during key exchange to prevent replay attacks.
● Session ID: A variable-length session identifier. A nonzero value indicates that the
client wishes to update the parameters of an existing connection or create a new
connection on this session. A zero value indicates that the client wishes to establish a
new connection on a new session.
88
After sending the client_hello message, the client waits for the server_hello message,
which contains the same parameters as the client_hello message. For the server_hello
message, the following conventions apply. The Version field contains the lower of the
version suggested by the client and the highest supported by the server. The Random
field is generated by the server and is independent of the client's Random field. If the
SessionID field of the client was nonzero, the same value is used by the server;
otherwise the server's SessionID field contains the value for a new session. The
CipherSuite field contains the single cipher suite selected by the server from those
proposed by the client. The Compression field contains the compression method
selected by the server from those proposed by the client
89
• The first element of the Cipher Suite parameter is the key exchange method (i.e., the
means by which the cryptographic keys for conventional encryption and MAC are
exchanged). The following key exchange methods are supported:
• RSA, Fixed Diffie-Hellman:, Ephemeral Diffie-Hellman, Anonymous Diffie-Hellman,
Fortezza.
• Following the definition of a key exchange method is the CipherSpec, which includes the
following fields:
• ● CipherAlgorithm: Any of the algorithms mentioned earlier: RC4, RC2, DES, 3DES, DES40, IDEA,
Fortezza
• ● MACAlgorithm: MD5 or SHA-1
• ● CipherType: Stream or Block
• ● IsExportable: True or False
• ● HashSize: 0, 16 (for MD5), or 20 (for SHA-1) bytes
• ● Key Material: A sequence of bytes that contain data used in generating the write keys
• ● IV Size: The size of the Initialization Value for Cipher Block Chaining (CBC) encryption
Phase 2. Server Authentication and Key Exchange 90
• The server begins this phase by sending its certificate, if it needs to be authenticated; the
message contains one or a chain of X.509 certificates.
• The certificate message is required for any agreed-on key exchange method except anonymous
Diffie-Hellman. Note that if fixed Diffie-Hellman is used, this certificate message functions as
the server's key exchange message because it contains the server's public Diffie-Hellman
parameters.
• Next, a server_key_exchange message may be sent if it is required. It is not required in two
instances: (1) The server has sent a certificate with fixed Diffie-Hellman parameters, or (2) RSA
key exchange is to be used.
• Next, a nonanonymous server (server not using anonymous Diffie-Hellman) can request a
certificate from the client. The certificate_request message includes two parameters:
certificate_type and certificate_authorities. The certificate type indicates the public-key
algorithm and its use:
• The final message in Phase 2, and one that is always required, is the server_done message,
which is sent by the server to indicate the end of the server hello and associated messages.
After sending this message, the server will wait for a client response. This message has no
parameters.
91
Phase 4. Finish
• This phase completes the setting up of a secure connection. The client sends a
change_cipher_spec message and copies the pending CipherSpec into the
current CipherSpec. Note that this message is not considered part of the
Handshake Protocol but is sent using the Change Cipher Spec Protocol. The
client then immediately sends the finished message under the new
algorithms, keys, and secrets. The finished message verifies that the key
exchange and authentication processes were successful.
• In response to these two messages, the server sends its own
change_cipher_spec message, transfers the pending to the current
CipherSpec, and sends its finished message. At this point the handshake is
complete and the client and server may begin to exchange application layer
data.
93
Cryptographic Computations
• The creation of a shared master secret by means of the key exchange
• The shared master secret is a one-time 48-byte value generated for this
session by means of secure key exchange
• RSA algorithm and Diffie-Hellman algorithm
• The generation of cryptographic parameters from the master secret
• CipherSpecs require a client write MAC secret, a server write MAC secret, a
client write key, a server write key, a client write IV, and a server write IV which
are generated from the master secret in that order
• These parameters are generated from the master secret
by hashing the master secret into a sequence of secure
bytes of sufficient length for all needed parameters
TRANSPORT LAYER SECURITY 94
What is Transport Layer Security
(TLS)?
• Transport Layer Security, or TLS, is a widely adopted security protocol
designed to facilitate privacy and data security for communications over
the Internet.
• A primary use case of TLS is encrypting the communication between web
applications and servers, such as web browsers loading a website.
• TLS can also be used to encrypt other A bit more about TLS!
communications such as email, messaging TLS was proposed by the Internet
Engineering Task Force (IETF), an
and voice over IP (VoIP).
international standards organization, and
the first version of the protocol was
published in 1999. The most recent
version is TLS 1.3, which was published in
2018.
95
• 1. version number
• The TLS Record Format is the same as that of the SSL Record
Format.
• The one difference is in version values. For the current version
of TLS, the Major Version is 3 and the Minor Version is 1
• 2.MAC
• There are two differences between the SSLv3 and TLS MAC
schemes:
• TLS uses HMAC
• SSL uses same .
• But for TLS the MAC covers the version field of the record
header too
97
• 3. more 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; of these, the following are always
fatal:
• decryption_failed: A ciphertext decrypted in an invalid way; either it was not an
even multiple of the block length or its padding values, when checked, were
incorrect.
• record_overflow: A TLS record was received with a payload (ciphertext) whose
length exceeds max length.
• 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.
• decrypt_error: A handshake cryptographic operation failed, including being unable
to verify a signature, decrypt a key exchange, or validate a finished message.
• user_canceled: This handshake is being canceled for some reason unrelated to a
protocol failure
98
4.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
5.certificate_verify message
• the hash is computed only over the handshake messages
• in SSL the hash contained the master_secret and pads
6. pseudorandom function PRF
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 objective is to make use of a relatively small shared secret
value but to generate longer blocks of data in a way that is secure from the kinds of attacks made on hash
functions and MACs.
• P_hash(secret, seed) = HMAC_hash( secret, A(1) | seed ) |
HMAC_hash( secret, A(2) | seed ) |
HMAC_hash( secret, A(3) | seed ) | …
where
A(0) = seed
A(i) = HMAC_hash(secret, A(i-1))
• PRF(secret, label, seed) =
P_MD5(secret_left, label | seed) Å P_SHA(secret_right, label | seed)
7.finished message 99
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
8.cryptographic computations
pre-master secret is calculated in the same way as in SSL master secret:
PRF( pre_master_secret,
“master secret”,
client_random | server_random )
key block:
PRF( master_secret,
“key expansion”,
server_random | client_random )
100
9.Padding
• In SSL, the padding added prior to encryption of user data is the minimum amount
required so that the total size of the data to be encrypted is a multiple of the cipher's
block length.
• In TLS, the padding can be any amount that results in a total that is a multiple of the
cipher's block length, up to a maximum of 255 bytes.
***********************************************************************