Cur Suri
Cur Suri
Cur Suri
Introduction
Lecture 1
Security and Applied Logic Master
Adela Georgescu
Facultatea de Matematica – Informatica
Universitatea Bucuresti
Logistics
• People
Course
Adela Georgescu
[email protected]
[email protected]
Lab
Adela Georgescu
Logistics
1. Lectures
» 2h course weekly – Tuesday 8.10 - 10
» 2h lab/every 2 weeks – Tuesday 10-12
2. Grading
Ø 1,5 p lab
Ø 1,5 p lab project
Ø 2p course project
Ø 5p exam
Ø +1p bonus – for activity during lectures
3. Passing criteria
Ø ≥ 4.5p at the *inal exam
Ø ≥ 4.5p in total
• Criptographic
üKerkoff (open design): secret key, public algorithms
and design
• Other principles
• Principle of simplicity: keep it simple
• Other principles
• Principle of minimal trust: minimize the number of
trusted entities
Adela Georgescu*
Faculty of Mathematics and Computer Science
University of Bucharest
2. Why?
2/13
About
Others
Ethical
aspects!
3/13
IEEE 802.11 Wireless LAN / Wi-Fi
Cryptography
Security
Requirements
Security
Principles
Security
Architecture
Vulnerabilities
Attacks
4/13
Mobile networks
Cryptography
Security
Requirements
Security
Principles
Security
Architecture
Vulnerabilities
Attacks
5/13
Motivation ITU: Measuring the Information Society Report 2018
https://www.itu.int/en/ITU-D/Statistics/Pages/publications/misr2018.aspx
https://www.itu.int/en/ITU-D/Statistics/Documents/publications/misr2018/MISR-2018-Vol-1-E.pdf
7/13
Motivation
https://www.itu.int/en/ITU-D/Statistics/Pages/publications/misr2018.aspx
https://www.itu.int/en/ITU-D/Statistics/Documents/publications/misr2018/MISR-2018-Vol-2-E.pdf
8/13
Motivation
HACKERS REMOTELY KILL A JEEP ON THE HIGHWAY—WITH ME IN IT
https://www.wired.com/2015/07/hackers-remotely-kill-jeep-highway/
9/13
Motivation
10/13
Motivation
http://ruxandraolimid.weebly.com/uploads/2/0/1/0/20109229/final_lte.pdf
11/13
Motivation
https://www.krackattacks.com/
Video: https://youtu.be/Oh4WURZoR98
Paper: https://papers.mathyvanhoef.com/ccs2017.pdf
12/13
Why is wireless security different?
• In practice:
13/13
Network Security
- Lecture 2.2 -
IEEE 802.11 Wireless LAN / Wi-Fi Intro
Adela Georgescu*
Faculty of Mathematics and Computer Science
University of Bucharest
2/11
About
3/11
WiFi evolution
[Source: https://www.wi-fi.org/who-we-are/history ]
4/11
IEEE 802.11 Wireless LAN - Arhitecture
5/11
IEEE 802.11 Wireless LAN - Arhitecture
• STA (Stations):
• Laptops, Tablets, Smartphones…
• AP (Access Point):
• A device that acts as a communication hub
6/11
IEEE 802.11 Wireless LAN vs. OSI
[Source: https://technet.microsoft.com/pt-pt/library/cc757419(v=ws.10).aspx ]
Defines in OSI :
• Physical layer
• Media Access Control (MAC) sublayer of Data Link layer (data is
grouped in frames, error detection – FCS/CRC)
7/11
IEEE 802.11 MAC Frame Format
[Source: https://technet.microsoft.com/pt-pt/library/cc757419(v=ws.10).aspx ]
8/11
IEEE 802.11 MAC Frame Format
• Frame control: frame type (control - indicates start/stop/retransmit, management -
negotiation between AP and STA, or data), control information
• Duration/connection ID: channel allocation time
• Addresses: source, destination and AP MAC addresses
• Sequence control: numbering and reassembly
• Frame body: MAC Service Data Unit (MSDU) or fragment of MSDU, data
• Frame Check Sequence (FCS): 32-bit Cyclic Redundancy Check (CRC)
Security
Principles
Security
Architecture
Vulnerabilities
Attacks
10/11
IEEE 802.11 Security
• By default OFF
Improved security
11/11
Network Security
- Lecture 2.3 -
Wired Equivalent Privacy (WEP)
Adela Georgescu*
Faculty of Mathematics and Computer Science
University of Bucharest
1. Protocol description
3. Lessons to learn
2/19
IEEE 802.11 Security
• By default OFF
3/19
Wired Equivalent Privacy (WEP)
[Source: https://wigle.net/stats ]
4/19
Security goals
• Data confidentiality:
• Ensures protection against eavesdropping (on the radio channel)
• Data integrity:
• Protects against message insertion and modification
• Others:
• Exportable
• Hardware and software efficient
5/19
How WEP works?
6/19
Design idea
• Key management:
• A single key for all devices in a BSS
• Export: 40-bit keys
• Data confidentiality:
• Encryption of data frames transmitted over the wireless
communication medium using the cryptographic key
• Data integrity:
• Use of Cyclic Redundancy Check (CRC)
7/19
WEP authentication
STA AP
• Auth Challenge:
• AP sends a random challenge on 128 bits
• Auth Response:
• The STA encrypts the challenge with the secret key using
WEP and sends the encrypted text to the AP
• Auth Success:
• AP decrypts and compares the plaintext with the challenge; if
they are equal, authentication is successful
8/19
WEP Encryption (in theory)
M CRC(M)
IV || K RC4 keystream
=
IV C
9/19
WEP Encryption (in practice)
[Source: https://technet.microsoft.com/pt-pt/library/cc757419(v=ws.10).aspx ]
10/19
Security issues?
11/19
Problem 1 - Authentication
Question: What can the adversary learn through a passive attack?
𝑐 ⨁𝑚 = 𝑚⨁𝑘𝑒𝑦𝑠𝑡𝑟𝑒𝑎𝑚⨁𝑚 = 𝑘𝑒𝑦𝑠𝑡𝑟𝑒𝑎𝑚
12/19
Problem 1 - Authentication
Question: Is this mutual authentication?
13/19
Problem 2 - Linearity
Question: If there is no CRC, can the adversary change certain bits in
the clear message as desired?
Answer: Yes!
• intercept c; change c to 𝑐′ = 𝑐⨁𝑚′ and send c’ instead of c
• at destination:
CRC is linear: for any m1, m2, CRC(m1 ⨁ m2) = CRC(m1) ⨁ F(m2)
This allows an adversary to modify the ciphertext (by xor-ing with some
desired value) and, due to linearity, modify the CRC accordingly
16/19
Recovering the key
• …
[Video: https://www.youtube.com/watch?v=JDG9ZAmfIBs ]
17/19
Design WEP…
• Open standard
18/19
Lessons to learn…
• Difficult to design a secure protocol
19/19
Network Security
- Lecture 3 -
Wi-Fi Protected Access (WPA)
Adela Georgescu*
Faculty of Mathematics and Computer Science
University of Bucharest
1. Improvements on WEP
2. Description
2/15
IEEE 802.11 Security
• By default OFF
• WPA3
3/15
Wi-Fi Protected Access (WPA)
• Wi-Fi industry fix of Wi-Fi Alliance (802.11i-draft) – easy to
adopt solution
[Source: https://wigle.net/stats ]
4/15
Recall WEP
• No confidentiality:
• short IV ⇒ reuse of keystream RC4
• Key recovery (< 60 seconds)
• No integrity:
• CRC is not a MAC!
5/15
Improvements on WEP
• Encryption:
• TKIP to improve WEP encryption (e.g., a new key for every
packet/frame)
• Posibility to use AES (optional, not all the devices could handle AES)
• Integrity:
• Michael, a new algorithm
• Authentication:
• 802.1X (initially defined for Ethernet networks, later adopted for
802.11 WLAN)
• 802.11 - optional 802.1X authentication, WPA – mandatory 802.1X
authentication
6/15
TKIP
(Temporary Key Integrity Protocol)
TKIP (Temporary Key Integrity Protocol)
Base key
Transmitter Key RC4 key
MAC Address Mixing
Packet seq.
/counter (48 bits) WEP ciphertext
MIC key
Transmitter MIC
MAC Address Michael ||
Receiver
MAC Address
plaintext
8/15
TKIP for transmission
9/7
TKIP for reception
10/7
Michael MIC key
Transmitter
Michael MIC (8 bytes)
MAC Address
Receiver
MAC Address
plaintext
• MIC key: 64 bits
• Output: 64 bits (8 bytes)
(per session)
(bytes)
(bytes)
12/15
TKIP (Temporary Key Integrity Protocol)
• Temporary keys:
• 2 mixing stages
• Equipment dependent, via transmitter MAC address
• Dependent on packet sequence (48 bits, not 24 as IV had in WEP)
• Goal:
• Avoid keystream reuse (keys become temporary) / collision attacks are
avoided
• Avoid packet retransmission on IV reuse (possible space now becomes 248) /
replay attacks
13/15
TKIP (Temporary Key Integrity Protocol) – key
mixing
14/7
TKIP (Temporary Key Integrity Protocol) – key
generation
• Pairwise keys – communication between STA and AP
• Group keys – for broadcast messages
15/7
TKIP (Temporary Key Integrity Protocol) – key
generation
16/15
TKIP (Temporary Key Integrity Protocol) – 4-way
handshake
[Source: https://www.wifi-professionals.com/2019/01/4-way-handshake]
17/7
TKIP Pairwise Key Hierarchy
18/15
TKIP Key Hierarchy
𝑃𝑇𝐾 = 𝑓(𝑃𝑀𝐾, 𝑁𝑜𝑛𝑐𝑒𝐴𝑃, 𝑁𝑜𝑛𝑐𝑒𝑆𝑇𝐴, 𝑀𝐴𝐶𝐴𝑃 , 𝑀𝐴𝐶𝑆𝑇𝐴) 𝐺𝑇𝐾 = 𝑓(𝐺𝑀𝐾, 𝑁𝑜𝑛𝑐𝑒𝐴𝑃, 𝑀𝐴𝐶𝐴𝑃 )
19/15
*Group Key Hierarchy: folosit la broadcast communication
WPA design
20/15
Network Security
- Lecture 4.1 -
802.1X & EAPOL
Adela Georgescu*
Faculty of Mathematics and Computer Science
University of Bucharest
1. 802.1X architecture
2. EAPOL authentication
2/8
802.1X
• Standard initially defined for Ethernet networks, later on adopted for
802.11 WLAN
3/8
[Source: https://technet.microsoft.com/pt-pt/library/cc757419(v=ws.10).aspx ]
IEEE 802.1X architecture
• Supplicant:
• An entity who requests the services
(wants to join the network); e.g.: a laptop
• Authenticator:
• An entity who controls access before
granting access to services; e.g.: an AP
• Authentication Server:
• Makes authorization decisions e.g.:
sometimes inside AP but more often
through RADIUS (Remote
Authentication Dial-In User Service)
4/8
5/8
6/8
EAPOL Encapsulation
[Source: https://en.wikipedia.org/wiki/IEEE_802.1X ]
• Defines:
– A set of functionalities common across authentication servers
– A protocol that allows accesing these functionalities
• Specified by IETF
• Challenge-response mechanism
8/8
Network Security
- Lecture 4.2 -
IEEE 802.11i RSN / WPA2
Adela Georgescu*
Faculty of Mathematics and Computer Science
University of Bucharest
3
IEEE 802.11 Security
• By default OFF
• WPA3
4/15
Wi-Fi Protected Access II (WPA2)
• Introduced by the Wi-Fi Alliance in 2004 as a long-term solution
to replace WEP
• Known as 802.11i
[Source: https://wigle.net/stats ]
5/15
Robust Security Network (RSN)
RSN: a protocol for establishing a secure communication over 802.11 wireless networks
RSN Information Element (IE): data structure for advertising and negotiating security
capabilities
Advertise WLAN
security policy
If the cryptosystems
are broken, easily
change to new ones!
RSN IE
• Reply detection
Packet Number (PN), replay counter
• Access control
8
Security Goals Tries to address all known WEP Problems
9
CCM Mode
• Authenticated encryption (with associated data) combining CTR
mode and CBC-MAC:
• appends a CBC-MAC on the header, length of the header and plaintext
• encrypts in CTR mode (plaintext blocks with 1,2,3… and MIC with counter
value 0)
• Uses a single crypto key (temporal key shared by STA and AP) and
assumes 128-bit blocks
10
CCM Mode
1) Unencrypted MPDU; MAC
header contains source and
destination addresses;
2) CCMP header (32 bits) is
constructed
3) MIC is computed to protect
fields from the MAC header,
the CCMP header and the
data
4) Data and MIC are encrypted;
CCMP header is pre-
appended
5) MAC header is pre-appended
[Source: Course book, Edney &Arbaugh, Chapter 12]
11
CCMP MPDU Format
12
CCM Mode
1) Unencrypted MPDU; MAC
header contains source and
destination addresses;
2) CCMP header (32 bits) is
constructed
3) MIC is computed to protect
fields from the MAC header,
the CCMP header and the
data
4) Data and MIC are encrypted;
CCMP header is pre-
appended
5) MAC header is pre-appended
[Source: Course book, Edney &Arbaugh, Chapter 12]
13
CCMP Header
Purposes:
• Provides the Packet Number (PN) that provides replay protection and gives to the receiver
the nonce required for decryption
• In case of multicast, it gives to the receiver the group key used for encryption
14
CCM Mode
1) Unencrypted MPDU; MAC
header contains source and
destination addresses;
2) CCMP header (32 bits) is
constructed
3) MIC is computed to protect
fields from the MAC header,
the CCMP header and the
data
4) Data and MIC are encrypted;
CCMP header is pre-
appended
5) MAC header is pre-appended
[Source: Course book, Edney &Arbaugh, Chapter 12]
15
MIC Computation
• Uses CBC-MAC, with a starting block – see CCMP Encapsulation slide
• 64-bit (8 bytes) MIC, so last 64 bits are discarded
16
CCM Mode
1) Unencrypted MPDU; MAC
header contains source and
destination addresses;
2) CCMP header (32 bits) is
constructed
3) MIC is computed to protect
fields from the MAC header,
the CCMP header and the
data
4) Data and MIC are encrypted;
CCMP header is pre-
appended
5) MAC header is pre-appended
[Source: Course book, Edney &Arbaugh, Chapter 12]
17
Encryption
• Uses CTR-AES
18
CCMP Encapsulation
CBC-MAC
CTR-AES
Group
TKIP CCMP 20
Pairwise CCMP Key Hierarchy
• Pairwise Transient Key (PTK): [Source: Course book, Edney &Arbaugh, Chapter 10]
PTK ← KDF(PMK, min 𝐴𝑑𝑑𝑟!" , 𝐴𝑑𝑑𝑟#$! || max 𝐴𝑑𝑑𝑟!" , 𝐴𝑑𝑑𝑟#$! , max{𝑁!" , 𝑁#$! }))
23
4-Way Handshake protocol
EAPOL MICKey
(KCK)
• No forward secrecy
• PMK + MACs + Nonces enough to derive PTK
• Can decrypt old recorded communication sessions
25
Group Key Generation and Distribution
https://theory.stanford.edu/~jcm/papers/NDSS05.pdf ]
RSN IE: RSN Identification
Element (set of capabilities)
AA: Authenticator Address
SA: Supplicant Address
ANonce: nonce generated by
the Authenticator (AP)
SNonce: nonce generated by
the Supplicant (STA)
27
[Source: He and Mitchell Security Analysis and Improvements for IEEE 802.11i
RSN/WPA2
Association Overview
https://theory.stanford.edu/~jcm/papers/NDSS05.pdf ]
RSN IE: RSN Identification
Element (set of capabilities)
AA: Authenticator Address
SA: Supplicant Address
ANonce: nonce generated by
the Authenticator (AP)
SNonce: nonce generated by
the Supplicant (STA)
28
RSN/WPA2
Association Overview
Both parties
prove to know the
same MSK
29
[Source: He and Mitchell Security Analysis and Improvements for IEEE 802.11i
RSN/WPA2
Association Overview
https://theory.stanford.edu/~jcm/papers/NDSS05.pdf ]
RSN IE: RSN Identification
Element (set of capabilities)
AA: Authenticator Address
SA: Supplicant Address
ANonce: nonce generated by
the Authenticator (AP)
SNonce: nonce generated by
the Supplicant (STA)
30
Security / Attacks
• CCM Mode: theoretical security proof
[Jonsson, J. (2003, January). On the security of CTR+ CBC-MAC. In SelectedAreas in Cryptography(pp. 76-93). Springer Berlin Heidelberg]
https://www.krackattacks.com/
Paper: https://papers.mathyvanhoef.com/ccs2017.pdf
Video: https://youtu.be/Oh4WURZoR98
31
WPA2
• We will look into WPA3 next time
32
Network Security
- Lecture 5 -
WPA3
Adela Georgescu*
Faculty of Mathematics and Computer Science
University of Bucharest
2
WPA2-PSK: Problem 1 – Scalability, Dynamicity
• The same value PSK (=PMK) for all entities in WLAN
• Answer:
https://theory.stanford.edu/~jcm/papers/NDSS05.pdf
• Hint:
]
WPA2-PSK: Problem 3 - Outsider Attack
password password
{pwd}
Client Access point Server
Authentication
Key transport
4WHS
https://theory.stanford.edu/~jcm/papers/NDSS05.pdf ]
Authentication
Key transport
Authentication
10
The Dragonfly Handshake
• Is a Password Authenticated Key Exchange (PAKE)
• Starts with a password and generates a higher entropy key
• Supports Elliptic Curve Cryptography (ECC)
• Has 2 phases:
• Commit
• Confirm
11
WPA3 – SAE
Handshake
[Source: Vanhoef, M. and Ronen, E., 2020,
May. Dragonblood: Analyzing the Dragonfly
Handshake of WPA3 and EAP-pwd. In 2020
IEEE Symposium on Security and Privacy
(SP) (pp. 517-533). IEEE.]
P: Password
k: the final / negotiated key
(k is further used in the 4WH, as
in WPA2; i.e. k is like the PMK)
12
WPA3 – Security
against a
dictionary attack
[Source: Vanhoef, M. and Ronen, E., 2020,
May. Dragonblood: Analyzing the Dragonfly
Handshake of WPA3 and EAP-pwd. In 2020
IEEE Symposium on Security and Privacy
(SP) (pp. 517-533). IEEE.]
P: Password
k: the final / negotiated key
13
Backward compatibility
• Scenario: both WPA2 and WPA3 are supported, and the same
password is used
• WPA3 has some detection of downgrade to WPA2 (at changing the AP
capabilities in the RSN IE), but this does not help (until detection, a
handshake capture already makes the password vulnerable to a
dictionary attack in WPA2).
[Source: Vanhoef, M. and Ronen, E., 2020, May. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE
Symposium on Security and Privacy (SP) (pp. 517-533). IEEE.]
14
Other problems
• DoS: spoof commit frames to the AP (the AP will have to do too many
verifications)
• Timing attacks, side-channels attacks (mostly caused by how the pre-
shared password is encoded into a group element in the Dragonfly
handshake)
[Source: Vanhoef, M. and Ronen, E., 2020, May. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE
Symposium on Security and Privacy (SP) (pp. 517-533). IEEE.]
15
16
https://wpa3.mathyvanhoef.com/
Dragonblood (2020)
WiFi Networks
• We have now finished studying WiFi security
17
Network Security
- Lecture 6 -
TLS
Adela Georgescu
Faculty of Mathematics and Computer Science
University of Bucharest
Outline
1. Security levels
2. TLS
2/8
Security levels
TLS
IEEE 802.11
TLS
• First versions: SSL – Netscape (1995) – SSL 3.0 most well-known
• TLS 1.0 – 1999; TLS 1.1 – 2006; TLS 1.2 – 2008; TLS 1.3 - 2018
4/7
[Source: https://www.ssllabs.com/ssl-pulse/]
TLS
• Provides authentication, encryption and data compression
• 2 layers: handshake protocol and record protocol
[Source: https://www.thesslstore.com/blog/tls-1-3-handshake-tls-1-2/]
6/7
TLS 1.3 handshake
7/7
TLS 1.3 handshake
• Supported ciphersuites
• TLS_AES_128_GCM_SHA256
• TLS AES 256 GCM SHA384
• TLS CHACHA20 POLY1305 SHA256
• TLS AES 128 CCM SHA256
• TLS AES 128 CCM 8 SHA256
• Transcript – all messaged sent in the protocol until the current
moment
8/7
EAP-TLS
Adela Georgescu
Faculty of Mathematics and Computer Science
University of Bucharest
2
Evolution
• User device
• Access network
• Radio link
• Core network
5
GSM - Architecture
MS: Mobile Station BSS: Base Station Subsystem NSS: Network Subsystem
ME: Mobile Equipment BTS: Base Transceiver Station MSC: Mobile Services Switching Center
SIM: Subscriber Identity Module BSC: Base Station Controller HLR: Home Location Register
VLR: Visitor Location Register
EIR: Equipment Identity Register
PSTN: Public Switched Telephone Network AuC: Authentication Center 6
GSM - Arhitecture
• MS (Mobile Station):
• Consists in a Mobile Equipment (ME) and the Subscriber’s Identity Module (SIM)
• BSS (Base Station Subsystem):
• Consists in several BTSs and BSCs
• The BSC is a central element that controls the radio network, maintaining radio
connectivity with several BTSs and providing connection to the NSS
• BTS is the element to which the MS connects to in the GSM network via radio link; its
functions include signal processing, signaling, ciphering
• NSS (Network SubSystem):
• MSC is the main element of the NSS with respect to call functions, being responsible for
call control, BSS control, and interconnecting to the external networks (PSTN)
7
GSM - Arhitecture
• VLR (Visitor Location Register):
• Stores information about subscribers that are served by the MSC (it maintains copies of
the data from HLR, increasing efficiency: decreases the number of messages that are
exchanged between the MSC and the HLR)
• Usually is not independent hardware, but a software component of the MSC
• HLR (Home Location Register):
• It is the main database in GSM
• Maintains information for each subscriber: IMSI, phone no. - MSISDN (Mobile Station
International Subscriber Directory Number), available services for the subscriber,
location, etc.
• AuC (Authentication Center):
• For each subscriber, stores the permanent key Ki that is also stored in the SIM
• Generates the authentication vectors (RAND, SRES, KC) in the authentication phase
8
GSM - Arhitecture
• EIR (Equipment Identity Register):
• Keeps inventory of the devices in the mobile network, which are identified by their IMEI
9
GSM – Security Principles
Goal: GSM should be as secure as the wired network (PSTN) …
…but, security mechanisms should not have a negative impact on the
usability of the system
• Security requirements in GSM:
• Access control to the MS: provide authenticated user access to the mobile station
• Anonymity of subscribers (privacy): keep the identity of the subscribers (and their location, possibility of
linking calls, etc.) hidden to external parties
• Authentication of subscribers: subscribers must prove their identity and their right to access mobile services
10
GSM – Security Principles
Weaknesses in GSM security:
11
Mobile Equipment (ME)
• Identification:
• IMEI (International Mobile Equipment Identity), a number
used to identify the mobile phone; it is printed on the
device, and it can be displayed by dialing *#06#
• IMEISV (IMEI Software Version) discards the check digit
from the IMEI and adds 2 digits SVN (Software Version
Number)
• Access control:
• IMEI can be used to deny connectivity to the network for stolen phones based
on a blacklist stored by the operator
• Biometric authentication; e.g.: fingerprint recognition, voice recognition
• Screen unlock mechanisms; e.g.: codes, patterns
12
SIM Card
• Identification:
• IMSI (International Mobile Subscriber Identity), a global unique identifier for
the subscriber (≅15 digits)
• ICCID (Integrated Circuit Card ID) it is the identifier of the SIM itself and
printed on the SIM card
• Access control:
• PIN (Personal Identification Number), a sequence of numbers required to unlock the SIM card
• PUK (Personal Unlocking Key), a code required when the PIN has been introduced incorrectly
several times
IMSI (International Mobile Subscriber Identity)
MCC MNC MSIN
(Mobile Country Code) (Mobile Network Code) (Mobile Subscriber Identification Number)
- 3 digits - - 2 digits (EU) / 3 digits (US) -
242 (Norway) 01 (Telenor) / 02 (Telia) XXXXXXXXXX
226 (Romania) 01 (Vodafone) / 10 (Orange) XXXXXXXXXX
SIM cards must be tamper-resistant (i.e. an adversary should not be able to read / modify the
security information stored on the SIM card). Otherwise, SIM cards become vulnerable to cloning
attacks, for which the attacker creates copies of the SIM card to use in different purposes
(eavesdropping on the victim, making calls on the victim behalf, etc.)
*Terminology: Initially, the card itself was also called a SIM, later the card itself was called UICC
(Universal Integrated Circuit Card) and the SIM was considered the application running on the card
14
Anonymity of Subscribers
• Goal: Keep the identity (presence/absence in an area, location, etc.) of the subscriber private
to unauthorized parties
• Principles:
• Introduce the TMSI as a way to avoid IMSI exposure on the radio interface
• e.g.: IMSI uniquely identifies a subscriber, and if it intercepted it suffice to prove the
presence of the subscriber in a location
• TMSI is assigned to the MS when authenticates to the network, and it is local in the
visiting network (VLR keeps the IMSI – TMSI correspondence); the MS stores the TMSI
in the SIM to use it even after rebooting
• TMSI must be renewed at specific intervals (tradeoff with efficiency); a TMSI that is not
changed often enough can break privacy too
15
Authentication of Subscribers
• Goal: Prove the identity of the subscriber to the mobile network, and avoid unauthorized
parties to access the mobile services
• Principles:
• Ki does never leave the 2 locations (SIM, AuC);
• Authentication consists in checking if the subscriber knows the correct key Ki by
using a challenge-response mechanism
• The serving network does not have access to the key Ki, so it cannot perform
authentication without help from the home network
• During authentication phase, is derived a key Kc that will be later used for encryption
16
Authentication of Subscribers
Kc = A8(Ki, RAND)
SRES / XRES = A3(Ki, RAND)
17
Authentication Triplets
• Goal: Allow the visiting network to authenticate the MS without knowing Ki and improve
efficiency by using batches of triplets
• Operation:
• AuC produces batches of triplets for each MS, each with a different RAND and sends
them to the HLR
• For a single request, the VLR receives a batch of triplets from the HLR (to avoid often
communication between the VLR and the HLR)
• If the network runs out of triplets, it should request more from the HLR, but if not it is
allowed to reuse triples
18
Encryption
• Goal: Encrypt all communication between the mobile station and the BTS (both phone calls
and sensitive signaling information such as TMSI, MSISDN, etc.)
19
Encryption
• Both A5/1 and A5/2 were not public, breaking Kerckhoffs’ principle
• Encryption operates at the physical layer (Layer 1), which brings some advantages:
• Maximum amount of data is encrypted (both user and signaling data)
• The encryption algorithm can be implemented in hardware
• A frame counter (22 bits) is used as an additional input together with the key Kc
• Vulnerability! The frame counter repeats every 222 frames (approx. every 3.5 hours), so the
key stream repeats if the Kc is not renewed meanwhile
• GSM is full duplex: for each frame, first 114-bit block (Block1) is used for encryption of data
that is being transmitted, and the second 114-bit block (Block2) is used for decryption of
data that is being received
20
Encryption
21
Overview
22
Overview
23
Crypto
Key Length / Input + Output Info
Ki 128 bits Key shared between the subscriber and the network
operator, stored in the SIM and AuC
Kc 54/64 bits Secret session key, that will be used for encryption
Kc = A8(Ki, RAND)
RAND 128 bits Random challenge
SRES / XRES 32 bits Response to the challenge request / Expected
(Signed Response / Expected response to the challenge request
Response) SRES / XRES = A3(Ki, RAND)
A3, resp. A8 Input: Ki, RAND Generic algorithms for authentication, resp. key
Output: SRES, resp. Kc generation (no specific algorithms)
e.g.: COMP128 combines A3 and A5 and generates
XRES (32 bits) and Kc (54 random bits concatenated to
10 bits of 0)
Stored in the SIM
A5 Input: Kc, plaintext Class of standardized encryption algorithms:
Output: ciphertext A5/0 (no encryption), A5/1 (CEPT + USA), A5/2 (Asia),
A5/3 (Kasumi, UMTS)
Stored in the mobile equipment (not SIM!)
24
Network Security
- Lecture 8 -
Mobile Security
GSM II
Adela Georgescu
Faculty of Mathematics and Computer Science
University of Bucharest
• Modularity:
• GSM is modular in the sense that the cryptographic algorithms can be replaced
with others, as long as maintain the same input-output structure
• A5 refers to a family of algorithms; e.g.: A5/1, A5/2, A5/3 (64 bits key Kc); A5/0
(no encryption), A5/4 (128 bits key Kc) – some used for UMTS (e.g.: A5/3)
• Standardization:
• A5 must be standardized (e.g.: MS must communicate to BTS in roaming)
• A3, A8 must not necessary be standardized, because both parties involved (the
SIM and the AuC) belong to the same network operator; however, 3GPP gave
an example algorithm set TS55.205
• Algorithms’ requirements:
• Statistically impossible to guess SRES
• Statistically impossible to find Ki, Kc from the eavesdropped data
• … (assumptions that exclude trivial attacks)
3
Vulnerabilities and Attacks
• Passive attacks:
• The adversary eavesdrops on the radio link and gets the IMSI
• The attack is possible because the IMSI is sent in clear over the radio link when the
MS posses no TMSI or it cannot be identified by using the TMSI
• Active attacks:
• The adversary requests the IMSI from the MS
• IMSI Catcher: the adversary masquerades a legitimate BTS and asks the MS for the
IMSI
• The attack is possible because the MS does not authenticate the network - and cell
reselection criteria is signal strength
• We will learn more on IMSI Catchers when we will study LTE
4
Vulnerabilities and Attacks
• Cryptanalysis:
• Key length
• the key length of Kc (54/64 bits) is too small to provide security
• Exhaustive search (brute force) can break the key in a few hours
• COMP128 was cracked in 1998 (by Wagner and Goldberg, but apparently known
before by some operators)
• Chosen plaintext attack: Ki is found when about 160 000 pairs RAND-SRES are
collected
• Possible ways to collect RAND-SRES pairs:
• Steal the SIM and connect to a phone emulator (2 to 10 hours, dependent on
the phone)
• Use a false BTS (longer in time, but does not require physical access to the
SIM)
5
Vulnerabilities and Attacks
• Cryptanalysis:
• A5/1 was broken in 1999 (by Biryukov, Shamir, later the attack was improved together
with Wagner)
• Time-memory trade-off:
• Pre-processing phase: Compute a large database of states and related keys
of the stream system
• Attack phase: search subsequences of the key stream in the database; if a
match is found, the state is the one in the database (with high probability)
• 2s of known plaintext (both uplink and downlink) to succeed
• A5/2 was cryptanalysed in 1999 (Goldberg, Wagner, Green), 2003 (Barkan, Biham,
Keller), etc.
6
Vulnerabilities and Attacks
• Radio links:
• BTS to BSC link is sometimes not wired, making it easily susceptible to
eavesdropping
• Possible because GSM security does NOT consider encryption beyond the BTS-
BSC link (but only on the MS – BTS radio link)
• Engineering attacks:
• Attacks against the chip card, side-channel attacks
• Software attacks
• Optionality:
• Encryption was introduced as an optional feature
• Very few terminals inform the user if encryption is taking place or not
7
Network Security
- Lecture 8 -
Universal Mobile Telecommunication System
(UMTS) – 3G
Adela Georgescu
1. UMTS architecture
3. Man-in-the-Middle Attack
[Source: http://www.3gpp.org/]
2/8
UMTS architecture
GSM architecture
4/7
UMTS architecture (vs.GSM)
• UE (User Equipment):
• Consists in a Mobile Equipment (ME) and a Universal Subscriber’s
Identity Module (USIM)
• Notice the name change: MS vs. UE, SIM vs USIM
• Authentication:
• The same elements as in GSM: VLR, HLR, EIR, AuC
UMTS architecture (vs.GSM)
• The core part is now divided according to the technology used:
packet switched and circuit switched
• Breaking Kerckhoffs’ principle: cryptographic algorithms were kept confidential (e.g.: A5/1,
A5/2), and their strength was not publicly tested
• Unilateral authentication: The mobile station does not authenticate the network (only the
network authenticates the mobile station)
• Active attacks are possible; e.g.: IMSI Catchers, when an adversary masquerades a
legitimate BTS
UMTS – Security principles
Weaknesses in GSM security: Addressed in UMTS!
• … (previous slide)
• Main idea:
• The adversary obtains an authentication token from any real network,
and uses this token to impersonate a GSM base station to the UMTS
user
• … but UMTS subscribers are vulnerable even though they roam in UMTS
and UMTS authentication is applied
• Phase 0: the adversary finds the IMSI of the victim (and its
cryptographic capabilities)
• The attack does not work if there is another authentication between Phase
1 and Phase 2, otherwise out of range SQN
• The attack does not allow impersonating both MS/UE and BTS/NodeB in
the same time
Network Security
- Lecture 8 -
Long term evolution
(LTE) – 4G
Adela Georgescu
2
LTE - Architecture
UE: User Equipment EUTRAN: Evolved UTRAN EPC: Evolved Packet Core
ME: Mobile Equipment eNodeB: Evolved NodeB MME: Mobility Management Entity
USIM: Universal SIM S-GW: Serving Gateway
P-GW: PDN (Packet Data Network) Gateway
HSS: Home Subscriber Server
3
LTE - Arhitecture
• UE (User Equipment):
• Same as in UMTS: consists of the Mobile Equipment (ME) and the Universal Subscriber’s
Identity Module (USIM)
• EUTRAN (Evolved UTRAN):
• Consists in several eNodeBs
• A difference from UMTS is that the eNodeBs can communicate directly between
themselves
• EPC (Evolved Packet Core):
• UE is authenticated by the MME is responsible for selecting the SGSN at 2G/3G
handovers, authentication and resources allocation to UEs. It manages the mobility of
UEs in the network when eNodeBs cannot
• S-GW is an interconnection point between EUTRAN and EPC, is responsible for packet
routing and forwarding, buffering download packets, being a mobility anchor for inter-
3GPP mobility
• P-GW is a routing point to provide connectivity to the external PDN
4
Terminology
• LTE (Long Term Evolution):
• The new radio technology
• SAE/LTE (System Architecture Evolution / LTE):
• Stands for the entire system: LTE technology with access to previous technologies such
as GSM and 3G
• LTE includes the EUTRAN, while SAE includes the EPC
• EPS (Evolved Packet System):
• The technical term for SAE/LTE, but the brand name of the new system has been chosen
to be LTE
5
EPS Security Architecture
• GSM and UMTS security mechanisms are used as a basis, but adapted to the EPS
architecture
6
EPS Security Architecture
• MME triggers the authentication and key agreement protocol with the UE, resulting a key
KASME
• 2 derived keys are used for confidentiality (KNASenc) and integrity (KNASint) protection of the
signalling data between the MME and the UE - NAS protection
• One key is transported to the eNodeB (KeNB), from which 3 other keys are derived:
• 2 derived keys are used for confidentiality (KRRCenc) and integrity (KRRCint) protection of
the signalling data between the eNodeB and the UE - AS protection
• 1 derived key (KUPenc) is used for confidentiality protection of the user plane data between
the eNodeB and the UE
8
Key Hierarchy
10
EPS Signalling Plane Protection
11
EPS Signalling Plane Protection
• NAS (Non-Access Stratum): network layer communication between the UE and the core
network
• RRC (Radio Resource Control): layer 3 protocol in the AS (Access Stratum) protocol stack
that provides communication between the UE and the eNodeB (the AS level signalling
protocol)
• PDCP (Packet Data Convergence Protocol): both RRC signalling and user data are carried by
the PDCP, and here is where security is implemented
12
EPS User Plane Protection
PDCP: Packet Data Convergence Protocol [Source: D.Forsberg et al. – LTE Security, Wiley 2012]
GTP: GPRS Tunneling Protocol
13
EPS User Plane Protection
• PDCP (Packet Data Convergence Protocol): if for signalling data both confidentiality and
integrity are supported, user plane protection does not consider integrity
• GTP-U: is used for carrying data from the access network to the core network
14
EPS Security Requirements
• High level and service-related security requirements:
• EPS should provide authenticity of information between the terminal and the network
• EPS shall ensure that unauthorized users cannot establish communication through the system
• EPS shall allow the network to hide its internal structure from the terminal
15
EPS Security Requirements
• Privacy related security requirements:
• EPS shall provide several appropriate levels of user privacy for communication, location
and identity
16
EPS Security Features
• Features that are carried over from GSM and UMTS:
• Subscriber authentication, usage of USIM (IMEI stored in the ME and IMSI stored in the UICC)
• Encryption on the radio interface (for confidentiality), which remains optional to the network
operator
• Lawful interception
17
EPS Security Features
• New features in EPS to overcome the shortcomings in GSM/UMTS:
• The endpoint for encryption in the network side remains the eNodeB, but physical
security requirements are introduced for eNodeB (in UMTS is the RNC, but in GSM is the
BTS)
• No integrity mechanism for the user data (reason: risk to tamper the user data is
considered too low to introduce significant overhead by integrity protection, especially for
voice)
18
EPS Security Standards
• TS 33.401: 3GPP System Architecture Evolution (SAE); Security architecture / ETSI 133 401
• EPS security architecture
• EPS security features, procedures, mechanisms
• Main reference
• TS 36.331: Evolved Universal Terrestrial Radio Access (E-UTRA); Radio Resource Control
(RRC); Protocol specification / ETSI 136 331
• TS 24.301: Non-Access-Stratum (NAS) protocol for Evolved Packet System (EPS) / ETSI 124
301
3GPP: The 3rd Generation Partnership Project
• … ETSI: European Telecommunications Standards Institute
19
To remember!
20
Network Security
- Lecture 11 -
LTE (cont.)
Adela Georgescu
2
UE Identification
• Similar to identification in GSM and UMTS
• IMSI
• IMEI , IMEI SV
3
UE Identification
• MME assigns a GUTI to the UE in Attach Accept or Tracking Area Update Accept
messages
Identifies the MME that allocated the GUTI Identifies the UE within the MME
4
EPS AKA
• Precomputed AV are not longer used when the UE moves to another network...
... because the SN id is input to the KDF
• Operator specific: if AK=0, then AK XOR SQN = SQN (if the operator decides no need for
concealment of SQN is required)
6
EPS AKA –
Network side
AuC
UMTS AV:
(RAND, XRES, CK, IK, AUTN)
EPS AV:
(RAND, XRES,KASME, AUTN)
HSS
AMF: Authentication
Management Field
AK: Anonymity Key
• The AuC generates the AVs in exactly the same way as for UMTS
8
EPS AKA – User side
9
EPS AKA – User side
• SQN verification has not been standardized (generation and verification takes place in the
home network, so it can be operator specific)
• Requirements for SQN:
• No SQN should be used twice: USIM should not accept 2 AUTN with the same SQN after
AUTN was verified
• If USIM supports GSM, then it converts (CK, IK) to a GSM key Kc and sends it the the ME
12
Handover and Roaming
• When the UE changes MME, it identifies itself by GUTI in the Attach Request and
Tracking Area Update Request
• Data exchanged between the old and the new MME in 2 scenarios:
14
Key hierarchy (remember!)
Key Length Info
K 128 bits Key shared between the subscriber and the
network operator, stored in the USIM and
AuC; permanent key of the subscriber
CK, IK 128 bits Ciphering key CK and integrity key IK are for
UMTS interconnection
KASME 256 bits A local master key of the subscriber from
which all other keys will be derived; Shared
between the UE and the MME
KNASenc, 128 / Ciphering key KNASenc and integrity key KNASint
KNASint 256 bits for NAS protection
KeNB /NH 256 bits Intermediate key stored in the eNodeB
NH (Next Hop) is used in handover
KRRCenc, 128 / Ciphering key KRRCenc and integrity key KRRCint
KRRCint 256 bits for AS protection
KUPenc 128 / Ciphering key KUPenc for user data
256 bits [Source: D.Forsberg et al. – LTE Security, Wiley 2012]
15
Key hierarchy
• KASME is derived in the ME (not the USIM!) and the HSS => its derivation must be
standardized; others not necessarily
• Encryption and integrity keys (KNASenc, KNASint, KRRCint, KRRCenc, KUPenc) are on 256 bits and
truncated to 128 last significant bits (EPS accepts both 256 and 128 bits keys)
• Keys are derived in hierarchical manner, with additional parameters as input (e.g.: SN id,
SQN xor AK, etc.) – the params are all assumed to be known by a potential attacker
because they are sent in clear or easy computable from unencrypted communication
16
Key hierarchy
• A principle that brings advantages:
• Key freshness:
• Keys can be renewed without affecting other keys (e.g.: renew of KeNB does not
require renewal of the KASME , X2 hadover)
Question: Can KNASenc, KNASint be refreshed without refreshing the KASME ? How?
Just by changing the other param, NAS-enc/int-alg Alg_ID 18
Cryptography
• Algorithm agility / flexibility: the cryptographic algorithms should be replaced without much
difficulty
• Algorithms diversity: the design of the algorithms should differ from each other as much as
possible
• Why? Where did you encounter this principle before (in crypto)?
• Emergency scenarios
19
Emergency
• Null algorithm: provides no cryptographic protection
• Must exist for emergency cases
• Problematic from security perspective because it can be triggered in cases where
protection should be enabled
• Turn-off principle: the cryptographic protection should be by default on, and only by
request (on special scenarios) should be turned off
• EEA0 (EPS Encryption Algorithm): the identity function (i.e. ciphertext equals the cleartext)
• EIA0 (EPS Integrity Algorithm) : a 32-bit string of 0’s is appended to the message
• 128-EEA2: AES
• 128 bits keys
• Counter mode
21
Integrity
• Same principles as for confidentiality
• Usage of the same main cryptographic blocks (re-usability)
• The key length in the naming implies that other key lengths (e.g.:192, 256) can be used in
case of improved security
22
Key derivation
• One-way: an adversary cannot use one key to derive a key located upper in the hierarchy
23
Algorithm negotiation
• Algorithms are negotiated separately for AS (between UE and eNodeB) and NAS (between
UE and MME)
• Negotiation is based on the UE capabilities and a list of allowed cryptographic algorithms in the
eNodeB, respectively MME in priority order
• eNodeB and MME are responsible for selecting the AS level, respectively the NAS level
algorithms, after UE sends its capabilities in the attachment procedure
24
[Source: D.Forsberg et al. – LTE Security, Wiley 2012]
NAS signalling protection
Integrity protection
Integrity protection
• Ciphering: same inputs, except KNASenc instead of KNASint and an additional parameter LENGTH
that specifies the length of the keystream to be generated
28
AS signalling protection
Integrity protection
Uplink enc.
starts only after
AS Sec.Mode
Complete is
sent
[Source: D.Forsberg et al. – LTE Security, Wiley 2012]
• The security is implemented in the PDCP (Packet Data Convergence Protocol) layer,
which carries both RRC and user data
Same inputs as for NAS, but a
• Integrity algorithm’s input params:
different key and BEARER not
• KRRCint , 128 bits key constant
• COUNT, 32 bits, for each radio bearer (PDCP seg.no).
• DIRECTION, 1 bit, indicating upstream or downstream
• BEARER, 5 bits indicating the radio bearer identity, mapped from RRC bearer identity:
• Ciphering: same inputs, except KRRCenc instead of KRRCint and an additional parameter LENGTH
that specifies the length of the keystream to be generated
31
NAS vs AS Security Mode Commands (SMC)
AS (Access Stratum) NAS (Non-Access Stratum)
• Encryption starts after the AS Security • Encryption starts with the NAS Security
Mode Complete Mode Complete
• Several bearers (there are several AS level • One bearer of constant value (there is only
connections between UE and eNodeB) one NAS level connection between UE and
MME)
32
To remember!
4. Implementation in LTE
36
Network Security
- Lecture 12 -
5G
Adela Georgescu
2
5G Security
https://www.3gpp.org/
https://www.ieee.org/ https://www.etsi.org/
https://www.itu.int https://www.ietf.org/
[Source: https://www.3gpp.org/DynaReport/33-series.htm] 4
Security Architecture
6
Protection of SUPI by encryption
[Source: https://www.mpirical.com/blog/5g-anonymity-and-the-suci]
7
[Source: 3GPP TS 33.501 V17.1.0 (2021-03)]
8
Protection of SUPI – SUCI – encryption
[Source: 3GPP TS 33.501 V17.1.0 (2021-03)]
9
Protection of SUPI – SUCI - decryption
5G-AKA
10
Key Hierarchy
Cryptographical Aspects
12
[Source: 3GPP TS 33.501 V17.1.0 (2021-03)]
Cryptographical Aspects
13