SKEE: A Lightweight Secure Kernel-level Execution Environment for ARM
.Isolation
First step
- Create a protected virtual address for SKEE
Second step
- Restrict the kernel access to the MMU.
정리
- kernel이 존재하는 memory translation tables를 변경하지 못하게, verify 되지 않은 table들을 사용하도록 MMU의 configuration들을 변경하지 못하게 막음
Secure Context Switching
Switching memory translation table의 원리와 동일
-> 그러나 해당 switching은 higher privilege level에서 일어나지만, SKEE의 경우에는 같은 privilege level에서 일어남.
격리를 유지하면서 switch 하기 위해서 새로운 기술 사용
- kernel이 isolated 된 환경으로 jump 하도록 switch gate를 지명하는 것.
- 해당 gate는 atomic
하고 deterministic
하게 설계됨.
- atomic
: 보호된 주소 공간에 접근 가능할 때 커널이 해당 공간에 대한 control을 얻지 못하도록 막기 위한 property
- deterministic
: SKEE로의 switching이 항상 지정된 entry point를 통과하고 적절한 security check 들을 통과하도록 요구하는 property
-> 이 두 개의 properties 들로 인해 SKEE의 주소 공간은 kernel에 노출되기 어렵다.
Kernel Monitoring and Protection
=> The Design
section includes how to achieve these.
SKEE : the number of CPU cycles required for switching to and from the isolated environment is in the range of few hundred cycles.
TrustZone : may reach up to thousands of CPU cycles.
=> Switching time to and from SKEE is much faster than switching time to and from the ARM TrustZone environment.
=> SKEE is not only lightweight, but can be also faster than TrustZone based systems.
SKEE : aimes at keeping these layers more secure through reducing thier code base and maintenance effort
TrustZone and virtualization extensions : designed to replace higher privileged layers.
TTBCR
(Translation Table Base Control Register), TTBR0
(Translation Table Base Register 0), TTBR1
(Translation Table Base Register 1)TTBR0
and TTBR1
point to different sets of memory translation tables.TTBCR
chooses which of the two sets is used when translating a particular memory address.TTBRC
contains a 3 bits called TTBRC.N
that determines the virtual address range translated by each of the two registers.TTBR1
translation is effected by TTBCR.N
's value.)The 64-bit virtual address range is split into two subranges.
- (1) which is translated using TTBR0
, is at the bottom of the address space. (User processes)
- (2) which is translated usint TTBR1
, is at the top of the address space. (virtual address space)
On ARMv8, the MMU control registers can be changed by MSR
instruction, which moves the value of general purpose registers to system management registers.
- MSR
instruction can use the Zero Register (XZR
) to move the value zero to any of the special registers.
S2
) address translation, which is pointed to by the vttbr
register.CONTEXTIDR
). TTBR0
를 사용하게 하고, TTBR1
은 SKEE가 독점적으로 사용함. TTBR0
과 TTBR1
은 같은 virtual address range를 mapping 함. -> 하나만 사용해도 충분하다!main goal
The main goal is to provide a lightweight execution environment to enable a security tool to run in isolation from the kernel without active involvement of higher privileged system components, such as TrustZone or virtualization layer.
SKEE는 secure boot sequence를 수정하여 커널과 SKEE를 위해 분리된 두 개의 address space를 만든다.
부팅 이후에 kernel을 이용한 potential attack이 존재하더라도 해당 attack들은 SKEE를 compromise 할 수 없음 (공간이 독립되어 있기 때문에). 그래서 SKEE에 의해서 host 되는 secure tool들은 kernel을 계속 모니터링 하고, 공격을 막을 수 있음.
physical address를 mapping 하고 있는 page table (memory tranlation table)이 없으면 kernel은 해당 physical address에 접근할 수 없음.
SKEE는 이를 이용하여 kernel이 특정 physical memory range에 접근할 수 없도록 two step solution 을 사용함
Creating a Protected Address Space
- kernel이 own code를 수정할 수 없게 하고, SKEE에 접근할 수 없게 해야 함 (3가지 rule 존재)
- removing all entries that map to either the SKEE environment or the kernel's memory translation tables
- mapping the kernel code and the SKEE switch gate as read-only
- restricting all other memory areas, including kernel data and user level memory, from executing privileged code using the PXN bit.
Restrict Kernel Access to the MMU
- kernel이 분리된 address space를 위반하지 않도록, 오직 instumented 된 page table만 사용해야 한다.
- 이는 특정 MMU register의 수정을 제한함으로써 목적 달성이 가능함. -> 특정 MMU register의 수정 제한 -> kernel이 translation table base register를 변경하는 것을 못하게 막음.
- SKEE는 kernel code에서 특정 instruction을 찾아서 제거하고, switch gate로 jump 하도록 후킹할 수 있음. (ARM이 고정된 사이즈의 instruction set을 사용하기 때문에 바이너리에서 특정 instruction을 찾는 것이 쉬움)