Project

General

Profile

Feature #4400

Updated by osmith about 4 years ago

h3. Overview 

 In contrary to previous approaches, the HLR decides the pseudo IMSI 
 independently of the SIM applet. The first pseudo IMSI gets allocated, as the 
 SIM card is provisioned. After that pseudo IMSI is used for the first time, the 
 HLR decides the next pseudo IMSI and sends it as end-to-end encrypted message 
 to the SIM. The SIM applet overwrites its current IMSI with the new one, and 
 uses it in the next location update. Afterwards, the HLR will generate the next 
 IMSI and so on. 

 h3. Full session 

 <pre> 
 2. HLR    -> SIM    NEW PSEUDO IMSI REQ, session_id=1, imsi_pseudo=123 imsi_pseudo=123, imsi_pseudo_key=(random blob 2) 
 3. HLR <-    SIM    NEW PSEUDO IMSI RESP ACK, session_id=1, imsi_pseudo=123 
 </pre> 

 h3. In Detail 

 1. The HLR has a table of allocated pseudo IMSIs. When provisioning a new SIM, 
 it randomly decides a new pseudo IMSI. IMSI and pseudo IMSI key. There must be no 
 existing entry in the 
 table with the same pseudo IMSI in the imsi_pseudo 
 column, but the pseudo IMSI 
 may be the real IMSI of an existing entry. The 
 pseudo IMSI key is randomly chosen and used for end2end encrypted SMS between 
 the HLR and the SIM applet. The pseudo IMSI key changes whenever the pseudo 
 IMSI changes. 

 |_. id |_. imsi |_. imsi_pseudo |_. imsi_pseudo_key |_. session_id | 
 |      1 |     100    |     200           |    (random blob)      | 0              | 

 (Other interesting fields to store in the table may be a boolean for 
 "provisioned", the allocation date and usage count. The usage count would 
 increase whenever the SIM does a successful Location Update with that pseudo 
 IMSI.) 

 2. The SIM does a successful Location Update with its current pseudo IMSI. 

 (Clean up: if the ACK from the SIM card in step 4 did not arrive in a previous 
  provisioning of a new pseudo IMSI, and the SIM has connected with the newer 
  pseudo IMSI entry, the old pseudo IMSI entry gets deleted now.) 

 Then the HLR creates a new entry with a new pseudo IMSI (generated and imsi_pseudo_key 
 (both generated as described 
 in 1.), and with the session_id increased by one. 

 |_. id |_. imsi |_. imsi_pseudo |_. imsi_pseudo_key |_. session_id | 
 |      1 |     100    |     200           |    (random blob)      | 0              | 
 |      2 |     100    |     123           |    (random blob 2)    | 1              | 

 The new information is encoded in an SMS and sent to the SIM. SIM, encrypted with 
 the previous imsi_pseudo_key. 

 <pre> 
 HLR    -> SIM    NEW PSEUDO IMSI REQ, session_id=1, imsi_pseudo=123 imsi_pseudo=123, imsi_pseudo_key=(random blob 2) 
 </pre> 

 3. The SIM applet verifies, that the session_id is higher than the last 
 session_id it has seen (initially: 0). If that is not the case, it discards the 
 message. 

 The SIM applet writes the new pseudo IMSI, new pseudo IMSI key and session_id 
 to the SIM card, 
 overwriting the old data. It acknowledges the new data with a 
 SMS back to the 
 HLR: HLR, which is encrypted with the *new* imsi_pseudo_key: 

 <pre> 
 HLR <-    SIM    NEW PSEUDO IMSI RESP ACK, session_id=1, imsi_pseudo=123 
 </pre> 

 4. The HLR verifies, that an entry with the session_id and imsi_pseudo from the 
 NEW PSEUDO IMSI RESP ACK message exists in the table. If not, it discards the 
 message. 

 HLR it deletes the old entry with the same IMSI (in the example: the one with 
 imsi_pseudo=200). 

 |_. id |_. imsi |_. imsi_pseudo |_. imsi_pseudo_key |_. session_id | 
 |      2 |     100    |     123           |    (random blob 2)    | 1              | 

 h3. Messages getting lost 

 h5. What if "NEW PSEUDO IMSI REQ" gets lost? 

 Both the old and the new pseudo IMSI entry exist in the HLR. 

 The SIM will use the old pseudo IMSI in the next location update. The HLR will 
 try to send _the same_ new pseudo IMSI with the same new session_id, as soon 
 as the next location update is complete. 

 h5. What if "NEW PSEUDO IMSI RESP" gets lost? 

 Both the old and the new pseudo IMSI entry exist in the HLR. 

 The SIM will use the new pseudo IMSI in the next location update. The HLR will 
 then clean up the old pseudo IMSI entry, and proceed with generating a new 
 pseudo IMSI entry and sending it to the SIM, as usually. 

 h3. Messages arriving late 

 h5. What if "NEW PSEUDO IMSI REQ" arrives late? 

 The session_id will not be higher than the session_id, which the SIM card 
 already knows. Therefore, the applet will discard the message. 

 h5. What if "NEW PSEUDO IMSI RESP" arrives late? 

 Session_id and imsi_pseudo from the message will not match what's in the HLR 
 database, so HLR will discard the message. 

 h3. Warning the user if SMS don't arrive 

 An attacker could possibly block the SMS with NEW PSEUDO IMSI REQ from arriving 
 at the SIM applet. In that case, the SIM would continue using the old pseudo 
 IMSI indefinitely. 

 We could possibly count the location updates done with the same pseudo IMSI in 
 the SIM applet, and warn the user if the same pseudo IMSI has been used more 
 than N (e.g. 5) times. 

 (Could be possible by listening to EVENT_DOWNLOAD_LOCATION_STATUS?) 

 h3. End2end encryption 

 When deploying the IMSI pseudonymization, the operator should make sure that 
 the pseudo IMSI related SMS between the HLR and the SIM cannot I need to research more about what can be read or 
 modified by third parties. Otherwise, the next pseudonymous IMSI is leaked, and 
 done in case of modifying the IMSI in the SMS, the SIM may be locked out of the 
 network. 

 OTA SMS are usually encrypted and authenticated (TS 03.48), with algorithms and 
 key lengths that the operator chooses (depending on the SIM and how it is 
 configured). 

 It was considered to add an additional layer of end2end encryption for the 
 pseudonymized IMSIs on top, smartcards, but this is out-of-scope for this project. For if we could 
 reference, once could pre-provision a random "imsi_pseudo_key" do something like AES with the SIM 
 card, store it in java smartcards, the pseudo IMSI table in the HLR, and deploy a new encryption 
 key together with each new pseudo IMSI, attached to the NEW PSEUDO IMSI REQ. approach above should work. 

 h3. Advantages over previous approaches 

 * The range of available IMSIs, and the algorithm for determining IMSIs, can be 
   changed without provisioning new SIM cards 
 * Guaranteed that there are no collisions, since the SIM doesn't need to 
   reproduce the IMSI with a counter value. The HLR determines the IMSI 
   independently and sends it as a whole to the SIM. 
 * SMS arriving late is not an issue 


 CC: @laforge, @neels

Back

Add picture from clipboard (Maximum size: 48.8 MB)