Efficient Formally Secure Compilers to a Tagged Architecture
Cătălin Hrițcu
Inria Paris Prosecco team
1
5 year vision ERC SECOMP: https://secure-compilation.github.io
to a Tagged Architecture C tlin Hricu Inria Paris Prosecco team 5 - - PowerPoint PPT Presentation
Efficient Formally Secure Compilers to a Tagged Architecture C tlin Hricu Inria Paris Prosecco team 5 year vision ERC SECOMP: https://secure-compilation.github.io 1 Computers are insecure devastating low-level vulnerabilities
1
5 year vision ERC SECOMP: https://secure-compilation.github.io
– memory unsafe: any buffer overflow can be catastrophic allowing remote attackers to gain complete control
– even code written in safer languages has to interoperate with insecure low-level libraries – unsafe interoperability: high-level safety guarantees lost
2
– designed in an era of scarce hardware resources – too often trade off security for efficiency
– security matters, hardware resources abundant – time to revisit some tradeoffs
3
* “...the number of UNIX installations has grown to 10, with more expected...”
tpc’ tm3’
4
pc tpc r0 tr0 r1 tr1 mem[0] tm0
“store r0 r1”
tm1 mem[2] tm2 mem[3] tm3 tpc tr0 tr1 tm3 tm1
allow
tpc’ tm3’ tpc tr0 tr1 tm1 store software monitor’s decision is hardware cached software-defined, hardware-accelerated, tag-based monitoring
disallow policy violation stopped!
(e.g. out of bounds write) tm3 tm3
tm3
metadata, checked & propagated on each instruction
5
6
(in Coq)
(<10% runtime overhead) [Oakland’15] [POPL’14] [ASPLOS’15]
Way beyond MPX, SGX, SSM, etc
– Inria Paris: Cătălin Hrițcu, Guglielmo Fachini, Marco Stronati, Théo Laurent – UPenn: André DeHon, Benjamin Pierce, Arthur Azevedo de Amorim, Nick Roessler – Portland State: Andrew Tolmach – MIT: Howie Shrobe, Stelios Sidiroglou-Douskos – Industry: Draper Labs
DARPA CRASH/SAFE (2011-2014)
7
8
– C with protected components and memory safety
– ASM, C, and Low* [= safe C subset embedded in F* for verification]
9
(safe) high-level attacker low-level attacker source target compiler
Benefit: sound security reasoning in the source language
forget about compiler chain (linker, loader, runtime system) forget that libraries are written in a lower-level language
secure secure
program behavior program behavior compiler correctness
(e.g. CompCert)
holy grail of preserving security all the way down
secure compilation component component not enough no extra power protected e.g. arbitrary machine code
10
high-level attacker low-level attacker 1st high-level component 1st compiled component high-level attacker low-level attacker 2nd high-level component 2nd compiled component
high-level attacker
low-level attacker
compiler compiler
Problems: (1) very hard to realistically achieve (hopeless against timing side channels; more realistic: preservation of noninterference) (2) very difficult to prove …… (preservation of observational equivalence)
(adversarial context)
(relational/hyper properties)
– more robust to side channels
– stronger than (compositional) compiler correctness – weaker than full abstraction + compiler correctness
11
high-level attacker low-level attacker high-level component compiled component high-level attacker breaking π
low-level attacker breaking π
compiler
Advantages: easier to realistically achieve and prove still useful: preservation of invariants and other integrity properties
12
miTLS*
CompSec+ KremSec
memory safe C component
protecting component boundaries
legacy C component CompSec ASM component
Low* language
(safe C subset in F*)
C language
+ components + memory safety
ASM language
(RISC-V + micro-policies)
protecting higher-level abstractions
– interacting only via strictly enforced interfaces
– propagate interface information to produced binary
– component separation – type-safe procedure call and return discipline
– mutual distrust, unsafe source language
13
Ongoing work, started with Yannis Juglaret et al
ra
14
Jal r ...@Entry{ ,...} ... ... ... Load ⋆rm → ra Jump ra pc
memory C1 C2
... pc ra r rm
@n @(n+1) @Ret n registers
Store ra → ⋆rm pc ...
@(n+1) cross-component call
linear return capability stack level current color changed color increment loads and stores to the same component always allowed @Ret n
pc ra rm
@(n+1) invariant: at most one return capability per call stack level
pc ra rm
@(n+1) cross-component return only allowed via return capability [Towards a Fully Abstract Compiler Using Micro-Policies, Juglaret et al, TR 2015]
15
i1 i2 i3 i4 i5 C1 C2 C3 C4 C5 ↓ ↓ ↓ ↓ ↓ i1 i2 i3 i4 i5 C1 A2 C3 A4 A5 ∃ high-level attack from some fully defined A2, A4, A5
∀compromise scenarios s. ∀scenario-indexed trace properties π. [Beyond Good and Evil, Juglaret, Hritcu, et al, CSF’16] (more interesting compared to vanilla FA or RC) violates π(s) violates π(s)
∃ low-level attack from compromised C2↓, C4↓, C5↓ C1 and C3 fully defined
16
– some can be turned into contracts, checked dynamically; micro-policies can speed this up
– functional purity, termination, relational reasoning – push these limits further and combine with static analysis
– removing spurious dynamic checks – e.g. turn off pointer checking for a statically memory safe component that never sends or receives pointers
– allowing more safe behaviors – e.g. statically detect which copy of linear return capability the code will use to return – in this case unsound “static analysis” is fine
17
– one can’t verify an interesting compiler on paper
– more automation (e.g. based on SMT, like in F*) – integrate testing and proving (QuickChick and Luck)
– devising good proof techniques for secure compilation is a hot research topic of it’s own
18
– needed for vertical compiler composition – will put micro-policies in the hands of programmers
– micro-policies are interferent reference monitors – one micro-policy’s behavior can break another’s guarantees
19
for realistic programming languages (C and Low*)
– properties/attacker models, proof techniques – secure composition, micro-policies for C
+ testing and proving formally that this is the case
– building a community, looking for collaborators, and hiring to make some of this real
20
21
22
– Marco Stronati (PostDoc), Guglielmo Fachini and Théo Laurent (Interns) – Looking for excellent interns, students, researchers, and engineers
– UPenn, MIT, Portland State, Draper Labs
– Deepak Garg (MPI-SWS), Frank Piessens (KU Leuven), Amal Ahmed (Northeastern), Cedric Fournet & Nik Swamy (MSR), …
– 1st at Inria Paris in Aug. 2016, 2nd at POPL in Jan. 2017, POPL workshop – Upcoming: Dagstuhl seminar on Secure Compilation, May 2018 – build larger research community, identify open problems, bring together communities (HW, systems, security, PL, verification, ...)
– Fully abstract compilation and variants, robust compilation, noninterference preservation, ...
– reference monitors, secure hardware, static analysis, software rewriting, randomization, ...
– (bi)simulation, logical relations, multi-language semantics, embedded interpreters, ...
23