SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security
Sanjeev Das,
Jan Werner, Manos Antonakakis, Michalis Polychronakis, and Fabian Monrose
SoK: The Challenges, Pitfalls, and Perils of Using Hardware - - PowerPoint PPT Presentation
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security Sanjeev Das , Jan Werner, Manos Antonakakis, Michalis Polychronakis, and Fabian Monrose SoK: The Challenges, Pitfalls, and Perils of Using Hardware
Sanjeev Das,
Jan Werner, Manos Antonakakis, Michalis Polychronakis, and Fabian Monrose
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
2
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
3
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
4
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
5
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
6
On the feasibility of online malware detection with performance counters. Demme et al., SIGARCH, 2013. SIGDROP: Signature-based ROP Detection using Hardware Performance
Hardware-Assisted Rootkits: Abusing Performance Counters on the ARM and x86
Who Watches the Watchmen?: Utilizing Performance Monitors for Compromising Keys of RSA on Intel Platforms, Bhattacharya et al.[CHES’15]
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
Detecting Spectre And Meltdown Using Hardware Performance
Detecting Attacks that Exploit Meltdown and Spectre with Performance Counters. Fiser & Gamazo Sanchez, Trend Micro Inc., 2018 Detecting Spectre Attacks by identifying Cache Side-Channel Attacks using Machine Learning. Depoix et al. [WAMOS, 2018]
7
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
8
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
9
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
10
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
11
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
12
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
13
45% 55%
Non-security domains
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
14
Can hardware performance counters be trusted? Weaver & McKee, Workload Characterization, 2008
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
15
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
16
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
17
N instructions
Event-based sampling using Performance Monitoring Interrupt (PMI)
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
18
PMI PMI Context switch Context switch Process A Process A Save HPC Restore HPC Noise from process B Process B Loss of events’ count
Filtering of processes at performance monitoring interrupt (PMI)
Fix :
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
19
N 2N 3N Program execution E.g., sampling every N DTLB misses PMI skid skid PMI N+10 N+30
“Hardware performance monitoring for the rest of us: a position and survey” Moseley et al., Network and Parallel Computing, 2011
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
20
issues persist even today
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
21
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
22
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
23
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
24
Filtering process at PMI Saving HPCs at Context switches
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
25
INC EAX; RET POP EBP; RET INC EDX; INC ECX; RET INC EDX; INC ECX; RET POP EDI; POP EBP; RET
ROP Attack!
Ret.
Instruction = 0 Return = 0 Instruction = 2 Instruction = 4 Instruction = 7 Instruction = 10 Instruction = 13 Instruction = 16 Return = 1 Return = 2 Return = 3 Return = 4 Return = 5 Return = 6
POP ESI; POP EDI; RET
Ins.
Gadgets
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
26
Init. Gadget
INC EAX; RET
Manipulator Gadget Manipulator Gadget
POP EBP; RET
Ret.
Instruction = 0 Return = 0 Instruction = 2 Instruction = 4 Instruction = 257 Instruction = 260 Instruction = 513 Instruction = 516 Return = 1 Return = 2 Return = 3 Return = 4 Return = 5 Return = 6
INC EDX; INC ECX; RET
Ins.
Gadgets No ROP detected!
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
27
applying HPCs to security applications, especially defenses, in ways that go beyond their original intent
HPCs offer a powerful capability, but like anything else, the devil is in the details
SoK: The Challenges, Pitfalls, and Perils of Using Hardware Performance Counters for Security, S&P’19
28
sdas@cs.unc.edu