Securely Implementing Network Protocols: Detecting and Preventing Logical Flaws
Mathy Vanhoef (KU Leuven) Black Hat Webcast, 24 August 2017
@vanhoefm
Securely Implementing Network Protocols: Detecting and Preventing - - PowerPoint PPT Presentation
Securely Implementing Network Protocols: Detecting and Preventing Logical Flaws Mathy Vanhoef (KU Leuven) Black Hat Webcast, 24 August 2017 @vanhoefm Introduction Many protocols have been affected by logical bugs Design flaws Implementation
Mathy Vanhoef (KU Leuven) Black Hat Webcast, 24 August 2017
@vanhoefm
Introduction
Many protocols have been affected by logical bugs
2
Design flaws Implementation flaws TLS BEAST11 POODLE12 Lucky 1313 … Early CCS attack5 FREAK8 Logjam10 … Wi-Fi WEP Protected setup7 Key reinstallations1 … Bad state machine4 No downgrade check4 Bad randomness6,7 … SSH CBC plaintext recovery2 Bad state machine3
Introduction
Many protocols have been affected by logical bugs
3
We focus on logical implementation flaws
Implementation flaws Early CCS attack5 FREAK8 Logjam10 … Bad state machine4 No downgrade check4 Bad randomness6,7 … Bad state machine3
How were TLS flaws detected?
4
2014
2015
2016
Several works audited state machines:
Lesson: use model-based testing!
5
Model-based testing!
Background: the Wi-Fi handshake
Main purposes:
6
WPA-TKIP Short-term solution: reduced security so it could run on old hardware AES-CCMP Long-term solution based on modern cryptographic primitives
Wi-Fi handshake (simplified)
7
Wi-Fi handshake (simplified)
8
Wi-Fi handshake (simplified)
9
Wi-Fi handshake (simplified)
10
Defined using EAPOL frames
EAPOL frame layout
11
EAPOL frame layout
12
MIC header replay counter … key data
encrypted
Test generation rules: (in)correct modifications
Model-based testing: our approach
13
Model: normal handshake Set of test cases
Test generation rules:
A test case defines:
Executing test cases
14
Execute test case Check if connection successful unexpected result
For every test case
unexpected reply Save failed test Reset All OK
Afterwards inspect failed test cases
Test generation rules
Test generation rules manipulating messages as a whole:
Test generation rules that modify fields in messages:
15
Evaluation
We tested 12 access points:
16
Discovered several issues!
Missing downgrade checks
17
Trivial downgrade attack against MediaTek clients
Windows 7 targeted DoS
18
AP Client Client 2
Windows 7 targeted DoS
19
AP Client Client 2
github.com/vanhoefm/blackhat17-pocs
Broadcom downgrade
Broadcom cannot distinguish message 2 and 4
Hence message 4 is essential in preventing downgrade attacks
20
“While Message 4 serves no cryptographic purpose, it serves as an acknowledgment to Message 3. It is required to ensure reliability and to inform the Authenticator that the Supplicant has installed the PTK and GTK and hence can receive encrypted frames.”
OpenBSD: client man-in-the-middle
Bug in state machine of AP we also inspected client: State machine missing!
21
Man-in-the-middle against client
OpenBSD: client man-in-the-middle
22
OpenBSD: client man-in-the-middle
23
OpenBSD: client man-in-the-middle
24
OpenBSD: client man-in-the-middle
25
OpenBSD: client man-in-the-middle
26
github.com/vanhoefm/blackhat17-pocs
More results
See Black Hat & AsiaCCS paper4:
Broadcom and OpenBSD
Broadcom, Aerohive
cipher suite list
27
Future work!
Current limitations:
But already a promising technique Black-box testing mechanism: no source code needed Fairly simple handshake, but still several logical bugs!
28
Conclusion: avoiding logical bugs
What helps:
Does not help:
29
Mathy Vanhoef (KU Leuven) Black Hat Webcast, 24 August 2017
@vanhoefm
References
1.
2.
3.
4.
5.
http://ccsinjection.lepidum.co.jp/blog/2014-06-05/CCS-Injection-en/index.html 6.
7.
8. Beurdouche et al. A Messy State of the Union: Taming the Composite State Machines of TLS. In IEEE S&P, 2015. 9.
31