SlideShare a Scribd company logo
Escalating Privileges in Linux using Fault Injection
Niek Timmers
timmers@riscure.com
(@tieknimmers)
Cristofaro Mune
c.mune@pulse-sec.com
(@pulsoid)
September 25, 2017
Fault Injection – A definition...
”Introducing faults in a target to alter its intended behavior.”
...
if( key_is_correct ) <-- Glitch here!
{
open_door();
}
else
{
keep_door_closed();
}
...
How can we introduce these faults?
Fault injection techniques
clock voltage e-magnetic laser
We used Voltage Fault Injection for all experiments!
Fault injection techniques
clock voltage e-magnetic laser
We used Voltage Fault Injection for all experiments!
Fault injection fault model
Let’s keep it simple: instruction corruption
Single-bit (MIPS)
addi $t1, $t1, 8 00100001001010010000000000001000
addi $t1, $t1, 0 00100001001010010000000000000000
Multi-bit (ARM)
ldr w1, [sp, #0x8] 10111001010000000000101111100001
str w7, [sp, #0x20] 10111001000000000010001111100111
Remarks
• Limited control over which bit(s) will be corrupted
• May or may not be the true fault model
• Includes other fault models (e.g. instruction skipping)
Let’s inject faults!
Fault injection setup
Target
• Fast and feature rich System-on-Chip (SoC)
• ARM Cortex-A9 (32-bit)
• Ubuntu 14.04 LTS (fully patched)
Characterization
• Determine if the target is vulnerable to fault injection
• Determine if the fault injection setup is effective
• Estimate required fault injection parameters for an attack
• An open target is required; but not required for an attack
Characterization Test Application
Characterization – Alter a loop
. . .
set_trigger(1);
for(i = 0; i < 10000; i++) { // glitch here
j++; // glitch here
} // glitch here
set_trigger(0);
. . .
Remarks
• Implemented in a Linux Kernel Module (LKM)
• Successful glitches are not that time dependent
Characterization – Possible responses
Expected: ’glitch is too soft’
counter = 00010000
Mute/Reset: ’glitch is too hard’
counter =
Success: ’glitch is exactly right’
counter = 00009999
counter = 00010015
counter = 00008687
Characterization – Alter a loop
Remarks
• We took 16428 experiments in 65 hours
• We randomize the Glitch VCC Glitch Length Glitch Delay
• We can fix either the Glitch VCC or the Glitch Length
Characterization – Bypassing a check
. . .
set_trigger(1);
if(cmd.cmdid < 0 || cmd.cmdid > 10) {
return -1;
}
if(cmd.length > 0x100) { // glitch here
return -1; // glitch here
} // glitch here
set_trigger(0);
. . .
Remarks
• Implemented in a Linux Kernel Module (LKM)
• Successful glitches are time dependent
Characterization – Bypassing a check
Remarks
• We took 16315 experiments in 19 hours
• The success rate between 6.2 µs and 6.8 µs is: 0.41%
• The check is bypassed every 15 minutes !
Let’s attack Linux!
Relevant when vulnerabilities are not known!
Attacking Linux
Opening /dev/mem – Description
(1) Open /dev/mem using open syscall
(2) Bypass check performed by Linux kernel using a glitch
(3) Map arbitrary address in physical address space
Opening /dev/mem – Code
Algorithm 1 Open /dev/mem
1: r1 ← 2
2: r0 ← ”/dev/mem”
3: r7 ← 0x5
4: svc #0
5: if r0 == 3 then
6: address ← mmap(...)
7: printf(∗address)
8: end if
Remarks
• Implemented using ARM assembly
• Linux syscall: sys open (0x5)
Opening /dev/mem – Results
Remarks
• We took 22118 experiments in 17 hours
• The success rate between 25.5 µs and 26.8 µs is: 0.53%
• The Linux kernel is compromised every 10 minutes !
Privilege escalation #1
Spawning a root shell – Description
(1) Set all registers to 0 to increase the probability1
(2) Perform setresuid syscall to set process IDs to root
(3) Bypass check performed by Linux kernel using a glitch
(4) Execute root shell using system function
1
Linux uses 0 for valid return values
Spawning a root shell – Code
Algorithm 2 Executing a root shell
1: r0 ← r1 ← r2 ← 0
2: r3 ← r4 ← r5 ← 0
3: r6 ← r7 ← r8 ← 0
4: r9 ← r10 ← r11 ← 0
5: r7 ← 0xd0
6: svc #0
7: if r0 == 0 then
8: system(”/bin/sh”)
9: end if
Remarks
• Implemented using ARM assembly
• Linux syscall: sys setresuid (0xd0)
Spawning a root shell – Results
Remarks
• We took 18968 experiments in 21 hours
• The success rate between 3.14 µs and 3.44 µs is: 1.3%
• We spawn a root shell every 5 minutes !
Privilege escalation #2
Reflection
• Linux checks can be (easily) bypassed using fault injection
• Attacks are identified and reproduced within a day
• Full fault injection attack surface not explored
Can we mitigate these type of attacks?
Reflection
• Linux checks can be (easily) bypassed using fault injection
• Attacks are identified and reproduced within a day
• Full fault injection attack surface not explored
Can we mitigate these type of attacks?
Mitigations
Software fault injection countermeasures
• Double checks
• Random delays
• Flow counters
Can these be implemented easily for larger code bases?
Hardware fault injection countermeasures
• Redundancy
• Integrity
• Sensors and detectors
Are these implemented for standard embedded technology?
Mitigations
Software fault injection countermeasures
• Double checks
• Random delays
• Flow counters
Can these be implemented easily for larger code bases?
Hardware fault injection countermeasures
• Redundancy
• Integrity
• Sensors and detectors
Are these implemented for standard embedded technology?
Mitigations
Software fault injection countermeasures
• Double checks
• Random delays
• Flow counters
Can these be implemented easily for larger code bases?
Hardware fault injection countermeasures
• Redundancy
• Integrity
• Sensors and detectors
Are these implemented for standard embedded technology?
Mitigations
Software fault injection countermeasures
• Double checks
• Random delays
• Flow counters
Can these be implemented easily for larger code bases?
Hardware fault injection countermeasures
• Redundancy
• Integrity
• Sensors and detectors
Are these implemented for standard embedded technology?
Is this all?
There are more attack vectors!
Controlling PC directly2
• ARM (AArch32) has an interesting ISA characteristic
• The program counter (PC) register is directly accessible
Several valid ARM instructions
MOV r7,r1 00000001 01110000 10100000 11100001
EOR r0,r1 00000001 00000000 00100000 11100000
LDR r0,[r1] 00000000 00000000 10010001 11100101
LDMIA r0,{r1} 00000010 00000000 10010000 11101000
Several corrupted ARM instructions setting PC directly
MOV pc,r1 00000001 11110000 10100000 11100001
EOR pc,r1 00000001 11110000 00101111 11100000
LDR pc,[r1] 00000000 11110000 10010001 11100101
LDMIA r0,{r1, pc} 00000010 10000000 10010000 11101000
Variations of this attack affect other architectures!
2
Controlling PC on ARM using Fault Injection – Timmers et al. (FDTC2016)
Controlling PC directly2
• ARM (AArch32) has an interesting ISA characteristic
• The program counter (PC) register is directly accessible
Several valid ARM instructions
MOV r7,r1 00000001 01110000 10100000 11100001
EOR r0,r1 00000001 00000000 00100000 11100000
LDR r0,[r1] 00000000 00000000 10010001 11100101
LDMIA r0,{r1} 00000010 00000000 10010000 11101000
Several corrupted ARM instructions setting PC directly
MOV pc,r1 00000001 11110000 10100000 11100001
EOR pc,r1 00000001 11110000 00101111 11100000
LDR pc,[r1] 00000000 11110000 10010001 11100101
LDMIA r0,{r1, pc} 00000010 10000000 10010000 11101000
Variations of this attack affect other architectures!
2
Controlling PC on ARM using Fault Injection – Timmers et al. (FDTC2016)
Controlling PC directly2
• ARM (AArch32) has an interesting ISA characteristic
• The program counter (PC) register is directly accessible
Several valid ARM instructions
MOV r7,r1 00000001 01110000 10100000 11100001
EOR r0,r1 00000001 00000000 00100000 11100000
LDR r0,[r1] 00000000 00000000 10010001 11100101
LDMIA r0,{r1} 00000010 00000000 10010000 11101000
Several corrupted ARM instructions setting PC directly
MOV pc,r1 00000001 11110000 10100000 11100001
EOR pc,r1 00000001 11110000 00101111 11100000
LDR pc,[r1] 00000000 11110000 10010001 11100101
LDMIA r0,{r1, pc} 00000010 10000000 10010000 11101000
Variations of this attack affect other architectures!
2
Controlling PC on ARM using Fault Injection – Timmers et al. (FDTC2016)
Controlling PC directly2
• ARM (AArch32) has an interesting ISA characteristic
• The program counter (PC) register is directly accessible
Several valid ARM instructions
MOV r7,r1 00000001 01110000 10100000 11100001
EOR r0,r1 00000001 00000000 00100000 11100000
LDR r0,[r1] 00000000 00000000 10010001 11100101
LDMIA r0,{r1} 00000010 00000000 10010000 11101000
Several corrupted ARM instructions setting PC directly
MOV pc,r1 00000001 11110000 10100000 11100001
EOR pc,r1 00000001 11110000 00101111 11100000
LDR pc,[r1] 00000000 11110000 10010001 11100101
LDMIA r0,{r1, pc} 00000010 10000000 10010000 11101000
Variations of this attack affect other architectures!
2
Controlling PC on ARM using Fault Injection – Timmers et al. (FDTC2016)
Controlling PC directly – Description
(1) Set all registers to an arbitrary value (e.g. 0x41414141)
(2) Execute random Linux system calls
(3) Load the arbitrary value into the PC register using a glitch
Controlling PC directly – Code
Algorithm 3 Linux user space code
1: r0 ← r1 ← r2 ← 0x41414141
2: r3 ← r4 ← r5 ← 0x41414141
3: r6 ← r7 ← r8 ← 0x41414141
4: r9 ← r10 ← r11 ← 0x41414141
5: r7 ← getRandom()
6: svc #0
Remarks
• Implemented using ARM assembly
• Linux syscall: initially random
• Found to be vulnerable: sys getgroups and sys prctl
Controlling PC directly – Successful
Unable to handle kernel paging request at virtual addr 41414140
pgd = 5db7c000..[41414140] *pgd=0141141e(bad)
Internal error: Oops - BUG: 8000000d [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 1280 Comm: control-pc Not tainted <redacted> #1
task: 5d9089c0 ti: 5daa0000 task.ti: 5daa0000
PC is at 0x41414140
LR is at SyS_prctl+0x38/0x404
pc : 41414140 lr : 4002ef14 psr: 60000033
sp : 5daa1fe0 ip : 18c5387d fp : 41414141
r10: 41414141 r9 : 41414141 r8 : 41414141
r7 : 000000ac r6 : 41414141 r5 : 41414141 r4 : 41414141
r3 : 41414141 r2 : 5d9089c0 r1 : 5daa1fa0 r0 : ffffffea
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA Thumb Segment user
Control: 18c5387d Table: 1db7c04a DAC: 00000015
Process control-pc (pid: 1280, stack limit = 0x5daa0238)
Stack: (0x5daa1fe0 to 0x5daa2000)
Controlling PC directly – Results
Remarks
• We took 12705 experiments in 14 hours
• The success rate between 2.2 µs and 2.65 µs is: 0.63%
• We load a controlled value in PC every 10 minutes !
Privilege escalation #3
What is so special about this attack?
• Load an arbitrary value in any register
• We do not need to have access to source code
• The control flow is fully hijacked
• Software under full control of the attacker
Software fault injection countermeasures are ineffective!
What is so special about this attack?
• Load an arbitrary value in any register
• We do not need to have access to source code
• The control flow is fully hijacked
• Software under full control of the attacker
Software fault injection countermeasures are ineffective!
What can be done about it?
• Fault injection resistant hardware
• Software exploitation mitigations
• Make assets inaccessible from software
Exploitation must be made hard!
What can be done about it?
• Fault injection resistant hardware
• Software exploitation mitigations
• Make assets inaccessible from software
Exploitation must be made hard!
Conclusion
• Fault injection is an effective method to compromise Linux
• All attacks are identified and reproduced within a day
• Full code execution can be reliably achieved
• A new fault injection attack vector discussed
• Exploit mitigations becoming fundamental for fault injection
• Fault injection may be cheaper than software exploitation
Any questions?
Niek Timmers
timmers@riscure.com
(@tieknimmers)
Cristofaro Mune
c.mune@pulse-sec.com
(@pulsoid)
www.riscure.com/careers
inforequest@riscure.com

More Related Content

What's hot

Infecting the Embedded Supply Chain
 Infecting the Embedded Supply Chain Infecting the Embedded Supply Chain
Infecting the Embedded Supply Chain
Priyanka Aash
 
Exploiting Modern Microarchitectures: Meltdown, Spectre, and other Attacks
Exploiting Modern Microarchitectures: Meltdown, Spectre, and other AttacksExploiting Modern Microarchitectures: Meltdown, Spectre, and other Attacks
Exploiting Modern Microarchitectures: Meltdown, Spectre, and other Attacks
inside-BigData.com
 
Controlling PC on ARM using Fault Injection
Controlling PC on ARM using Fault InjectionControlling PC on ARM using Fault Injection
Controlling PC on ARM using Fault Injection
Riscure
 
Unix signals
Unix signalsUnix signals
Unix signals
Isaac George
 
ShinoBOT Suite
ShinoBOT SuiteShinoBOT Suite
ShinoBOT Suite
Shota Shinogi
 
Meltdown and Spectre
Meltdown and SpectreMeltdown and Spectre
Meltdown and Spectre
yeokm1
 
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
CODE BLUE
 
Demystifying Secure enclave processor
Demystifying Secure enclave processorDemystifying Secure enclave processor
Demystifying Secure enclave processor
Priyanka Aash
 
Let's write a Debugger!
Let's write a Debugger!Let's write a Debugger!
Let's write a Debugger!
Levente Kurusa
 
Meltdown & Spectre attacks
Meltdown & Spectre attacksMeltdown & Spectre attacks
Meltdown & Spectre attacks
Marian Marinov
 
IEEE Std 1581 VTS 2011 slides
IEEE Std 1581   VTS 2011 slidesIEEE Std 1581   VTS 2011 slides
IEEE Std 1581 VTS 2011 slides
GOEPEL Electronics
 
Armadillos - or how to bypass code readout protection on microcontrollers
Armadillos - or how to bypass code readout protection on microcontrollersArmadillos - or how to bypass code readout protection on microcontrollers
Armadillos - or how to bypass code readout protection on microcontrollers
Andrew Tierney
 
Practical Differential Fault Attack on AES
Practical Differential Fault Attack on AESPractical Differential Fault Attack on AES
Practical Differential Fault Attack on AES
Riscure
 
Jtagppt
JtagpptJtagppt
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CanSecWest
 
ARM exceptions and interrupt controls
ARM exceptions and interrupt controlsARM exceptions and interrupt controls
ARM exceptions and interrupt controls
Mahima Shastri
 
Interrupts
InterruptsInterrupts
A Comprehensive Implementation and Evaluation of Direct Interrupt Delivery
A Comprehensive Implementation and Evaluation of Direct Interrupt DeliveryA Comprehensive Implementation and Evaluation of Direct Interrupt Delivery
A Comprehensive Implementation and Evaluation of Direct Interrupt Delivery
Cheng-Chun William Tu
 
Auditing the Opensource Kernels
Auditing the Opensource KernelsAuditing the Opensource Kernels
Auditing the Opensource Kernels
Silvio Cesare
 
Jtag presentation
Jtag presentationJtag presentation
Jtag presentation
klinetik
 

What's hot (20)

Infecting the Embedded Supply Chain
 Infecting the Embedded Supply Chain Infecting the Embedded Supply Chain
Infecting the Embedded Supply Chain
 
Exploiting Modern Microarchitectures: Meltdown, Spectre, and other Attacks
Exploiting Modern Microarchitectures: Meltdown, Spectre, and other AttacksExploiting Modern Microarchitectures: Meltdown, Spectre, and other Attacks
Exploiting Modern Microarchitectures: Meltdown, Spectre, and other Attacks
 
Controlling PC on ARM using Fault Injection
Controlling PC on ARM using Fault InjectionControlling PC on ARM using Fault Injection
Controlling PC on ARM using Fault Injection
 
Unix signals
Unix signalsUnix signals
Unix signals
 
ShinoBOT Suite
ShinoBOT SuiteShinoBOT Suite
ShinoBOT Suite
 
Meltdown and Spectre
Meltdown and SpectreMeltdown and Spectre
Meltdown and Spectre
 
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
 
Demystifying Secure enclave processor
Demystifying Secure enclave processorDemystifying Secure enclave processor
Demystifying Secure enclave processor
 
Let's write a Debugger!
Let's write a Debugger!Let's write a Debugger!
Let's write a Debugger!
 
Meltdown & Spectre attacks
Meltdown & Spectre attacksMeltdown & Spectre attacks
Meltdown & Spectre attacks
 
IEEE Std 1581 VTS 2011 slides
IEEE Std 1581   VTS 2011 slidesIEEE Std 1581   VTS 2011 slides
IEEE Std 1581 VTS 2011 slides
 
Armadillos - or how to bypass code readout protection on microcontrollers
Armadillos - or how to bypass code readout protection on microcontrollersArmadillos - or how to bypass code readout protection on microcontrollers
Armadillos - or how to bypass code readout protection on microcontrollers
 
Practical Differential Fault Attack on AES
Practical Differential Fault Attack on AESPractical Differential Fault Attack on AES
Practical Differential Fault Attack on AES
 
Jtagppt
JtagpptJtagppt
Jtagppt
 
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
 
ARM exceptions and interrupt controls
ARM exceptions and interrupt controlsARM exceptions and interrupt controls
ARM exceptions and interrupt controls
 
Interrupts
InterruptsInterrupts
Interrupts
 
A Comprehensive Implementation and Evaluation of Direct Interrupt Delivery
A Comprehensive Implementation and Evaluation of Direct Interrupt DeliveryA Comprehensive Implementation and Evaluation of Direct Interrupt Delivery
A Comprehensive Implementation and Evaluation of Direct Interrupt Delivery
 
Auditing the Opensource Kernels
Auditing the Opensource KernelsAuditing the Opensource Kernels
Auditing the Opensource Kernels
 
Jtag presentation
Jtag presentationJtag presentation
Jtag presentation
 

Similar to Escalating Privileges in Linux using Fault Injection - FDTC 2017

How Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsHow Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protections
Jonathan Salwan
 
Xvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisorXvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisor
National Cheng Kung University
 
AAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced FeaturesAAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced Features
Anh Dung NGUYEN
 
Embedded system - Introduction To ARM Exception Handling and Software Interru...
Embedded system - Introduction To ARM Exception Handling andSoftware Interru...Embedded system - Introduction To ARM Exception Handling andSoftware Interru...
Embedded system - Introduction To ARM Exception Handling and Software Interru...
Vibrant Technologies & Computers
 
Beneath the Linux Interrupt handling
Beneath the Linux Interrupt handlingBeneath the Linux Interrupt handling
Beneath the Linux Interrupt handling
Bhoomil Chavda
 
PVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications developmentPVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications development
OOO "Program Verification Systems"
 
Arm architecture
Arm architectureArm architecture
Arm architecture
MinYeop Na
 
Interrupts.ppt
Interrupts.pptInterrupts.ppt
Interrupts.ppt
SasiBhushan22
 
ESD_05_ARM_Instructions set for preparation
ESD_05_ARM_Instructions set for preparationESD_05_ARM_Instructions set for preparation
ESD_05_ARM_Instructions set for preparation
ssuser026e94
 
Issta11
Issta11Issta11
Issta11
regehr
 
Arm
ArmArm
Buffer overflow – Smashing The Stack
Buffer overflow – Smashing The StackBuffer overflow – Smashing The Stack
Buffer overflow – Smashing The Stack
Tomer Zait
 
ARMInst.ppt
ARMInst.pptARMInst.ppt
ARMInst.ppt
MostafaParvin1
 
ARMInst.ppt
ARMInst.pptARMInst.ppt
ARMInst.ppt
baskarA13
 
MKAD_black_V2
MKAD_black_V2MKAD_black_V2
MKAD_black_V2
Marina Krotofil
 
Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...
Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...
Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...
DefconRussia
 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software security
DefconRussia
 
OSMC 2014: Server Hardware Monitoring done right | Werner Fischer
OSMC 2014: Server Hardware Monitoring done right | Werner FischerOSMC 2014: Server Hardware Monitoring done right | Werner Fischer
OSMC 2014: Server Hardware Monitoring done right | Werner Fischer
NETWAYS
 
Embedded systems and robotics by scmandota
Embedded systems and robotics by scmandotaEmbedded systems and robotics by scmandota
Embedded systems and robotics by scmandota
scmandota
 
Lect02
Lect02Lect02
Lect02
Vin Voro
 

Similar to Escalating Privileges in Linux using Fault Injection - FDTC 2017 (20)

How Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsHow Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protections
 
Xvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisorXvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisor
 
AAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced FeaturesAAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced Features
 
Embedded system - Introduction To ARM Exception Handling and Software Interru...
Embedded system - Introduction To ARM Exception Handling andSoftware Interru...Embedded system - Introduction To ARM Exception Handling andSoftware Interru...
Embedded system - Introduction To ARM Exception Handling and Software Interru...
 
Beneath the Linux Interrupt handling
Beneath the Linux Interrupt handlingBeneath the Linux Interrupt handling
Beneath the Linux Interrupt handling
 
PVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications developmentPVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications development
 
Arm architecture
Arm architectureArm architecture
Arm architecture
 
Interrupts.ppt
Interrupts.pptInterrupts.ppt
Interrupts.ppt
 
ESD_05_ARM_Instructions set for preparation
ESD_05_ARM_Instructions set for preparationESD_05_ARM_Instructions set for preparation
ESD_05_ARM_Instructions set for preparation
 
Issta11
Issta11Issta11
Issta11
 
Arm
ArmArm
Arm
 
Buffer overflow – Smashing The Stack
Buffer overflow – Smashing The StackBuffer overflow – Smashing The Stack
Buffer overflow – Smashing The Stack
 
ARMInst.ppt
ARMInst.pptARMInst.ppt
ARMInst.ppt
 
ARMInst.ppt
ARMInst.pptARMInst.ppt
ARMInst.ppt
 
MKAD_black_V2
MKAD_black_V2MKAD_black_V2
MKAD_black_V2
 
Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...
Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...
Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...
 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software security
 
OSMC 2014: Server Hardware Monitoring done right | Werner Fischer
OSMC 2014: Server Hardware Monitoring done right | Werner FischerOSMC 2014: Server Hardware Monitoring done right | Werner Fischer
OSMC 2014: Server Hardware Monitoring done right | Werner Fischer
 
Embedded systems and robotics by scmandota
Embedded systems and robotics by scmandotaEmbedded systems and robotics by scmandota
Embedded systems and robotics by scmandota
 
Lect02
Lect02Lect02
Lect02
 

Recently uploaded

按照学校原版(UPenn文凭证书)宾夕法尼亚大学毕业证快速办理
按照学校原版(UPenn文凭证书)宾夕法尼亚大学毕业证快速办理按照学校原版(UPenn文凭证书)宾夕法尼亚大学毕业证快速办理
按照学校原版(UPenn文凭证书)宾夕法尼亚大学毕业证快速办理
uwoso
 
一比一原版(UOL文凭证书)利物浦大学毕业证如何办理
一比一原版(UOL文凭证书)利物浦大学毕业证如何办理一比一原版(UOL文凭证书)利物浦大学毕业证如何办理
一比一原版(UOL文凭证书)利物浦大学毕业证如何办理
eydeofo
 
按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理
按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理
按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理
snfdnzl7
 
按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理
按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理
按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理
terpt4iu
 
一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理
一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理
一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理
nudduv
 
按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理
按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理
按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理
terpt4iu
 
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalRBuilding a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR
Peter Gallagher
 
按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理
按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理
按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理
uyesp1a
 
按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理
按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理
按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理
yizxn4sx
 
SOLIDWORKS 2024 Enhancements eBook.pdf for beginners
SOLIDWORKS 2024 Enhancements eBook.pdf for beginnersSOLIDWORKS 2024 Enhancements eBook.pdf for beginners
SOLIDWORKS 2024 Enhancements eBook.pdf for beginners
SethiLilu
 
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
xuqdabu
 
按照学校原版(SUT文凭证书)斯威本科技大学毕业证快速办理
按照学校原版(SUT文凭证书)斯威本科技大学毕业证快速办理按照学校原版(SUT文凭证书)斯威本科技大学毕业证快速办理
按照学校原版(SUT文凭证书)斯威本科技大学毕业证快速办理
1jtj7yul
 
按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理
按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理
按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理
1jtj7yul
 
Production.pptxd dddddddddddddddddddddddddddddddddd
Production.pptxd ddddddddddddddddddddddddddddddddddProduction.pptxd dddddddddddddddddddddddddddddddddd
Production.pptxd dddddddddddddddddddddddddddddddddd
DanielOliver74
 
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
nudduv
 
1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样
1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样
1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样
2g3om49r
 
一比一原版(TheAuckland毕业证书)新西兰奥克兰大学毕业证如何办理
一比一原版(TheAuckland毕业证书)新西兰奥克兰大学毕业证如何办理一比一原版(TheAuckland毕业证书)新西兰奥克兰大学毕业证如何办理
一比一原版(TheAuckland毕业证书)新西兰奥克兰大学毕业证如何办理
xuqdabu
 
按照学校原版(QU文凭证书)皇后大学毕业证快速办理
按照学校原版(QU文凭证书)皇后大学毕业证快速办理按照学校原版(QU文凭证书)皇后大学毕业证快速办理
按照学校原版(QU文凭证书)皇后大学毕业证快速办理
8db3cz8x
 
买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样
买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样
买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样
nvoyobt
 
加急办理美国南加州大学毕业证文凭毕业证原版一模一样
加急办理美国南加州大学毕业证文凭毕业证原版一模一样加急办理美国南加州大学毕业证文凭毕业证原版一模一样
加急办理美国南加州大学毕业证文凭毕业证原版一模一样
u0g33km
 

Recently uploaded (20)

按照学校原版(UPenn文凭证书)宾夕法尼亚大学毕业证快速办理
按照学校原版(UPenn文凭证书)宾夕法尼亚大学毕业证快速办理按照学校原版(UPenn文凭证书)宾夕法尼亚大学毕业证快速办理
按照学校原版(UPenn文凭证书)宾夕法尼亚大学毕业证快速办理
 
一比一原版(UOL文凭证书)利物浦大学毕业证如何办理
一比一原版(UOL文凭证书)利物浦大学毕业证如何办理一比一原版(UOL文凭证书)利物浦大学毕业证如何办理
一比一原版(UOL文凭证书)利物浦大学毕业证如何办理
 
按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理
按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理
按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理
 
按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理
按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理
按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理
 
一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理
一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理
一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理
 
按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理
按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理
按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理
 
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalRBuilding a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR
 
按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理
按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理
按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理
 
按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理
按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理
按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理
 
SOLIDWORKS 2024 Enhancements eBook.pdf for beginners
SOLIDWORKS 2024 Enhancements eBook.pdf for beginnersSOLIDWORKS 2024 Enhancements eBook.pdf for beginners
SOLIDWORKS 2024 Enhancements eBook.pdf for beginners
 
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
 
按照学校原版(SUT文凭证书)斯威本科技大学毕业证快速办理
按照学校原版(SUT文凭证书)斯威本科技大学毕业证快速办理按照学校原版(SUT文凭证书)斯威本科技大学毕业证快速办理
按照学校原版(SUT文凭证书)斯威本科技大学毕业证快速办理
 
按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理
按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理
按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理
 
Production.pptxd dddddddddddddddddddddddddddddddddd
Production.pptxd ddddddddddddddddddddddddddddddddddProduction.pptxd dddddddddddddddddddddddddddddddddd
Production.pptxd dddddddddddddddddddddddddddddddddd
 
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
 
1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样
1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样
1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样
 
一比一原版(TheAuckland毕业证书)新西兰奥克兰大学毕业证如何办理
一比一原版(TheAuckland毕业证书)新西兰奥克兰大学毕业证如何办理一比一原版(TheAuckland毕业证书)新西兰奥克兰大学毕业证如何办理
一比一原版(TheAuckland毕业证书)新西兰奥克兰大学毕业证如何办理
 
按照学校原版(QU文凭证书)皇后大学毕业证快速办理
按照学校原版(QU文凭证书)皇后大学毕业证快速办理按照学校原版(QU文凭证书)皇后大学毕业证快速办理
按照学校原版(QU文凭证书)皇后大学毕业证快速办理
 
买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样
买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样
买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样
 
加急办理美国南加州大学毕业证文凭毕业证原版一模一样
加急办理美国南加州大学毕业证文凭毕业证原版一模一样加急办理美国南加州大学毕业证文凭毕业证原版一模一样
加急办理美国南加州大学毕业证文凭毕业证原版一模一样
 

Escalating Privileges in Linux using Fault Injection - FDTC 2017

  • 1. Escalating Privileges in Linux using Fault Injection Niek Timmers timmers@riscure.com (@tieknimmers) Cristofaro Mune c.mune@pulse-sec.com (@pulsoid) September 25, 2017
  • 2. Fault Injection – A definition... ”Introducing faults in a target to alter its intended behavior.” ... if( key_is_correct ) <-- Glitch here! { open_door(); } else { keep_door_closed(); } ... How can we introduce these faults?
  • 3. Fault injection techniques clock voltage e-magnetic laser We used Voltage Fault Injection for all experiments!
  • 4. Fault injection techniques clock voltage e-magnetic laser We used Voltage Fault Injection for all experiments!
  • 5. Fault injection fault model Let’s keep it simple: instruction corruption Single-bit (MIPS) addi $t1, $t1, 8 00100001001010010000000000001000 addi $t1, $t1, 0 00100001001010010000000000000000 Multi-bit (ARM) ldr w1, [sp, #0x8] 10111001010000000000101111100001 str w7, [sp, #0x20] 10111001000000000010001111100111 Remarks • Limited control over which bit(s) will be corrupted • May or may not be the true fault model • Includes other fault models (e.g. instruction skipping)
  • 7. Fault injection setup Target • Fast and feature rich System-on-Chip (SoC) • ARM Cortex-A9 (32-bit) • Ubuntu 14.04 LTS (fully patched)
  • 8. Characterization • Determine if the target is vulnerable to fault injection • Determine if the fault injection setup is effective • Estimate required fault injection parameters for an attack • An open target is required; but not required for an attack
  • 10. Characterization – Alter a loop . . . set_trigger(1); for(i = 0; i < 10000; i++) { // glitch here j++; // glitch here } // glitch here set_trigger(0); . . . Remarks • Implemented in a Linux Kernel Module (LKM) • Successful glitches are not that time dependent
  • 11. Characterization – Possible responses Expected: ’glitch is too soft’ counter = 00010000 Mute/Reset: ’glitch is too hard’ counter = Success: ’glitch is exactly right’ counter = 00009999 counter = 00010015 counter = 00008687
  • 12. Characterization – Alter a loop Remarks • We took 16428 experiments in 65 hours • We randomize the Glitch VCC Glitch Length Glitch Delay • We can fix either the Glitch VCC or the Glitch Length
  • 13. Characterization – Bypassing a check . . . set_trigger(1); if(cmd.cmdid < 0 || cmd.cmdid > 10) { return -1; } if(cmd.length > 0x100) { // glitch here return -1; // glitch here } // glitch here set_trigger(0); . . . Remarks • Implemented in a Linux Kernel Module (LKM) • Successful glitches are time dependent
  • 14. Characterization – Bypassing a check Remarks • We took 16315 experiments in 19 hours • The success rate between 6.2 µs and 6.8 µs is: 0.41% • The check is bypassed every 15 minutes !
  • 15. Let’s attack Linux! Relevant when vulnerabilities are not known!
  • 17. Opening /dev/mem – Description (1) Open /dev/mem using open syscall (2) Bypass check performed by Linux kernel using a glitch (3) Map arbitrary address in physical address space
  • 18. Opening /dev/mem – Code Algorithm 1 Open /dev/mem 1: r1 ← 2 2: r0 ← ”/dev/mem” 3: r7 ← 0x5 4: svc #0 5: if r0 == 3 then 6: address ← mmap(...) 7: printf(∗address) 8: end if Remarks • Implemented using ARM assembly • Linux syscall: sys open (0x5)
  • 19. Opening /dev/mem – Results Remarks • We took 22118 experiments in 17 hours • The success rate between 25.5 µs and 26.8 µs is: 0.53% • The Linux kernel is compromised every 10 minutes !
  • 21. Spawning a root shell – Description (1) Set all registers to 0 to increase the probability1 (2) Perform setresuid syscall to set process IDs to root (3) Bypass check performed by Linux kernel using a glitch (4) Execute root shell using system function 1 Linux uses 0 for valid return values
  • 22. Spawning a root shell – Code Algorithm 2 Executing a root shell 1: r0 ← r1 ← r2 ← 0 2: r3 ← r4 ← r5 ← 0 3: r6 ← r7 ← r8 ← 0 4: r9 ← r10 ← r11 ← 0 5: r7 ← 0xd0 6: svc #0 7: if r0 == 0 then 8: system(”/bin/sh”) 9: end if Remarks • Implemented using ARM assembly • Linux syscall: sys setresuid (0xd0)
  • 23. Spawning a root shell – Results Remarks • We took 18968 experiments in 21 hours • The success rate between 3.14 µs and 3.44 µs is: 1.3% • We spawn a root shell every 5 minutes !
  • 25. Reflection • Linux checks can be (easily) bypassed using fault injection • Attacks are identified and reproduced within a day • Full fault injection attack surface not explored Can we mitigate these type of attacks?
  • 26. Reflection • Linux checks can be (easily) bypassed using fault injection • Attacks are identified and reproduced within a day • Full fault injection attack surface not explored Can we mitigate these type of attacks?
  • 27. Mitigations Software fault injection countermeasures • Double checks • Random delays • Flow counters Can these be implemented easily for larger code bases? Hardware fault injection countermeasures • Redundancy • Integrity • Sensors and detectors Are these implemented for standard embedded technology?
  • 28. Mitigations Software fault injection countermeasures • Double checks • Random delays • Flow counters Can these be implemented easily for larger code bases? Hardware fault injection countermeasures • Redundancy • Integrity • Sensors and detectors Are these implemented for standard embedded technology?
  • 29. Mitigations Software fault injection countermeasures • Double checks • Random delays • Flow counters Can these be implemented easily for larger code bases? Hardware fault injection countermeasures • Redundancy • Integrity • Sensors and detectors Are these implemented for standard embedded technology?
  • 30. Mitigations Software fault injection countermeasures • Double checks • Random delays • Flow counters Can these be implemented easily for larger code bases? Hardware fault injection countermeasures • Redundancy • Integrity • Sensors and detectors Are these implemented for standard embedded technology?
  • 32. There are more attack vectors!
  • 33. Controlling PC directly2 • ARM (AArch32) has an interesting ISA characteristic • The program counter (PC) register is directly accessible Several valid ARM instructions MOV r7,r1 00000001 01110000 10100000 11100001 EOR r0,r1 00000001 00000000 00100000 11100000 LDR r0,[r1] 00000000 00000000 10010001 11100101 LDMIA r0,{r1} 00000010 00000000 10010000 11101000 Several corrupted ARM instructions setting PC directly MOV pc,r1 00000001 11110000 10100000 11100001 EOR pc,r1 00000001 11110000 00101111 11100000 LDR pc,[r1] 00000000 11110000 10010001 11100101 LDMIA r0,{r1, pc} 00000010 10000000 10010000 11101000 Variations of this attack affect other architectures! 2 Controlling PC on ARM using Fault Injection – Timmers et al. (FDTC2016)
  • 34. Controlling PC directly2 • ARM (AArch32) has an interesting ISA characteristic • The program counter (PC) register is directly accessible Several valid ARM instructions MOV r7,r1 00000001 01110000 10100000 11100001 EOR r0,r1 00000001 00000000 00100000 11100000 LDR r0,[r1] 00000000 00000000 10010001 11100101 LDMIA r0,{r1} 00000010 00000000 10010000 11101000 Several corrupted ARM instructions setting PC directly MOV pc,r1 00000001 11110000 10100000 11100001 EOR pc,r1 00000001 11110000 00101111 11100000 LDR pc,[r1] 00000000 11110000 10010001 11100101 LDMIA r0,{r1, pc} 00000010 10000000 10010000 11101000 Variations of this attack affect other architectures! 2 Controlling PC on ARM using Fault Injection – Timmers et al. (FDTC2016)
  • 35. Controlling PC directly2 • ARM (AArch32) has an interesting ISA characteristic • The program counter (PC) register is directly accessible Several valid ARM instructions MOV r7,r1 00000001 01110000 10100000 11100001 EOR r0,r1 00000001 00000000 00100000 11100000 LDR r0,[r1] 00000000 00000000 10010001 11100101 LDMIA r0,{r1} 00000010 00000000 10010000 11101000 Several corrupted ARM instructions setting PC directly MOV pc,r1 00000001 11110000 10100000 11100001 EOR pc,r1 00000001 11110000 00101111 11100000 LDR pc,[r1] 00000000 11110000 10010001 11100101 LDMIA r0,{r1, pc} 00000010 10000000 10010000 11101000 Variations of this attack affect other architectures! 2 Controlling PC on ARM using Fault Injection – Timmers et al. (FDTC2016)
  • 36. Controlling PC directly2 • ARM (AArch32) has an interesting ISA characteristic • The program counter (PC) register is directly accessible Several valid ARM instructions MOV r7,r1 00000001 01110000 10100000 11100001 EOR r0,r1 00000001 00000000 00100000 11100000 LDR r0,[r1] 00000000 00000000 10010001 11100101 LDMIA r0,{r1} 00000010 00000000 10010000 11101000 Several corrupted ARM instructions setting PC directly MOV pc,r1 00000001 11110000 10100000 11100001 EOR pc,r1 00000001 11110000 00101111 11100000 LDR pc,[r1] 00000000 11110000 10010001 11100101 LDMIA r0,{r1, pc} 00000010 10000000 10010000 11101000 Variations of this attack affect other architectures! 2 Controlling PC on ARM using Fault Injection – Timmers et al. (FDTC2016)
  • 37. Controlling PC directly – Description (1) Set all registers to an arbitrary value (e.g. 0x41414141) (2) Execute random Linux system calls (3) Load the arbitrary value into the PC register using a glitch
  • 38. Controlling PC directly – Code Algorithm 3 Linux user space code 1: r0 ← r1 ← r2 ← 0x41414141 2: r3 ← r4 ← r5 ← 0x41414141 3: r6 ← r7 ← r8 ← 0x41414141 4: r9 ← r10 ← r11 ← 0x41414141 5: r7 ← getRandom() 6: svc #0 Remarks • Implemented using ARM assembly • Linux syscall: initially random • Found to be vulnerable: sys getgroups and sys prctl
  • 39. Controlling PC directly – Successful Unable to handle kernel paging request at virtual addr 41414140 pgd = 5db7c000..[41414140] *pgd=0141141e(bad) Internal error: Oops - BUG: 8000000d [#1] PREEMPT SMP ARM Modules linked in: CPU: 0 PID: 1280 Comm: control-pc Not tainted <redacted> #1 task: 5d9089c0 ti: 5daa0000 task.ti: 5daa0000 PC is at 0x41414140 LR is at SyS_prctl+0x38/0x404 pc : 41414140 lr : 4002ef14 psr: 60000033 sp : 5daa1fe0 ip : 18c5387d fp : 41414141 r10: 41414141 r9 : 41414141 r8 : 41414141 r7 : 000000ac r6 : 41414141 r5 : 41414141 r4 : 41414141 r3 : 41414141 r2 : 5d9089c0 r1 : 5daa1fa0 r0 : ffffffea Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA Thumb Segment user Control: 18c5387d Table: 1db7c04a DAC: 00000015 Process control-pc (pid: 1280, stack limit = 0x5daa0238) Stack: (0x5daa1fe0 to 0x5daa2000)
  • 40. Controlling PC directly – Results Remarks • We took 12705 experiments in 14 hours • The success rate between 2.2 µs and 2.65 µs is: 0.63% • We load a controlled value in PC every 10 minutes !
  • 42. What is so special about this attack? • Load an arbitrary value in any register • We do not need to have access to source code • The control flow is fully hijacked • Software under full control of the attacker Software fault injection countermeasures are ineffective!
  • 43. What is so special about this attack? • Load an arbitrary value in any register • We do not need to have access to source code • The control flow is fully hijacked • Software under full control of the attacker Software fault injection countermeasures are ineffective!
  • 44. What can be done about it? • Fault injection resistant hardware • Software exploitation mitigations • Make assets inaccessible from software Exploitation must be made hard!
  • 45. What can be done about it? • Fault injection resistant hardware • Software exploitation mitigations • Make assets inaccessible from software Exploitation must be made hard!
  • 46. Conclusion • Fault injection is an effective method to compromise Linux • All attacks are identified and reproduced within a day • Full code execution can be reliably achieved • A new fault injection attack vector discussed • Exploit mitigations becoming fundamental for fault injection • Fault injection may be cheaper than software exploitation
  • 47. Any questions? Niek Timmers timmers@riscure.com (@tieknimmers) Cristofaro Mune c.mune@pulse-sec.com (@pulsoid) www.riscure.com/careers inforequest@riscure.com