7 Security association set-up procedure
33.2033G Security3GPPAccess security for IP-based servicesTS
7.0 General
The security association set-up procedure is necessary in order to decide what security services to apply and when the security services start. In the IMS authentication of users is performed during registration as specified in clause 6.1. Subsequent signalling communications in this session will be integrity protected based on the keys derived during the authentication process.
7.1 Security association parameters
For protecting IMS signalling between the UE and the P‑CSCF it is necessary to agree on shared keys that are provided by IMS AKA, and a set of parameters specific to a protection method. The security mode setup (cf. clause 7.2) is used to negotiate the SA parameters required for IPsec ESP with authentication and confidentiality, in accordance with the provisions in clauses 5.1.3, 5.1.4, 6.2, and 6.3.
The SA parameters that shall be negotiated between UE and P‑CSCF in the security mode set-up procedure are:
– Encryption algorithm
Both the UE and the P‑CSCF shall adhere to the profiling given in clause 5.3.3 of 33.210 [5] with the addition that only algorithms that can be signalled according to Annex H needs to be supported.
– Integrity algorithm
Both the UE and the P‑CSCF shall adhere to the profiling given in clause 5.3.4 of 33.210 [5] with the addition that only algorithms that can be signalled according to Annex H needs to be supported.
NOTE 1: What is called "authentication algorithm" in RFC 4303 [54] is called "integrity algorithm" in this specification in order to be in line with the terminology used in other 3GPP specifications and, in particular, to avoid confusion with the authentication algorithms used in the AKA protocol.
NOTE 2: If one of the two integrity algorithms is compromised then it suffices for the IMS to remain secure that the algorithm is no longer supported by any P‑CSCF. The security mode set-up procedure (cf. clause 7.2) will then ensure that some other integrity algorithm is selected.
– SPI (Security Parameter Index)
The SPI is allocated locally for inbound SAs. The triple (SPI, destination IP address, security protocol) uniquely identifies an SA at the IP layer. The UE shall select the SPIs uniquely, and different from any SPIs that might be used in any existing SAs (i.e. inbound and outbound SAs). The SPIs selected by the P‑CSCF shall be different than the SPIs sent by the UE, cf. clause 7.2. In an authenticated registration, the UE and the P‑CSCF each select two SPIs, not yet associated with existing inbound SAs, for the new inbound security associations at the UE ‘s client and server ports and the P‑CSCF ‘s client and server ports respectively.
NOTE 3: This allocation of SPIs ensures that protected messages in the uplink always differ from protected messages in the downlink in, at least, the SPI field. This thwarts reflection attacks. When several applications use IPsec on the same physical interface the SIP application should be allocated a separate range of SPIs.
The following SA parameters are not negotiated:
– Life type: the life type is always seconds;
– SA duration: the SA duration has a fixed length of 232-1;
NOTE 4: The SA duration is a network layer concept. From a practical point of view, the value chosen for "SA duration" does not impose any limit on the lifetime of an SA at the network layer. The SA lifetime is controlled by the SIP application as specified in clause 7.4.
– Mode: transport mode;
– Key length: the length of the integrity key IKESP depends on the integrity algorithm, c.f. Annex I.
– Key length: the length of the encryption key depends on the encryption algorithm, c.f. Annex I.
Selectors:
The security associations (SA) have to be bound to specific parameters (selectors) of the SIP flows between UE and P‑CSCF, i.e. source and destination IP addresses, transport protocols that share the SA, and source and destination ports.
– IP addresses are bound to two pairs of SAs, as in clause 6.3, as follows:
– inbound SA at the P‑CSCF:
The source and destination IP addresses associated with the SA are identical to those in the header of the IP packet in which the initial SIP REGISTER message was received by the P‑CSCF.
– outbound SA at the P‑CSCF:
the source IP address bound to the outbound SA equals the destination IP address bound to the inbound SA;
the destination IP address bound to the outbound SA equals the source IP address bound to the inbound SA.
NOTE 5: This implies that the source and destination IP addresses in the header of the IP packet in which the protected SIP REGISTER message was received by the P‑CSCF need to be the same as those in the header of the IP packet in which the initial SIP REGISTER message was received by the P‑CSCF.
– The transport protocol selector shall allow UDP and TCP.
– Ports:
1. The P‑CSCF associates two ports, called port_ps and port_pc, with each pair of security associations established in an authenticated registration. The ports port_ps and port_pc are different from the standard SIP ports 5060 and 5061. No unprotected messages shall be sent from or received on the ports port_ps and port_pc. From a security point of view, unprotected messages may be received on any port which is different from the ports port_ps and port_pc. The number of the ports port_ps and port_pc are communicated to the UE during the security mode set-up procedure, cf. clause 7.2. These ports are used with both, UDP and TCP. The use of these ports may differ for TCP and UDP, as follows:
UDP case: the P‑CSCF receives requests and responses protected with ESP from any UE on the port port_ps (the"protected server port"). The P‑CSCF sends requests and responses protected with ESP to a UE on the port port_pc (the "protected client port").
TCP case: the P-CSCF, if it does not have a TCP connection from its port_pc to the port_us of the UE, shall set up a TCP connection from its port_pc to the port port_us of the UE before sending a request to it.
NOTE 6: Both the UE and the P‑CSCF may set up a TCP connection from their client port to the other end’s server port on demand. An already existing TCP connection from their client port to the other end’s server port is reused by both the P‑CSCF or the UE for sending SIP requests by client and SIP responses by server; but it is not mandatory to maintain such TCP connection longer than required in RFC 3261 [6].
NOTE 7: The protected server port port_ps stays fixed for a UE until all IMPUs from this UE are de‑registered. It may be fixed for a particular P‑CSCF over all UEs, but there is no need to fix the same protected server port for different P‑CSCFs.
NOTE8: The distinction between the UDP and the TCP case reflects the different behaviour of SIP over UDP and TCP, as specified in section 18 of RFC 3261 [6].
2. The UE associates two ports, called port_us and port_uc, with each pair of security associations established in an authenticated registration. The ports port_us and port_uc are different from the standard SIP ports 5060 and 5061. No unprotected messages shall be sent from or received on the ports port_us and port_uc. From a security point of view, unprotected messages may be received on any port which is different from the ports port_us and port_uc. The number of the ports port_us and port_uc are communicated to the P-CSCF during the security mode set-up procedure, cf. clause 7.2. These ports are used with both, UDP and TCP. The use of these ports may differ for TCP and UDP, as follows:
UDP case: the UE receives requests and responses protected with ESP on the port port_us (the"protected server port"). The UE sends requests and responses protected with ESP on the port port_uc (the "protected client port").
TCP case: the UE, if it does not have a TCP connection towards the P‑CSCF yet, shall set up a TCP connection to the port port_ps of the P‑CSCF before sending a request to it.
NOTE 9: Both the UE and the P‑CSCF may set up a TCP connection from their client port to the other end’s server port on demand. An already existing TCP connection may be reused by both the P‑CSCF or the UE, but it is not mandatory.
NOTE 10: The protected server port port_us stays fixed for a UE until all IMPUs from this UE are de-registered.
NOTE 11: The distinction between the UDP and the TCP case reflects the different behaviour of SIP over UDP and TCP, as specified in section 18 of RFC 3261 [6]
3. The P‑CSCF is allowed to receive only REGISTER messages, messages relating to emergency services in accordance with TS 23.167 [31] and TS 24.229 [8], and error messages related to unprotected messages on unprotected ports. All other messages not arriving on a protected port shall be either discarded or rejected by the P‑CSCF.
4. The UE is allowed to receive only the following messages on an unprotected port:
– responses to unprotected REGISTER messages;
– messages relating to emergency services in accordance with TS 23.167 [31] and TS 24.229 [8];
– error messages related to unprotected messages.
All other messages not arriving on a protected port shall be rejected or silently discarded by the UE.
The following rules apply:
1. For each unidirectional SA which has been established and has not expired, the SIP application at the P‑CSCF stores at least the following data: (UE_IP_address, UE_protected_port, P-CSCF_protected_port, SPI, IMPI, IMPU1, … , IMPUn, lifetime) in an "SA_table". The pair (UE_protected_port, P-CSCF_protected_port) equals either (port_uc, port_ps) or (port_us, port_pc).
NOTE 12: The SPI is only required when initiating and deleting SAs in the P‑CSCF. The SPI is not exchanged between IPsec and the SIP layer for incoming or outgoing SIP messages.
2. The SIP application at the P‑CSCF shall check upon receipt of a protected REGISTER message that the source IP address in the packet headers coincide with the UE’s IP address inserted in the Via header of the protected REGISTER message. If the Via header does not explicitly contain the UE’s IP address, but rather a symbolic name then the P‑CSCF shall first resolve the symbolic name by suitable means to obtain an IP address.
3. The SIP application at the P‑CSCF shall check upon receipt of an initial REGISTER message or a re-REGISTER message that the pair (UE_IP_address, UE_protected_client_port), where the UE_IP_address is the source IP address in the packet header and the protected client port is sent as part of the security mode set-up procedure (cf. clause 7.2), has not yet been associated with entries in the "SA_table". Furthermore, the P‑CSCF shall check that, for any one IMPI, no more than six SAs per direction are stored at any one time. If these checks are unsuccessful the registration is aborted and a suitable error message is sent to the UE.
NOTE 13: According to clause 7.4 on SA handling, at most six SAs per direction per registered contact may exist at a P‑CSCF for one IMPI at any one time.
4. For each incoming protected message the SIP application at the P‑CSCF shall verify that the correct inbound SA according to clause 7.4 on SA handling has been used. The SA is identified by the triple (UE_IP_address, UE_protected_port, P‑CSCF_protected_port) in the "SA_table". The SIP application at the P‑CSCF shall further ensure that the user associated with the SA, which was used to protect the incoming message from the UE, is identical to the user who is associated at SIP level with the message sent by the P-CSCF towards the network.
NOTE 14: Not all SIP messages necessarily contain public or private identities, e.g. subsequent messages in a dialogue. Other information, e.g. a dialogue identifier, may be used to associate the message with a user at SIP level.
5. For each unidirectional SA which has been established and has not expired, the SIP application at the UE stores at least the following data: (UE_protected_port, P‑CSCF_protected_port, SPI, lifetime) in an "SA_table". The pair (UE_protected_port, P‑CSCF_protected_port) equals either (port_uc, port_ps) or (port_us, port_pc).
NOTE 15: The SPI is only required to initiate and delete SAs in the UE. The SPI is not exchanged between IPsec and the SIP layer for incoming or outgoing SIP messages.
6. When establishing a new pair of SAs (cf. clause 6.3) the SIP application at the UE shall ensure that the selected numbers for the protected ports do not correspond to an entry in the "SA_table".
NOTE 16: Regarding the selection of the number of the protected port at the UE it is generally recommended that the UE randomly selects the number of the protected port from a sufficiently large set of numbers not yet allocated at the UE. This is to thwart a limited form of a Denial of Service attack. UMTS PS access link security also helps to thwart this attack.
7. For each incoming protected message the SIP application at the UE shall verify that the correct inbound SA according to clause 7.4 on SA handling has been used. The SA is identified by the pair (UE_protected_port, P‑CSCF_protected_port) in the "SA table".
NOTE 17: If the integrity check of a received packet fails then IPsec will automatically discard the packet.
7.2 Set-up of security associations (successful case)
The set-up of security associations is based on RFC 3329 [21]. Annex H of this specification shows how to use RFC 3329 [21] for the set-up of security associations.
In this clause the normal case is specified i.e. when no failures occurs. Note that for simplicity some of the nodes and messages have been omitted. Hence there are gaps in the numbering of messages, as the I‑CSCF is omitted.
Figure 8
The UE sends a Register message towards the S‑CSCF to register the location of the UE and to set-up the security mode, cf. clause 6.1. In order to start the security mode set-up procedure, the UE shall include a Security-setup-line in this message.
The Security-setup-line in SM1 contains the Security Parameter Index (SPI)values and the protected ports selected by the UE. The UE includes two unique ports (one client and one server port) and two unique SPIs (one associated to the client port, and one associated to the server port) in the REGISTER.It also contains a list of identifiers for the integrity and encryption algorithms, which the UE supports.
|
SM1: REGISTER(Security-setup = SPI_U, Port_U, UE integrity and encryption algorithms list) |
SPI_U is the symbolic name of a pair of SPI values (cf. clause 7.1) (spi_uc, spi_us) that the UE selects. spi_uc is the SPI of the inbound SA at UE’s the protected client port, and spi_us is the SPI of the inbound SA at the UE’s protected server port. The syntax of spi_uc and spi_us are defined in Annex H.
NOTE 1: The syntax defined in Annex H allows a large freedom of number of SPIs. Only one pair of unique SPIs is included in the Security-setup.
Port_U is the symbolic name of a pair of port numbers (port_uc, port_us) as defined in clause 7.1. The syntax of port_uc and port_us is defined in Annex H.
NOTE 2: The syntax defined in Annex H allows a large freedom of number of ports. Only one pair of unique ports is included in the Security-setup.Upon receipt of SM1, the P‑CSCF temporarily stores the parameters received in the Security-setup–line together with the UE’s IP address from the source IP address of the IP packet header, the IMPI and IMPU. Upon receipt of SM4, the P‑CSCF adds the keys IKIM and CKIM received from the S‑CSCF to the temporarily stored parameters.
The P‑CSCF then selects the SPIs for the inbound SAs. The P‑CSCF shall define the SPIs such that they are unique and different from any SPIs as received in the Security-setup-line from the UE.
NOTE 3: This rule is needed since the UE and the P‑CSCF use the same key for inbound and outbound traffic.
In order to determine the integrity and encryption algorithm the P‑CSCF proceeds as follows: the P‑CSCF has a list of integrity and encryption algorithms it supports, ordered by priority. The P‑CSCF selects the first algorithm combination on its own list which is also supported by the UE. If the UE did not include any confidentiality algorithm in SM1 then the P-CSCF shall either select the NULL encryption algorithm or abort the procedure, according to its policy on confidentiality.
NOTE 4: It should be noted that, if the P-CSCF policy requires confidentiality, then all UEs with no encryption support would be denied access to the IMS network. This would apply in particular to UEs, which support only a Release 5-version of this specification or only GIBA according to Annex T of this specification.
The P‑CSCF then establishes two new pairs of SAs in the local security association database.
The Security-setup-line in SM6 contains the SPIs and the ports assigned by the P‑CSCF. It also contains a list of identifiers for the integrity and encryption algorithms, which the P‑CSCF supports. The only exception from this is the case that the P‑CSCF is configured to never apply confidentiality. In this case, it shall not include encryption algorithms to the Security-setup-line in SM6.
NOTE 5: The P‑CSCF may be configured to never apply confidentiality, e.g. because it trusts the encryption provided by the underlying access network. If the P-CSCF is configured to apply confidentiality whenever the UE supports it then the P-CSCF always includes the encryption algorithms in SM6, which it supports, even if the UE did not include encryption algorithms in SM1. This is to thwart bidding down attacks.
|
SM6: 4xx Auth_Challenge(Security-setup = SPI_P, Port_P, P‑CSCF integrity and encryption algorithms list) |
SPI_P is the symbolic name of the pair of SPI values (cf. clause 7.1) (spi_pc, spi_ps) that the P‑CSCF selects. spi_pc is the SPI of the inbound SA at the P‑CSCF’s protected client port, and spi_ps is the SPI of the inbound SA at the P‑CSCF’s protected server port. The syntax of spi_pc and spi_ps is defined in Annex H.
Port_P is the symbolic name of the port numbers (port_pc, port_ps) as defined in clause 7.1. The syntax of Port_P is defined in Annex H.
Upon receipt of SM6, the UE determines the integrity and encryption algorithms as follows: the UE selects the first integrity and encryption algorithm combination on the list received from the P‑CSCF in SM 6 which is also supported by the UE. If the P-CSCF did not include any confidentiality algorithm in SM6 then the UE shall select the NULL encryption algorithm.
NOTE 6: Release 5 UE will not support any encryption algorithms, and will choose the first Release 5 integrity algorithm on the list received from the P‑CSCF in SM6.
The UE then proceeds to establish two new pairs of SAs in the local SAD.
The UE shall integrity and confidentiality protect SM7 and all following SIP messages. Furthermore the integrity and encryption algorithms list, SPI_P, and Port_P received in SM6, and SPI_U, Port_U sent in SM1 shall be included:
|
SM7: REGISTER(Security-setup = SPI_U, Port_U, SPI_P, Port_P, P‑CSCF integrity and encryption algorithms list) |
After receiving SM7 from the UE, the P‑CSCF shall check whether the integrity and encryption algorithms list, SPI_P and Port_P received in SM7 is identical with the corresponding parameters sent in SM6. It further checks whether SPI_U and Port_U received in SM7 are identical with those received in SM1. If these checks are not successful the registration procedure is aborted. The P‑CSCF shall include in SM8 information to the S‑CSCF that the received message from the UE was integrity protected as indicated in clause 6.1.5. The P‑CSCF shall add this information to all subsequent REGISTER messages received from the UE that have successfully passed the integrity check in the P‑CSCF.
|
SM8: REGISTER(Integrity-Protection = Successful, IMPI) |
The P‑CSCF finally sends SM12 to the UE. SM12 does not contain information specific to security mode setup (i.e. a Security-setup line), but with sending SM12 not indicating an error the P‑CSCF confirms that security mode setup has been successful. After receiving SM12 not indicating an error, the UE can assume the successful completion of the security-mode setup.
An example of how to make use of two pairs of unidirectional SAs is illustrated in figure 9 with a set of example message exchanges protected by the respective IPsec SAs where the INVITE and following messages are assumed to be carried over TCP.
Figure 9
7.3 Error cases in the set-up of security associations
7.3.1 Error cases related to IMS AKA
7.3.1.0 General
Errors related to IMS AKA failures are specified in clause 6.1. However, this clause additionally describes how these shall be treated, related to security setup.
7.3.1.1 User authentication failure
In this case, SM7 fails integrity check by IPsec at the P‑CSCF if the IKIM derived from RAND at UE is wrong. The SIP application at the P‑CSCF never receives SM7. It shall delete the temporarily stored SA parameters associated with this registration after a time-out.
In case IKIM was derived correctly, but the response was wrong the authentication of the user fails at the S‑CSCF due to an incorrect response. The S‑CSCF shall send a 4xx Auth_Failure message to the UE, via the P‑CSCF, which may pass through an already established SA. Afterwards, both, the UE and the P‑CSCF shall delete the new SAs.
7.3.1.2 Network authentication failure
If the UE is not able to successfully authenticate the network, the UE shall send a REGISTER message which may pass through an already established SA, indicating a network authentication failure, to the P‑CSCF. The P‑CSCF deletes the new SAs after receiving this message.
7.3.1.3 Synchronisation failure
In this situation, the UE observes that the AUTN sent by the network in SM6 contains an out-of-range sequence number. The UE shall send a REGISTER message to the P‑CSCF, which may pass through an already established SA, indicating the synchronization failure. The P‑CSCF deletes the new SAs after receiving this message.
7.3.1.4 Incomplete authentication
If the UE responds to an authentication challenge from a S‑CSCF, but does not receive a reply before the request times out, the UE shall start a registration procedure if it still requires any IM services. The first message in this registration should be protected with an SA created by a previous successful authentication if one exists.
When the P‑CSCF receives a challenge from the S‑CSCF and creates the corresponding SAs during a registration procedure, it shall delete any information relating to any previous registration procedure (including the SAs created during the previous registration procedure).
If the P‑CSCF deletes a registration SA due to its lifetime being exceeded, the P‑CSCF should delete any information relating to the registration procedure that created the SA.
7.3.2 Error cases related to the Security-Set-up
7.3.2.1 Proposal unacceptable to P‑CSCF
In this case the P‑CSCF cannot accept the proposal set sent by the UE in the Security-Set-up command of SM1. The P‑CSCF shall respond to SM1 indicating a failure, by sending an error response to the UE.
7.3.2.2 Proposal unacceptable to UE
If the P‑CSCF sends in the security-setup line of SM6 a proposal that is not acceptable for the UE, the UE shall abandon the registration procedure.
7.3.2.3 Failed consistency check of Security-Set-up lines at the P‑CSCF
The P‑CSCF shall check whether authentication and encryption algorithms list received in SM7 is identical with the authentication and encryption algorithms list sent in SM6. If this is not the case the registration procedure is aborted. (Cf. clause 7.2).
7.4 Authenticated re-registration
7.4.0 General
Every registration that includes a user authentication attempt produces new security associations. If the authentication is successful, then these new security associations shall replace the previous ones. This clause describes how the UE and P‑CSCF handle this replacement and which SAs to apply to which message.
When security associations are changed in an authenticated re-registration then the protected server ports at the UE (port_us) and the P‑CSCF (port_ps) shall remain unchanged, while the protected client ports at the UE (port_uc) and the P‑CSCF (port_pc) shall change. For the definition of these ports see clause 7.1.
If the UE has an already active pair of security associations, then it shall use this to protect the REGISTER message. If the S‑CSCF is notified by the P‑CSCF that the REGISTER message from the UE was integrity-protected it may decide not to authenticate the user by means of the AKA protocol. However, the UE may send unprotected REGISTER messages at any time. In this case, the S‑CSCF shall authenticate the user by means of the AKA protocol. In particular, if the UE considers the SAs no longer active at the P‑CSCF, e.g., after receiving no response to several protected messages, then the UE should send an unprotected REGISTER message.
Security associations may be unidirectional or bi-directional. This clause assumes that security associations are unidirectional, as this is the general case. For IP layer SAs, the lifetime mentioned in the following clauses is the lifetime held at the application layer. Furthermore deleting an SA means deleting the SA from both the application and IPsec layer. The message numbers, e.g. SM1, used in the following clauses relate to the message flow given in clause 6.1.1.
7.4.1 Void
7.4.1a Management of security associations in the UE
The UE shall be involved in only one registration procedure at a time, i.e. the UE shall remove any data relating to any previous incomplete registrations or authentications, including any SAs created by an incomplete authentication.
The UE may start a registration procedure with two existing pairs of SAs. These will be referred to as the old SAs. The authentication produces two pairs of new SAs. These new SAs shall not be used to protect non-authentication traffic until noted during the authentication flow. In the same way, certain messages in the authentication shall be protected with a particular SA. If the UE receives a message protected with the incorrect SA, it shall discard the message.
A successful authentication proceeds in the following steps:
– The UE sends the SM1 message to register with the IMS. If SM1 was protected, it shall be protected with the old outbound SA.
– The UE receives an authentication challenge in a message (SM6) from the P‑CSCF. This message shall be protected with the old inbound SA if SM1 was protected and unprotected otherwise.
– If this message SM6 can be successfully processed by the UE, the UE creates the new SAs, which are derived according to clause 7.1. The lifetime of the new SAs shall be set to allow enough time to complete the registration procedure. The UE then sends its response (SM7) to the P‑CSCF, which shall be protected with the new outbound SA. Meanwhile, if SM1 was protected, the UE shall use the old SAs for messages other than those in the authentication, until a successful message of new authentication is received (SM12); if SM1 was unprotected, the UE is not allowed to use IMS service until it receives an authentication successful message (SM12).
– The UE receives an authentication successful message (SM12) from the P‑CSCF. It shall be protected with the new inbound SA.
– After the successful processing of this message by the UE, the registration is complete. The UE sets the lifetime of the new SAs such that it either equals the latest lifetime of the old SAs or it will expire shortly after the registration timer in the message, depending which gives the SAs the longer life. For further SIP messages sent from UE, the new outbound SAs are used, with the following exception: when a SIP message is part of a pending SIP transaction it may still be sent over the old SA. A SIP transaction is called pending if it was started using an old SA. When a further SIP message protected with a new inbound SA is successfully received from the P‑CSCF, then the old SAs shall be deleted as soon as either all pending SIP transactions have been completed, or have timed out. The old SAs shall be always deleted when the lifetime is expired. This completes the SA handling procedure for the UE.
A failure in the authentication can occur for several reasons. If the SM1 was not protected, then no protection shall be applied to the failure messages, except the user authentication failure message which shall be protected with the new SA. If SM1 was protected, the old SAs shall be used to protect the failure messages. In both cases, after processing the failure message, the UE shall delete the new SAs.
The UE shall monitor the expiry time of registrations without an authentication and if necessary increase the lifetime of the SAs created by the last successful authentication such that it will expire shortly after the registration timer in the message.
NOTE: In particular this means that the lifetime of a SA is never decreased.
The UE shall delete any SA whose lifetime is exceeded. The UE shall delete all SAs it holds once all the IMPUs are de-registered.
7.4.2 Void
7.4.2a Management of security associations in the P‑CSCF
When the S‑CSCF initiates an authentication by sending a challenge to the UE, the P‑CSCF may already contain existing SAs from previously completed authentications. It may also contain two existing pairs of SAs from an incomplete authentication. These will be referred to as the old and registration SAs respectively. The authentication produces two pairs of new SAs. These new SAs shall not be used to protect non-authentication traffic until noted during the authentication flow. Similarly certain messages in the authentication shall be protected with a particular SA. If the P‑CSCF receives a message protected with the incorrect SA, it shall discard the message.
The P‑CSCF associates the IMPI given in the registration procedure and all the successfully registered IMPUs related to that IMPI to an SA.
A successful authentication proceeds in the following steps:
– The P‑CSCF receives the SM1 message. If SM1 is protected, it shall be protected with the old inbound SA.
– The P‑CSCF forwards the message containing the challenge (SM6) to the UE. This shall be protected with the old outbound SA, if SM1 was protected and unprotected otherwise.
– The P‑CSCF then creates the new SAs, which are derived according to clause 7.1. The expiry time of the new SAs shall be set to allow enough time to complete the registration procedure. The registration SAs shall be deleted if they exist.
– The P‑CSCF receives the message carrying the response (SM7) from the UE. It shall be protected using the new inbound SA. If SM1 was protected, the old SAs are used to protect messages other than those in the authentication.
– The P‑CSCF forwards the successful registration message (SM12) to the UE. It shall be protected using the new outbound SA. This completes the registration procedure for the P‑CSCF. The P‑CSCF sets the expiry time of the new SAs such that they either equals the latest lifetime of the old SAs or it will expire shortly after the registration timer in the message, depending which gives the SAs the longer life.
– After SM12 is sent, the P‑CSCF handles the UE related SAs according to following rules:
– If there are old SAs, but SM1 belonging to the same registration procedure was received unprotected, the P‑CSCF considers error cases happened, and assumes UE does not have those old SAs for use. In this case the P‑CSCF shall remove the old SAs.
– If SM1 belonging to the same registration procedure was protected with an old valid SA, the P‑CSCF keeps this inbound SA and the corresponding three SAs created during the same registration with the UE active, and continues to use them. Any other old SAs are deleted. When the old SAs have only a short time left before expiring or a further SIP message protected with a new inbound SA is successfully received from the UE, the P‑CSCF starts to use the new SAs for outbound messages with the following exception: when a SIP message is part of a pending SIP transaction it may still be sent over the old SA. A SIP transaction is called pending if it was started using an old SA. The old SAs are then deleted as soon as all pending SIP transactions have been completed, or have timed out. The old SAs are always deleted when the old SAs lifetime are expired. When the old SAs expire without a further SIP message protected by the new SAs, the new SAs are taken into use for outbound messages. This completes the SA handling procedure for the P‑CSCF.
A failure in the authentication can occur for several reasons. If the SM1 was not protected, then no protection shall be applied to the failure messages, except the user authentication failure message which shall be protected with the new SAs. If SM1 was protected, the old SAs shall be used to protect the failure messages. In both cases, after processing the failure message, the P‑CSCF shall delete the new SAs.
The P‑CSCF shall monitor the expiry time of registrations without an authentication and if necessary increase the lifetime of SAs created by the last successful authentication such that it will expire shortly after the registration timer in the message.
The P‑CSCF shall delete any SA whose lifetime is exceeded. The P-CSCF shall delete all SAs it holds that are associated with a particular IMPI once all the associated IMPUs are de-registered.
7.5 Rules for security association handling when the UE changes IP address
When a UE changes its IP address, e.g. by using the method described in RFC 8981 [81], then the UE shall delete the existing SA’s and initiate an unprotected registration procedure using the new IP address as the source IP address in the packets carrying the REGISTER messages.