Hyperlight: Hypervisor-Based Protection for Secure Function Execution

Hyperlight: Hypervisor-Based Protection for Secure Function Execution

Introduction

Any system that runs third-party logic eventually hits the same question: how do you execute untrusted code without handing it the keys to the cluster? Containers help, but “container breakout” is still a risk class, and the overhead of heavier sandboxes can be prohibitive for high-frequency function calls.

Hyperlight, introduced by Microsoft in April 2025, takes a more aggressive isolation stance: hypervisor-based protection per function call. It targets serverless-like and plugin-style workloads where you want hardware-backed isolation boundaries while still keeping latency low enough for production traffic.

When Hyperlight is a good fit

  • Plugin ecosystems where customers supply code (or where you can’t fully trust dependencies).
  • High-churn function execution where “spin up a whole container per call” is too expensive.
  • Multi-tenant SaaS needing stronger isolation guarantees than process/container boundaries alone.
  • Security-first platforms willing to trade some operational complexity (hypervisor access) for tighter sandboxes.

Hypervisor-Based Isolation

  • Per-call isolation provides complete isolation for each function call using hardware virtualization.
  • Hardware-level security leverages CPU virtualization features for security guarantees that are impossible to bypass.
  • Instant isolation creates isolated execution environments in microseconds, enabling high-throughput workloads.
  • Multi-tenant safety ensures complete isolation between different function invocations and tenants.

Rust Implementation

  1. Memory safety leverages Rust’s memory safety guarantees to prevent entire classes of security vulnerabilities.
  2. Performance provides near-native performance through Rust’s zero-cost abstractions and efficient compilation.
  3. Concurrency enables safe, efficient concurrent execution through Rust’s ownership and borrowing system.
  4. Type safety prevents runtime errors through compile-time type checking and validation.

Secure Function Execution

  • Untrusted code support enables safe execution of untrusted or third-party code with confidence.
  • Sandboxed execution provides complete sandboxing without the overhead of traditional container-based isolation.
  • Resource limits enforces strict resource limits including CPU, memory, and execution time.
  • Network isolation controls and restricts network access at the hypervisor level for enhanced security.

Kubernetes Integration

  • Kubernetes-native designed to run seamlessly on Kubernetes clusters with standard deployments.
  • CRI integration integrates with Container Runtime Interface (CRI) for standard Kubernetes workflows.
  • Operator support provides Kubernetes operators for automated deployment and management.
  • Resource efficiency optimizes resource usage compared to traditional container-based isolation.

Scale and Performance

  • High throughput supports thousands of function invocations per second with minimal overhead.
  • Low latency provides sub-millisecond function invocation latency through optimized hypervisor operations.
  • Resource efficiency reduces resource overhead compared to container-based isolation approaches.
  • Horizontal scaling scales horizontally across multiple nodes with consistent security guarantees.

Use Cases

  • Serverless workloads enables secure serverless function execution with hardware-level isolation guarantees.
  • Plugin systems provides secure execution environments for dynamic plugins and extensions.
  • Multi-tenant SaaS enables safe execution of customer-provided code in multi-tenant SaaS applications.
  • Edge computing provides secure code execution at the edge with minimal resource requirements.

Getting Started

# Add Hyperlight to your Rust project
cargo add hyperlight

# Example: Execute a function with hypervisor protection

Example Rust code:

use hyperlight::{Executor, Function, SecurityPolicy};

// Define a function to execute
let function = Function::new(|| {
    // Your function code here
    println!("Executing in hypervisor-protected environment");
    42
});

// Create an executor with security policy
let policy = SecurityPolicy::default()
    .with_cpu_limit(1000)  // CPU limit in milliseconds
    .with_memory_limit(64 * 1024 * 1024);  // 64 MB memory limit

let executor = Executor::new(policy);

// Execute the function
let result = executor.execute(function)?;

Deploy on Kubernetes:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: hyperlight-executor
spec:
  replicas: 3
  selector:
    matchLabels:
      app: hyperlight-executor
  template:
    metadata:
      labels:
        app: hyperlight-executor
    spec:
      containers:
      - name: executor
        image: hyperlight/executor:latest
        resources:
          requests:
            cpu: "100m"
            memory: "128Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        securityContext:
          privileged: true  # Required for hypervisor access

Security Model

  • Hardware-backed isolation uses CPU virtualization extensions (Intel VT-x, AMD-V) for isolation.
  • Attack surface minimization minimizes attack surface through Rust’s safety guarantees and minimal runtime.
  • Zero-trust execution implements zero-trust principles with every function call treated as untrusted.
  • Audit trail provides comprehensive audit trails for security compliance and forensic analysis.

Performance Characteristics

  • Invocation overhead function invocation overhead is measured in microseconds, not milliseconds.
  • Memory efficiency requires minimal memory overhead per isolated execution environment.
  • CPU efficiency CPU overhead is minimal, enabling high-throughput workloads.
  • Startup time function startup time is near-instantaneous compared to container-based approaches.

Summary

AspectDetails
Release DateApril 2025 (Microsoft)
Headline FeaturesHypervisor-based isolation, Rust implementation, secure function execution, Kubernetes integration
Why it MattersProvides hardware-level security guarantees for function execution at scale, enabling safe execution of untrusted code with minimal performance overhead

Hyperlight represents a breakthrough in secure code execution, combining hypervisor-level isolation with Rust’s safety guarantees to enable new classes of secure, high-performance serverless and function-as-a-service workloads on Kubernetes.