Skip to main content
QUICK REVIEW

[论文解读] Swivel: Hardening WebAssembly against Spectre

Shravan Narayan, Craig Disselkoen|arXiv (Cornell University)|Feb 25, 2021
Security and Verification in Computing参考文献 57被引用 15
一句话总结

Swivel 是一种基于编译器的框架,通过线性块和内存掩码强制执行推测性控制流与数据流隔离,从而增强 WebAssembly(Wasm)对 Spectre 攻击的防护能力。它在 SPEC 2006 基准测试中实现了低于 10.3% 的性能开销,同时消除了沙箱逃逸、污染和主机污染攻击,且无需依赖流水线屏障或进程隔离。

ABSTRACT

We describe Swivel, a new compiler framework for hardening WebAssembly (Wasm) against Spectre attacks. Outside the browser, Wasm has become a popular lightweight, in-process sandbox and is, for example, used in production to isolate different clients on edge clouds and function-as-a-service platforms. Unfortunately, Spectre attacks can bypass Wasm's isolation guarantees. Swivel hardens Wasm against this class of attacks by ensuring that potentially malicious code can neither use Spectre attacks to break out of the Wasm sandbox nor coerce victim code-another Wasm client or the embedding process-to leak secret data. We describe two Swivel designs, a software-only approach that can be used on existing CPUs, and a hardware-assisted approach that uses extension available in Intel 11th generation CPUs. For both, we evaluate a randomized approach that mitigates Spectre and a deterministic approach that eliminates Spectre altogether. Our randomized implementations impose under 10.3% overhead on the Wasm-compatible subset of SPEC 2006, while our deterministic implementations impose overheads between 3.3% and 240.2%. Though high on some benchmarks, Swivel's overhead is still between 9x and 36.3x smaller than existing defenses that rely on pipeline fences.

研究动机与目标

  • 解决现代超标量 CPU 上 WebAssembly 中 Spectre 攻击可绕过沙箱隔离的严重安全漏洞。
  • 缓解在进程内 Wasm 部署中出现的基于 Spectre 的攻击,包括沙箱逃逸、沙箱污染和主机污染。
  • 在服务器无服务器计算和边缘云等性能敏感环境中,为 Wasm 提供强内存隔离,同时不牺牲可扩展性。
  • 提供一种实用且可部署的解决方案,与现有硬件和编译器兼容,避免依赖昂贵的流水线屏障或进程隔离。
  • 证明通过智能静态编译与硬件辅助功能,可实现极低性能成本的有效 Spectre 硬化。

提出的方法

  • 将 Wasm 代码编译为线性块(LBs)——仅在块边界处允许控制转移的直线型 x86 代码序列,防止推测性分支进入未经授权区域。
  • 在每个线性块内强制实施内存访问掩码,仅允许对沙箱内存区域的推测性数据访问。
  • 通过省略 ret 指令并使用独立的栈指针追踪返回地址,消除对返回栈缓冲区(RSB)的依赖,防止 RSB 下溢攻击。
  • 在 Swivel-CET 中利用 Intel® CET 和 MPK 实现硬件辅助隔离,以极低性能影响提供细粒度的控制流完整性和内存保护。
  • 应用推测性加载硬化(SLH)以保护间接调用和 switch 表免受 Spectre-PHT 和 Spectre-BTB 攻击。
  • 在纯软件变体 Swivel-SFI 中使用地址空间布局随机化(ASLR),以增加构造可靠 Spectre 恶意代码的难度。

实验结果

研究问题

  • RQ1基于编译器的方法是否能在不依赖流水线屏障或进程隔离的前提下,有效防止 WebAssembly 中的 Spectre 攻击?
  • RQ2软件-only 编译技术(如线性块和内存掩码)在多大程度上可防止 Wasm 中的推测性执行攻击?
  • RQ3Swivel 的性能开销与现有防御方案(如插入屏障或基于进程的隔离)在真实工作负载中的表现相比如何?
  • RQ4Intel® CET 和 MPK 等硬件扩展是否可有效集成到 Wasm 编译器栈中,以提供更强且确定性的 Spectre 缓解?
  • RQ5是否可能在服务器无服务器平台等高吞吐量多租户环境中,通过单一编译框架同时实现强安全保证和可接受的性能?

主要发现

  • 纯软件变体 Swivel-SFI 在 SPEC 2006 的 Wasm 兼容子集上引入的开销低于 10.3%,证明其具备生产环境下的实用性。
  • 确定性变体 Swivel-CET 利用 Intel® CET 和 MPK 完全消除了 Spectre 攻击,SPEC 2006 基准测试中的开销范围为 3.3% 至 240.2%。
  • Swivel 的开销比现有基于屏障的防御方案低 9 倍至 36.3 倍,后者导致 1.8 倍至 19.6 倍的性能下降。
  • 通过避免使用 ret 指令并采用独立的栈指针,Swivel-SFI 消除了可能被用于 Spectre 攻击的 RSB 下溢漏洞。
  • 线性块与内存掩码的结合确保推测性控制流与数据流被严格限制在沙箱边界内,从而防止逃逸与污染攻击。
  • Swivel 有效防御了全部三种攻击面:沙箱逃逸、沙箱污染和主机污染,使其适用于 FaaS 和边缘计算等多租户环境。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。