Skip to main content
QUICK REVIEW

[论文解读] Programmable System Call Security with eBPF

Jinghao Jia, Zhu Yi-fei|arXiv (Cornell University)|Feb 20, 2023
Security and Verification in ComputingComputer Science被引用 14
一句话总结

本文提出 Seccomp-eBPF,一种可编程的系统调用过滤方法,将 Seccomp 与 eBPF 集成,能够实现有状态、表达能力强、同步且对用户内存访问安全的策略,相较传统的 Seccomp-cBPF 和 Notifier 在安全性和性能上有所提升。

ABSTRACT

System call filtering is a widely used security mechanism for protecting a shared OS kernel against untrusted user applications. However, existing system call filtering techniques either are too expensive due to the context switch overhead imposed by userspace agents, or lack sufficient programmability to express advanced policies. Seccomp, Linux's system call filtering module, is widely used by modern container technologies, mobile apps, and system management services. Despite the adoption of the classic BPF language (cBPF), security policies in Seccomp are mostly limited to static allow lists, primarily because cBPF does not support stateful policies. Consequently, many essential security features cannot be expressed precisely and/or require kernel modifications. In this paper, we present a programmable system call filtering mechanism, which enables more advanced security policies to be expressed by leveraging the extended BPF language (eBPF). More specifically, we create a new Seccomp eBPF program type, exposing, modifying or creating new eBPF helper functions to safely manage filter state, access kernel and user state, and utilize synchronization primitives. Importantly, our system integrates with existing kernel privilege and capability mechanisms, enabling unprivileged users to install advanced filters safely. Our evaluation shows that our eBPF-based filtering can enhance existing policies (e.g., reducing the attack surface of early execution phase by up to 55.4% for temporal specialization), mitigate real-world vulnerabilities, and accelerate filters.

研究动机与目标

  • 解决大部分无状态且表达能力有限的 Seccomp-cBPF 的局限性。
  • 通过基于 eBPF 的 Seccomp 程序类型实现高级系统调用安全策略。
  • 在保留现有 Seccomp 接口的同时,使非特权用户能够安全地安装高级过滤器。
  • 在过滤器内提供安全的状态管理、同步与用户内存访问机制。
  • 展示真实世界用例以及相对于现有方法的性能/安全改进。

提出的方法

  • 将 Seccomp-eBPF 作为一个新的 Seccomp 程序类型(BPF_PROG_TYPE_SECCOMP)引入,构建在 Seccomp 和扩展的 BPF 工具之上。
  • 暴露并修改 eBPF 助手函数以支持有状态过滤、安全的用户内存访问、同步和内核交互。
  • 重新定义安全任务存储帮助函数,使非特权过滤器在不暴露特权任务结构的情况下可使用。
  • 实现对用户空间指针的安全 DPI(深包式)内存访问,同时降低 TOCTTOU 风险。
  • 添加系统调用序列化原语,通过引入按调用原子计数器和一个 API(bpf_wait_syscall)来防止竞争条件。
  • 提供两步式过滤器加载(bpf_prog_load)和带防篡改保护考虑的 Seccomp 安装。
Figure 1 . Features, helper interfaces, and their implementation of the Seccomp eBPF program type.
Figure 1 . Features, helper interfaces, and their implementation of the Seccomp eBPF program type.

实验结果

研究问题

  • RQ1如何使 Seccomp 过滤有状态以支持如系统调用计数限制、序列检查和时序专门化等策略?
  • RQ2基于 eBPF 的 Seccomp 过滤器能否在不提升权限的情况下安全地安装高级策略?
  • RQ3在 Seccomp-eBPF 中需要哪些新的 eBPF 助手函数来实现状态管理、同步和安全的用户内存访问?
  • RQ4与 Seccomp-cBPF 相比,Seccomp-eBPF 在降低攻击面或缓解现实世界漏洞方面有多有效?
  • RQ5Seccomp-eBPF 相对于传统 Seccomp 方法的性能影响是什么?

主要发现

  • 基于 eBPF 的 Seccomp 过滤在早期执行阶段的系统调用覆盖面上可比基于 cBPF 的策略减少多达 55.4%。
  • Seccomp-eBPF 启用的功能包括系统调用计数限制、流量完整性保护和序列化,这是 cBPF 无法实现的。
  • 安全的用户内存访问助手和任务存储重新设计使非特权过滤器在不提升权限的情况下运行。
  • 序列化助手(bpf_wait_syscall)通过协调冲突的系统调用来安全缓解竞争条件。
  • 该方法在整合内核特权机制以防止权限升级的同时,保留了 Seccomp 的使用模型和接口。
  • 基于 Seccomp-eBPF 的过滤器应用可提升性能,包括通过验证缓存实现高达 10% 的提升。
Figure 2 . Workflow of a Seccomp-eBPF filter
Figure 2 . Workflow of a Seccomp-eBPF filter

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。