Spatial memory safety violation is still a major issue for C programs. Checked-C is a safe dialect of C and extends it with Checked pointer types and annotations that guarantee spatial memory safety in a backward-compatible manner, allowing the mix of checked pointers and regular (unchecked) pointer types. However, unchecked code vulnerabilities can violate the checked code's spatial safety guarantees. We present CheckedCBox, which adds a flexible, type-directed program partitioning mechanism to Checked-C, by enhancing the Checked-C type system with tainted types that enable flexible partitioning of the program into checked and unchecked regions, in a manner such that unchecked region code does not affect the spatial safety in the checked region. We formalize our type system and prove the non-crashing and non-exposure properties of a well-typed CheckedCBox program. We implemented CheckedCBox in a configurable manner, which enables us to use existing sandbox mechanisms (eg WebAssembly) to execute programs. Consequently, in doing so, CheckedCBox has prevented four known vulnerabilities by efficiently partitioning the program.
翻译:对 C 程序来说, 空间内存安全仍然是一个主要问题。 检查到 C 是 C 的安全方言, 并用检查到的指针类型和说明扩展到 C, 从而以与后向兼容的方式保证空间内存安全, 允许将检查点和常规( 未检查) 指针类型混合。 然而, 未检查的代码脆弱性可能违反检查到的代码的空间安全保障。 我们以可配置的方式实施了检查到 C, 从而增加了一个灵活、 类型引导的程序分割机制, 用于检查到 C, 其方式是用污染类型加强检查到的 C 系统, 使得程序能灵活分割到检查到未检查和未检查的地区, 而不受检查的区域代码不会影响检查到区域的空间安全 。 我们正式确定我们的类型系统, 并证明一个类型精密的检查到 CB 程序的非崩溃和非接触特性 。 我们以可配置的方式实施了检查到 CB, 这使得我们能够使用现有的沙箱机制( ewebRema) 来执行程序。 因此, 检查到 CBox 已经防止了四个已知的脆弱性 。