Nailgun: Breaking the Privilege Isolation on ARM
Zhenyu Ning
COMPASS Lab Wayne State University
Sep 23, 2019
Nailgun: Breaking the Privilege Isolation on ARM 1
Nailgun: Breaking the Privilege Isolation on ARM Zhenyu Ning - - PowerPoint PPT Presentation
Nailgun: Breaking the Privilege Isolation on ARM Zhenyu Ning COMPASS Lab Wayne State University Sep 23, 2019 Nailgun: Breaking the Privilege Isolation on ARM 1 Outline I Background I Introduction I Obstacles for Misusing the Traditional
COMPASS Lab Wayne State University
Nailgun: Breaking the Privilege Isolation on ARM 1
I Background I Introduction I Obstacles for Misusing the Traditional Debugging I Nailgun Attack I Mitigations I Conclusion
Nailgun: Breaking the Privilege Isolation on ARM 2
I Background I Introduction I Obstacles for Misusing the Traditional Debugging I Nailgun Attack I Mitigations I Conclusion
Nailgun: Breaking the Privilege Isolation on ARM 3
Nailgun: Breaking the Privilege Isolation on ARM 4
Nailgun: Breaking the Privilege Isolation on ARM 5
Nailgun: Breaking the Privilege Isolation on ARM 6
I In Dictionary: Hands, or weapons. I Company: ARM was a British semiconductor company, now
I Architecture: ARM is a processor architecture designed by
Nailgun: Breaking the Privilege Isolation on ARM 7
I In Dictionary: Hands, or weapons. I Company: ARM was a British semiconductor company, now
I Architecture: ARM is a processor architecture designed by
Nailgun: Breaking the Privilege Isolation on ARM 8
I In Dictionary: Hands, or weapons. I Company: ARM was a British semiconductor company, now
I Architecture: ARM is a processor architecture designed by
Nailgun: Breaking the Privilege Isolation on ARM 9
I In Dictionary: Hands, or weapons. I Company: ARM was a British semiconductor company, now
I Architecture: ARM is a processor architecture designed by
Nailgun: Breaking the Privilege Isolation on ARM 10
I In Dictionary: Hands, or weapons. I Company: ARM was a British semiconductor company, now
I Architecture: ARM is a processor architecture designed by
Nailgun: Breaking the Privilege Isolation on ARM 11
Nailgun: Breaking the Privilege Isolation on ARM 12
I Privilege In Dictionary: A special right, advantage, or
I Isolation In Dictionary: The process or fact of isolating or
I In Company: CEO is able to view all the classified docs, but
Nailgun: Breaking the Privilege Isolation on ARM 13
I Privilege In Dictionary: A special right, advantage, or
I Isolation In Dictionary: The process or fact of isolating or
I In Company: CEO is able to view all the classified docs, but
Nailgun: Breaking the Privilege Isolation on ARM 14
I Privilege In Dictionary: A special right, advantage, or
I Isolation In Dictionary: The process or fact of isolating or
I In Company: CEO is able to view all the classified docs, but
Nailgun: Breaking the Privilege Isolation on ARM 15
I Privilege In Dictionary: A special right, advantage, or
I Isolation In Dictionary: The process or fact of isolating or
I In Company: CEO is able to view all the classified docs, but
Nailgun: Breaking the Privilege Isolation on ARM 16
I Exception: is used to divert the normal execution control
I Exception Levels: are used to specify different privileges in
Nailgun: Breaking the Privilege Isolation on ARM 17
Nailgun: Breaking the Privilege Isolation on ARM 18
Nailgun: Breaking the Privilege Isolation on ARM 19
Nailgun: Breaking the Privilege Isolation on ARM 20
Nailgun: Breaking the Privilege Isolation on ARM 21
Nailgun: Breaking the Privilege Isolation on ARM 22
Nailgun: Breaking the Privilege Isolation on ARM 23
Nailgun: Breaking the Privilege Isolation on ARM 24
Nailgun: Breaking the Privilege Isolation on ARM 25
Figure source: https://www.123rf.com/ Nailgun: Breaking the Privilege Isolation on ARM 26
I Background I Introduction I Obstacles for Misusing the Traditional Debugging I Nailgun Attack I Mitigations I Conclusion
Nailgun: Breaking the Privilege Isolation on ARM 27
Nailgun: Breaking the Privilege Isolation on ARM 28
Nailgun: Breaking the Privilege Isolation on ARM 29
Nailgun: Breaking the Privilege Isolation on ARM 30
Nailgun: Breaking the Privilege Isolation on ARM 31
Nailgun: Breaking the Privilege Isolation on ARM 32
Nailgun: Breaking the Privilege Isolation on ARM 33
Nailgun: Breaking the Privilege Isolation on ARM 34
Nailgun: Breaking the Privilege Isolation on ARM 35
I Obstacle 1: Physical access. I Obstacle 2: Debug authentication mechanism.
Nailgun: Breaking the Privilege Isolation on ARM 36
I Obstacle 1: Physical access. I Obstacle 2: Debug authentication mechanism.
Nailgun: Breaking the Privilege Isolation on ARM 37
I Background I Introduction I Obstacles for Misusing the Traditional Debugging I Nailgun Attack I Mitigations I Conclusion
Nailgun: Breaking the Privilege Isolation on ARM 38
I Obstacle 1: Physical access. I Obstacle 2: Debug authentication mechanism.
Nailgun: Breaking the Privilege Isolation on ARM 39
Nailgun: Breaking the Privilege Isolation on ARM 40
Nailgun: Breaking the Privilege Isolation on ARM 41
Nailgun: Breaking the Privilege Isolation on ARM 42
Nailgun: Breaking the Privilege Isolation on ARM 43
I Memory-mapped debugging registers.
I No JTAG, No physical access.
Nailgun: Breaking the Privilege Isolation on ARM 44
Nailgun: Breaking the Privilege Isolation on ARM 45
I Obstacle 1: Physical access. I Obstacle 2: Debug authentication mechanism.
Nailgun: Breaking the Privilege Isolation on ARM 46
Nailgun: Breaking the Privilege Isolation on ARM 47
Nailgun: Breaking the Privilege Isolation on ARM 48
Nailgun: Breaking the Privilege Isolation on ARM 49
Nailgun: Breaking the Privilege Isolation on ARM 50
Nailgun: Breaking the Privilege Isolation on ARM 51
Nailgun: Breaking the Privilege Isolation on ARM 52
I ARM licenses technology to the System-On-Chip (SoC)
I Defines the debug authentication signals.
Nailgun: Breaking the Privilege Isolation on ARM 53
I The SoC Vendors develop chips for Original Equipment
I Implement the debug authentication signals.
Nailgun: Breaking the Privilege Isolation on ARM 54
I The OEMs produce devices for the users.
I Configure the debug authentication signals.
Nailgun: Breaking the Privilege Isolation on ARM 55
I Finally, the User can enjoy the released devices.
I Learn the status of debug authentication signals.
Nailgun: Breaking the Privilege Isolation on ARM 56
I Obstacle 1: Physical access. I Obstacle 2: Debug authentication mechanism.
Nailgun: Breaking the Privilege Isolation on ARM 57
I What is the status of the signals in real-world device? I How to manage the signals in real-world device?
Nailgun: Breaking the Privilege Isolation on ARM 58
Category Platform / Device Debug Authentication Signals DBGEN NIDEN SPIDEN SPNIDEN Development Boards ARM Juno r1 Board 4 4 4 4 NXP i.MX53 QSB 6 4 6 6 IoT Devices Raspberry PI 3 B+ 4 4 4 4 Cloud Platforms 64-bit ARM miniNode 4 4 4 4 Packet Type 2A Server 4 4 4 4 Scaleway ARM C1 Server 4 4 4 4 Google Nexus 6 6 4 6 6 Samsung Galaxy Note 2 4 4 6 6 Mobile Devices Huawei Mate 7 4 4 4 4 Motorola E4 Plus 4 4 4 4 Xiaomi Redmi 6 4 4 4 4
Nailgun: Breaking the Privilege Isolation on ARM 59
Category Platform / Device Debug Authentication Signals DBGEN NIDEN SPIDEN SPNIDEN Development Boards ARM Juno r1 Board 4 4 4 4 NXP i.MX53 QSB 6 4 6 6 IoT Devices Raspberry PI 3 B+ 4 4 4 4 Cloud Platforms 64-bit ARM miniNode 4 4 4 4 Packet Type 2A Server 4 4 4 4 Scaleway ARM C1 Server 4 4 4 4 Google Nexus 6 6 4 6 6 Samsung Galaxy Note 2 4 4 6 6 Mobile Devices Huawei Mate 7 4 4 4 4 Motorola E4 Plus 4 4 4 4 Xiaomi Redmi 6 4 4 4 4
Nailgun: Breaking the Privilege Isolation on ARM 60
Category Platform / Device Debug Authentication Signals DBGEN NIDEN SPIDEN SPNIDEN Development Boards ARM Juno r1 Board 4 4 4 4 NXP i.MX53 QSB 6 4 6 6 IoT Devices Raspberry PI 3 B+ 4 4 4 4 Cloud Platforms 64-bit ARM miniNode 4 4 4 4 Packet Type 2A Server 4 4 4 4 Scaleway ARM C1 Server 4 4 4 4 Google Nexus 6 6 4 6 6 Samsung Galaxy Note 2 4 4 6 6 Mobile Devices Huawei Mate 7 4 4 4 4 Motorola E4 Plus 4 4 4 4 Xiaomi Redmi 6 4 4 4 4
Nailgun: Breaking the Privilege Isolation on ARM 61
I For both development boards with manual, we cannot fully
I In some mobile phones, we find that the signals are controlled
Nailgun: Breaking the Privilege Isolation on ARM 62
I Obstacle 1: Physical access.
I Obstacle 2: Debug authentication mechanism.
Nailgun: Breaking the Privilege Isolation on ARM 63
I Background I Introduction I Obstacles for Misusing the Traditional Debugging I Nailgun Attack I Mitigations I Conclusion
Nailgun: Breaking the Privilege Isolation on ARM 64
Nailgun: Breaking the Privilege Isolation on ARM 65
Nailgun: Breaking the Privilege Isolation on ARM 66
TARGET (Normal State) (High Privilege) HOST (Normal State) (High Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Privilege Escalation Request
I Two processors as HOST and TARGET, respectively. I Low-privilege and High-privilege resource.
Nailgun: Breaking the Privilege Isolation on ARM 67
TARGET (Normal State) (High Privilege) HOST (Normal State) (High Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Privilege Escalation Request
I Low-privilege refers to non-secure kernel-level privilege I High-privilege refers to any other higher privilege
Nailgun: Breaking the Privilege Isolation on ARM 68
TARGET (Normal State) (Low Privilege) HOST (Normal State) (Low Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Debug Request
I Normal state I Low-privilege mode
Nailgun: Breaking the Privilege Isolation on ARM 69
TARGET (Normal State) (Low Privilege) HOST (Normal State) (Low Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Debug Request
I TARGET checks its authentication signal. I Privilege of HOST is ignored.
Nailgun: Breaking the Privilege Isolation on ARM 70
TARGET (Normal State) (Low Privilege) HOST (Normal State) (Low Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Debug Request
I TARGET checks its authentication signal. I Privilege of HOST is ignored.
Nailgun: Breaking the Privilege Isolation on ARM 71
TARGET (Normal State) (Low Privilege) HOST (Normal State) (Low Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Debug Request
Nailgun: Breaking the Privilege Isolation on ARM 72
TARGET (Debug State) (Low Privilege) HOST (Normal State) (Low Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Debug Request
I Low-privilege mode I No access to high-privilege resource
Nailgun: Breaking the Privilege Isolation on ARM 73
TARGET (Debug State) (Low Privilege) HOST (Normal State) (Low Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Privilege Escalation Request
I E.g., executing DCPS series instructions. I The instructions can be executed at any privilege level.
Nailgun: Breaking the Privilege Isolation on ARM 74
TARGET (Debug State) (Low Privilege) HOST (Normal State) (Low Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Privilege Escalation Request
Nailgun: Breaking the Privilege Isolation on ARM 75
TARGET (Debug State) (High Privilege) HOST (Normal State) (Low Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Privilege Escalation Request
I Debug state, high-privilege mode I Gained access to high-privilege resource
Nailgun: Breaking the Privilege Isolation on ARM 76
TARGET (Debug State) (High Privilege) HOST (Normal State) (Low Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Resource Access Request
I E.g., accessing secure RAM/register/peripheral. I Privilege of HOST is ignored.
Nailgun: Breaking the Privilege Isolation on ARM 77
TARGET (Debug State) (High Privilege) HOST (Normal State) (Low Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Resource Access Request
Nailgun: Breaking the Privilege Isolation on ARM 78
TARGET (Debug State) (High Privilege) HOST (Normal State) (Low Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Debug Response
I i.e., content of the high-privilege resource. I Privilege of HOST is ignored.
Nailgun: Breaking the Privilege Isolation on ARM 79
TARGET (Debug State) (High Privilege) HOST (Normal State) (Low Privilege) High-privilege Resource (Secure RAM/Register/Peripheral) Low-privilege Resource (Non-Secure RAM/Register/Peripheral) Debug Response
I Normal state I Low-privilege mode
Nailgun: Breaking the Privilege Isolation on ARM 80
I Achieve access to high-privilege resource via misusing the
I Can be used to craft different attacks.
Nailgun: Breaking the Privilege Isolation on ARM 81
I Implemented Attack Scenarios:
I Covered Architectures:
I Vulnerable Devices:
Nailgun: Breaking the Privilege Isolation on ARM 82
I Implemented Attack Scenarios:
I Covered Architectures:
I Vulnerable Devices:
Nailgun: Breaking the Privilege Isolation on ARM 83
Non-secure Memory Secure Memory mov X0, #1 ... ... ... eret b handler ...
DLR EL0 VBAR EL3 + 0x400 VBAR EL3 + 0x400
I DLR EL0 points to the debug return address. I VBAR EL3 points to the exception vector in EL3.
Nailgun: Breaking the Privilege Isolation on ARM 84
Non-secure Memory Secure Memory mov X0, #1 ... ... ... ... b handler ...
payload: DLR EL0 VBAR EL3 + 0x400 VBAR EL3 + 0x400
I With Nailgun, we can directly copy the payload to the secure
Nailgun: Breaking the Privilege Isolation on ARM 85
Non-secure Memory Secure Memory smc #0 ... ... ... ... b handler ...
payload: DLR EL0 VBAR EL3 + 0x400 VBAR EL3 + 0x400
I Modify the instruction pointed by DLR EL0 to get into
Nailgun: Breaking the Privilege Isolation on ARM 86
Non-secure Memory Secure Memory smc #0 ... ... ... ... b payload ...
payload: DLR EL0 VBAR EL3 + 0x400 VBAR EL3 + 0x400
I Manipulate the exception vector to execute the payload while
Nailgun: Breaking the Privilege Isolation on ARM 87
Non-secure Memory Secure Memory smc #0 ... ... ... eret b payload ...
payload: DLR EL0 VBAR EL3 + 0x400 VBAR EL3 + 0x400
I The last instruction of the payload should be eret.
Nailgun: Breaking the Privilege Isolation on ARM 88
Non-secure Memory Secure Memory smc #0 ... ... ... eret b payload ...
payload: PC VBAR EL3 + 0x400 VBAR EL3 + 0x400
I Make TARGET exit the debug state.
Nailgun: Breaking the Privilege Isolation on ARM 89
Non-secure Memory Secure Memory smc #0 ... ... ... eret b payload ...
payload: ELR EL3 PC VBAR EL3 + 0x400
I ELR EL3 points to the exception return address.
Nailgun: Breaking the Privilege Isolation on ARM 90
Non-secure Memory Secure Memory smc #0 ... ... ... eret b payload ...
payload: PC ELR EL3 VBAR EL3 + 0x400 VBAR EL3 + 0x400
I The payload get executed.
Nailgun: Breaking the Privilege Isolation on ARM 91
Non-secure Memory Secure Memory smc #0 ... ... ... eret b handler ...
payload: PC ELR EL3 VBAR EL3 + 0x400 VBAR EL3 + 0x400
I In the payload, we first restore the exception vector.
Nailgun: Breaking the Privilege Isolation on ARM 92
Non-secure Memory Secure Memory mov X0, #1 ... ... ... eret b handler ...
payload: PC ELR EL3 VBAR EL3 + 0x400 VBAR EL3 + 0x400
I Roll back the ELR EL3 register. I Revert the modified instruction.
Nailgun: Breaking the Privilege Isolation on ARM 93
Non-secure Memory Secure Memory mov X0, #1 ... ... ... eret b handler ...
payload: PC ELR EL3 VBAR EL3 + 0x400 VBAR EL3 + 0x400
I The eret instruction will finish the exception handle process.
Nailgun: Breaking the Privilege Isolation on ARM 94
Non-secure Memory Secure Memory mov X0, #1 ... ... ... eret b handler ...
payload: PC VBAR EL3 + 0x400 VBAR EL3 + 0x400
I After that, everything goes back to the original state.
Nailgun: Breaking the Privilege Isolation on ARM 95
I Deivce: Huawei Mate 7 (MT-L09) I Firmware: MT7-L09V100R001C00B121SP05 I Fingerprint sensor: FPC1020
Nailgun: Breaking the Privilege Isolation on ARM 96
I Step 1: Learn the location of fingerprint data in secure RAM.
I Step 2: Extract the data.
I Step 3: Restore fingerprint image from the extracted data.
Nailgun: Breaking the Privilege Isolation on ARM 97
I The right part of the image is blurred for privacy concerns. I Source code: https://compass.cs.wayne.edu/nailgun/ I The issue has been fixed in Huawei devices.
Nailgun: Breaking the Privilege Isolation on ARM 98
Nailgun: Breaking the Privilege Isolation on ARM 100
I Background I Introduction I Obstacles for Misusing the Traditional Debugging I Nailgun Attack I Mitigations I Conclusion
Nailgun: Breaking the Privilege Isolation on ARM 101
Nailgun: Breaking the Privilege Isolation on ARM 102
I Existing tools rely on the debug authentication signals.
I Unavailable management mechanisms. I OTP feature, cost, and maintenance.
Nailgun: Breaking the Privilege Isolation on ARM 103
I For ARM, additional restriction in inter-processor debugging
I For SoC vendors, refined signal management and
I For OEMs and cloud providers, software-based access control.
Nailgun: Breaking the Privilege Isolation on ARM 104
I Background I Introduction I Obstacles for Misusing the Traditional Debugging I Nailgun Attack I Mitigations I Conclusion
Nailgun: Breaking the Privilege Isolation on ARM 105
I We present a study on the security of hardware debugging
I “Safe” components in legacy systems may be vulnerable in
I We suggest a comprehensive rethink on the security of legacy
Nailgun: Breaking the Privilege Isolation on ARM 106
[1] IEEE, “Standard for test access port and boundary-scan architecture,” https://standards.ieee.org/findstds/standard/1149.1-2013.html. [2]
experience in testing the security of real-world electronic voting systems,” IEEE Transactions on Software Engineering, 2010. [3]
(still) can’t encrypt: A security analysis of the APCO project 25 two-way radio system,” in Proceedings of the 20th USENIX Security Symposium (USENIX Security’11), 2011. [4]
Proceedings of the 10th European Workshop on Systems Security (EuroSec’17), 2017. [5]
embedded systems software,” in Proceedings of the 27th USENIX Security Symposium (USENIX Security’18), 2018. [6]
malware knows physics! Attacking PLCs with physical model aware rootkit,” in Proceedings of 24th Network and Distributed System Security Symposium (NDSS’17), 2017. [7]
embedded systems,” in Proceedings of the 9th USENIX Workshop on Offensive Technologies (WOOT’15), 2015. [8]
Security and Privacy (HASP’15), 2015. [9]
app platform,” in Proceedings of the 10th USENIX Workshop on Offensive Technologies (WOOT’16), 2016. Nailgun: Breaking the Privilege Isolation on ARM 107
[10]
26th USENIX Security Symposium (USENIX Security’17), 2017. [11]
analysis of embedded systems’ firmwares,” in Proceedings of 21st Network and Distributed System Security Symposium (NDSS’14), 2014. Nailgun: Breaking the Privilege Isolation on ARM 108
Nailgun: Breaking the Privilege Isolation on ARM 109
Nailgun: Breaking the Privilege Isolation on ARM 110
I 64-bit ARMv8 architecture: ARM Juno r1 board.
I 32-bit ARMv8 architecture: Raspberry PI Model 3 B+.
I ARMv7 architecture: Huawei Mate 7.
Nailgun: Breaking the Privilege Isolation on ARM 111
Nailgun: Breaking the Privilege Isolation on ARM 112
Nailgun: Breaking the Privilege Isolation on ARM 113
Nailgun: Breaking the Privilege Isolation on ARM 114
Nailgun: Breaking the Privilege Isolation on ARM 115
Nailgun: Breaking the Privilege Isolation on ARM 116