1
|
# Osmocom IMSI Pseudonymization Project
|
2
|
|
3
|
Specification and reference SIM applet implementation to conceal the IMSI of a
|
4
|
mobile subscriber on the radio interface in a 2G, 3G, 4G network.
|
5
|
|
6
|
Homepage: https://osmocom.org/projects/imsi-pseudo/wiki
|
7
|
|
8
|
## How it works
|
9
|
|
10
|
The first pseudo IMSI gets allocated, as the SIM card is provisioned. After
|
11
|
that pseudo IMSI is used for the first time in location update, the HLR decides
|
12
|
the next pseudo IMSI and sends it as SMS to the SIM. The SIM applet overwrites
|
13
|
its current IMSI with the new one, and uses it in the next location update.
|
14
|
Afterwards, the HLR will generate the next IMSI and so on.
|
15
|
|
16
|
**FIXME:** details below need updating, see [OS#4400](https://osmocom.org/issues/4400).
|
17
|
|
18
|
```
|
19
|
HLR <-> SIM LOCATION UPDATE, imsi_pseudo=200
|
20
|
HLR -> SIM NEW PSEUDO IMSI REQ, session_id=1, imsi_pseudo=123
|
21
|
HLR <- SIM NEW PSEUDO IMSI RESP ACK, session_id=1, imsi_pseudo=123
|
22
|
(time passes)
|
23
|
HLR <-> SIM LOCATION UPDATE, imsi_pseudo=123
|
24
|
...
|
25
|
```
|
26
|
|
27
|
## In Detail
|
28
|
|
29
|
1. The HLR has a table of allocated pseudo IMSIs. When provisioning a new SIM,
|
30
|
it randomly decides a new pseudo IMSI. There must be no existing entry in the
|
31
|
table with the same pseudo IMSI in the imsi_pseudo column, but the pseudo IMSI
|
32
|
may be the real IMSI of an existing entry.
|
33
|
|
34
|
| id | imsi | imsi_pseudo | session_id |
|
35
|
|------|--------|---------------|--------------|
|
36
|
| 1 | 100 | 200 | 0 |
|
37
|
|
38
|
(Other interesting fields to store in the table may be a boolean for
|
39
|
"provisioned", the allocation date and usage count. The usage count would
|
40
|
increase whenever the SIM does a successful Location Update with that pseudo
|
41
|
IMSI.)
|
42
|
|
43
|
2. The SIM does a successful Location Update with its current pseudo IMSI.
|
44
|
|
45
|
(Clean up: if the ACK from the SIM card in step 4 did not arrive in a previous
|
46
|
provisioning of a new pseudo IMSI, and the SIM has connected with the newer
|
47
|
pseudo IMSI entry, the old pseudo IMSI entry gets deleted now.)
|
48
|
|
49
|
Then the HLR creates a new entry with a new pseudo IMSI (generated as described
|
50
|
in 1.), and with the session_id increased by one.
|
51
|
|
52
|
| id | imsi | imsi_pseudo | session_id |
|
53
|
|------|--------|---------------|--------------|
|
54
|
| 1 | 100 | 200 | 0 |
|
55
|
| 2 | 100 | 123 | 1 |
|
56
|
|
57
|
The new information is encoded in an SMS and sent to the SIM.
|
58
|
|
59
|
```
|
60
|
HLR -> SIM NEW PSEUDO IMSI REQ, session_id=1, imsi_pseudo=123
|
61
|
```
|
62
|
|
63
|
3. The SIM applet verifies, that the session_id is higher than the last
|
64
|
session_id it has seen (initially: 0). If that is not the case, it discards the
|
65
|
message.
|
66
|
|
67
|
The SIM applet writes the new pseudo IMSI and session_id to the SIM card,
|
68
|
overwriting the old data. It acknowledges the new data with a SMS back to the
|
69
|
HLR:
|
70
|
|
71
|
```
|
72
|
HLR <- SIM NEW PSEUDO IMSI RESP ACK, session_id=1, imsi_pseudo=123
|
73
|
```
|
74
|
|
75
|
4. The HLR verifies, that an entry with the session_id and imsi_pseudo from the
|
76
|
NEW PSEUDO IMSI RESP ACK message exists in the table. If not, it discards the
|
77
|
message.
|
78
|
|
79
|
HLR it deletes the old entry with the same IMSI (in the example: the one with
|
80
|
imsi_pseudo=200).
|
81
|
|
82
|
| id | imsi | imsi_pseudo | session_id |
|
83
|
|------|--------|---------------|--------------|
|
84
|
| 2 | 100 | 123 | 1 |
|
85
|
|
86
|
## Messages getting lost
|
87
|
|
88
|
### What if "NEW PSEUDO IMSI REQ" gets lost?
|
89
|
|
90
|
Both the old and the new pseudo IMSI entry exist in the HLR.
|
91
|
|
92
|
The SIM will use the old pseudo IMSI in the next location update. The HLR will
|
93
|
try to send _the same_ new pseudo IMSI with the same new session_id, as soon
|
94
|
as the next location update is complete.
|
95
|
|
96
|
### What if "NEW PSEUDO IMSI RESP" gets lost?
|
97
|
|
98
|
Both the old and the new pseudo IMSI entry exist in the HLR.
|
99
|
|
100
|
The SIM will use the new pseudo IMSI in the next location update. The HLR will
|
101
|
then clean up the old pseudo IMSI entry, and proceed with generating a new
|
102
|
pseudo IMSI entry and sending it to the SIM, as usually.
|
103
|
|
104
|
## Messages arriving late
|
105
|
|
106
|
### What if "NEW PSEUDO IMSI REQ" arrives late?
|
107
|
|
108
|
The session_id will not be higher than the session_id, which the SIM card
|
109
|
already knows. Therefore, the applet will discard the message.
|
110
|
|
111
|
### What if "NEW PSEUDO IMSI RESP" arrives late?
|
112
|
|
113
|
Session_id and imsi_pseudo from the message will not match what's in the HLR
|
114
|
database, so HLR will discard the message.
|
115
|
|
116
|
## Warning the user if SMS don't arrive
|
117
|
|
118
|
An attacker could possibly block the SMS with NEW PSEUDO IMSI REQ from arriving
|
119
|
at the SIM applet. In that case, the SIM would continue using the old pseudo
|
120
|
IMSI indefinitely.
|
121
|
|
122
|
We could possibly count the location updates done with the same pseudo IMSI in
|
123
|
the SIM applet, and warn the user if the same pseudo IMSI has been used more
|
124
|
than N (e.g. 5) times.
|
125
|
|
126
|
(Could be possible by listening to EVENT_DOWNLOAD_LOCATION_STATUS?)
|
127
|
|
128
|
## End2end encryption
|
129
|
|
130
|
When deploying the IMSI pseudonymization, the operator should make sure that
|
131
|
the pseudo IMSI related SMS between the HLR and the SIM cannot be read or
|
132
|
modified by third parties. Otherwise, the next pseudonymous IMSI is leaked, and
|
133
|
in case of modifying the IMSI in the SMS, the SIM may be locked out of the
|
134
|
network.
|
135
|
|
136
|
OTA SMS are usually encrypted and authenticated (TS 03.48), with algorithms and
|
137
|
key lengths that the operator chooses (depending on the SIM and how it is
|
138
|
configured).
|
139
|
|
140
|
It was considered to add an additional layer of end2end encryption for the
|
141
|
pseudonymized IMSIs on top, but this is out-of-scope for this project. For
|
142
|
reference, once could pre-provision a random "imsi_pseudo_key" with the SIM
|
143
|
card, store it in the pseudo IMSI table in the HLR, and deploy a new encryption
|
144
|
key together with each new pseudo IMSI, attached to the NEW PSEUDO IMSI REQ.
|