Careers Post-AI
AI infrastructure and systems: all chapters

AI infrastructure and systemsPart 6: Datacenter scale and your career

Chapter 23Multi-tenancy and platform security

35 min read, 1 lab, Advanced

In January 2024 Trail of Bits disclosed LeftoverLocals (CVE-2023-4969): on several vendors' GPUs, one process could read another's leftover on-chip local memory, which the researchers used to reconstruct an LLM's responses from a neighbouring process. In July 2025, Wiz showed that a three-line Dockerfile could escape a container through the NVIDIA Container Toolkit (CVE-2025-23266). This chapter teaches you how to build an AI platform where many tenants share expensive GPUs without sharing each other's weights, prompts or data.

After this chapter you can

  • Build a threat model for a shared training and inference platform
  • Compare GPU isolation options from time-slicing to bare metal, including what MIG does and does not isolate
  • Explain confidential computing, attestation and confidential GPUs, and where they help
  • Design controls that protect model weights, tenant data, prompts and logs
  • Map platform controls to SOC 2, ISO 27001, ISO/IEC 42001 and the EU AI Act
  • Build and test tenant isolation on Kubernetes with quotas, network policies and RBAC

Threat model of a shared AI platform

A shared AI platform holds things that are unusually valuable and unusually easy to copy. A frontier model's weights are a single file set worth hundreds of millions of dollars in training compute. Prompts and completions often contain customer secrets, and training datasets may contain personal data. The general method comes from the Security track's chapter on the security mindset; here you apply it to the platform itself.

Threat actorGoalTypical path
Malicious tenantSteal another tenant's weights, prompts or dataContainer escape, GPU memory residue, side channels, network reach
Compromised tenantSame, using a stolen account or poisoned imageSupply chain, leaked API keys
External attackerSteal weights, abuse free computeExposed dashboards, SSRF to cloud metadata, weak API auth
Insider or operatorCopy weights or read customer promptsDirect host access, log access, backups
Curious providerRead customer data in the cloudHypervisor and host access (addressed by confidential computing)

The question that shapes everything else is who must be unable to see what. A single company sharing GPUs between internal teams can accept containers on shared nodes. A public GPU cloud renting to strangers usually cannot.

GPU isolation levels and the limits of MIG

GPUs were designed for one trusted user at a time, so isolation was added later and in layers. Each step down the ladder gives a stronger boundary and worse utilization.

LevelWhat is sharedIsolation strengthTypical use
Time-slicingGPU memory, scheduler, driverWeak: no memory or fault isolation between processesDev notebooks, trusted teams
MPS (Multi-Process Service)One GPU context across processesWeak: a fault in one client can affect othersPacking small trusted inference jobs
Container, whole GPUHost kernel, driver, container toolkitModerate: depends on kernel and toolkit bugsInternal platforms
MIG instancePhysical GPU, driver, hostStrong for memory and performance, not a host trust boundaryPacking small models per GPU
VM with passthroughHypervisor, PCIe fabricStrongPublic GPU clouds
Bare metalNetwork and facilityStrongest, requires firmware reset and scrubbing between tenantsLarge training customers

MIG (Multi-Instance GPU, on NVIDIA data center GPUs since Ampere) splits one GPU into up to seven instances. NVIDIA documents that each instance gets its own slice of streaming multiprocessors, L2 cache banks, memory controllers and DRAM, giving it isolated memory and predictable bandwidth. MIG's limits matter as much as its strengths: profiles are fixed sizes, the instances still share one driver and one host kernel, and MIG does nothing about container escapes. Treat MIG as a performance and memory boundary, and put a VM boundary around it when tenants do not trust each other.

Memory residue and side channels

When one tenant's job ends and another's starts on the same GPU, any data left in GPU memory is a potential leak. LeftoverLocals showed this was real for on-chip local memory on affected AMD, Apple and Qualcomm GPUs; the researchers did not demonstrate it on NVIDIA hardware. The general lesson is not about one vendor: never assume memory is cleared between tenants unless the vendor documents it and you have verified it.

  • Between processes on a shared GPU: rely on documented driver behaviour, and prefer MIG or separate GPUs for mutually untrusted tenants.
  • Between bare-metal tenants: reset the GPU, scrub memory, and re-flash or verify firmware as part of the node reclamation workflow.
  • Side channels: academic work has shown timing and contention channels between workloads sharing a GPU or an interconnect. Practical cross-tenant attacks in production clouds are less established, so treat this as a reason to avoid co-locating mutually hostile tenants on one device rather than as a solved or a proven-broken problem.

AI serving adds a new class of side channel. Engines share a prefix cache (reused KV cache entries for identical prompt prefixes) across requests to save compute. A 2024 paper, "The Early Bird Catches the Leak", showed that an attacker can detect cache hits from response timing and use that to infer other users' system prompts. The fix is to scope cache sharing to a tenant, for example with a per-tenant cache salt where the engine supports it (vLLM accepts one per request).

Confidential computing for AI

Isolation protects tenants from each other. Confidential computing also protects a tenant from the platform operator, by running the workload inside a TEE (trusted execution environment) whose memory is encrypted by the CPU, so the hypervisor and host administrators cannot read it. Current CPU TEEs for whole virtual machines are AMD SEV-SNP and Intel TDX.

GPUs joined this model with the NVIDIA H100, whose confidential computing mode works alongside a CPU TEE: data crossing PCIe is encrypted (through bounce buffers in shared memory) and the GPU proves its identity and firmware state with a hardware-rooted key. Blackwell extends support, including multi-GPU passthrough configurations, and NVIDIA's trusted computing documentation lists the currently supported GPUs and modes. Azure announced general availability of confidential VMs with H100 GPUs in September 2024.

The piece that makes it useful is attestation: proving to a remote party what is running before giving it secrets.

Confidential computing has costs. Encrypted transfers add overhead that matters for transfer-heavy workloads, the supported hardware and software matrix is narrow and changes with each driver release, and attestation policy is easy to get subtly wrong. It is worth it when the threat model includes the operator: a model vendor deploying weights into a customer's cloud, or a regulated customer who must prove the provider cannot read its data.

Protecting weights, data, prompts and logs

Weights deserve the controls you would give signing keys. RAND's report "Securing AI Model Weights" frames this as five security levels against increasingly capable attackers, and is a good reference for what each level demands.

  • Encryption at rest with envelope keys: weights are encrypted with a data key, which is wrapped by a key in a KMS or HSM; release the data key only to authenticated, ideally attested, serving workloads.
  • Least-privilege access: separate roles for training, publishing and serving; no human has standing read access to production weights.
  • Egress controls: serving nodes cannot reach the internet or arbitrary storage, so a compromised server cannot upload 500 GB anywhere. Alert on unusually large reads from the model registry.
  • Tenant data isolation: separate buckets and encryption keys per tenant, training jobs that mount only their tenant's data, and per-tenant LoRA adapters loaded with tenant-scoped credentials.
  • Prompt and log privacy: decide explicitly what is logged, redact or hash sensitive fields, set short retention, encrypt logs per tenant, and restrict who can query them. Logs are often the biggest store of customer data on the platform.
  • Network isolation: per-tenant VPCs or Kubernetes network policies by default deny, with the back-end GPU fabric isolated per tenant using partition keys (InfiniBand) or VRFs and DPU-enforced policies (Ethernet).
  • Secrets: short-lived workload identity instead of static API keys, secrets mounted from a vault, never baked into images.
  • Audit: immutable logs of who accessed weights, keys, datasets and prompt logs, retained long enough for investigations and auditors.

Compliance frameworks at a glance

You will not become a compliance specialist from this section, but platform engineers build the evidence auditors ask for, so you need the map.

FrameworkWhat it isWhat it asks of the platform
SOC 2AICPA attestation report on controls for security, availability, confidentiality and moreEvidence that access control, change management, logging and incident response work over time
ISO/IEC 27001Certifiable information security management system standardA risk-based ISMS with defined controls, owners and continual review
ISO/IEC 42001:2023Certifiable AI management system standard, published December 2023AI-specific risk and impact assessment, data and model lifecycle governance
EU AI ActEU regulation with phased obligationsFor general-purpose AI model providers, since 2 August 2025: technical documentation, information for downstream providers, a copyright policy and a public training-data summary; models with systemic risk add evaluations, incident reporting and cybersecurity duties

The EU AI Act's timeline has moved: a 2026 amendment package (the Digital Omnibus on AI) postponed obligations for high-risk systems, while the general-purpose AI model obligations stayed in force. Check the current consolidated text or the Commission's guidance before relying on any date. For the platform engineer the practical point is the same under every framework: controls you cannot evidence do not count, so build audit logs, access reviews and configuration history in from the start.

Key terms

Tenant
A customer, team or workload that must be isolated from others sharing the same platform.
MIG
Multi-Instance GPU: hardware partitioning of one NVIDIA GPU into up to seven instances with dedicated compute, cache and memory.
MPS
Multi-Process Service: lets several processes share one GPU context for efficiency, with weak isolation.
TEE
Trusted execution environment: hardware-enforced isolated memory that the host and hypervisor cannot read.
Attestation
Cryptographic evidence of what hardware, firmware and software is running, checked before secrets are released.
Envelope encryption
Encrypting data with a data key that is itself encrypted by a master key held in a KMS or HSM.
Prefix cache
Reuse of stored attention keys and values for requests that share an identical prompt prefix.
Egress control
Restricting where a workload can send data, to limit exfiltration.
NetworkPolicy
A Kubernetes object that restricts which pods may talk to which, enforced by the network plugin.
Lab

Build and attack a two-tenant inference cluster

Intermediate, 75 min

Goal: build two isolated tenants on a local Kubernetes cluster, each with its own quota, network policy, RBAC, secret and model storage, then prove that tenant A cannot reach tenant B's endpoint, secrets or weights.

You need: Docker, kind and kubectl (macOS: brew install kind kubectl). This lab only targets the cluster you create on your own machine.

  1. Create a kind cluster without its default network plugin, then install Calico so network policies are definitely enforced. The version below was current when written; check Calico's kind guide for the latest.
kind-calico.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
  - role: worker
networking:
  disableDefaultCNI: true
  podSubnet: 192.168.0.0/16
kind create cluster --config kind-calico.yaml --name tenants
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.33.1/manifests/calico.yaml
kubectl -n kube-system rollout status ds/calico-node --timeout=300s

Expect daemon set "calico-node" successfully rolled out and both nodes Ready in kubectl get nodes.

  1. Save this tenant template. TENANT is replaced with a or b. It creates a namespace with the restricted Pod Security standard, a quota, a service account with a namespace-scoped role, a secret, a volume holding fake weights, a model server, a client pod, and default-deny network policies.
tenant.yaml
apiVersion: v1
kind: Namespace
metadata:
  name: tenant-TENANT
  labels:
    tenant: TENANT
    pod-security.kubernetes.io/enforce: restricted
---
apiVersion: v1
kind: ResourceQuota
metadata: { name: quota, namespace: tenant-TENANT }
spec:
  hard:
    pods: "4"
    requests.cpu: "1"
    requests.memory: 1Gi
    requests.nvidia.com/gpu: "1"
---
apiVersion: v1
kind: ServiceAccount
metadata: { name: runner, namespace: tenant-TENANT }
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata: { name: tenant-operator, namespace: tenant-TENANT }
rules:
  - apiGroups: ["", "apps"]
    resources: ["pods", "services", "secrets", "deployments", "persistentvolumeclaims"]
    verbs: ["get", "list", "create", "update", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata: { name: runner-binding, namespace: tenant-TENANT }
subjects: [{ kind: ServiceAccount, name: runner, namespace: tenant-TENANT }]
roleRef: { kind: Role, name: tenant-operator, apiGroup: rbac.authorization.k8s.io }
---
apiVersion: v1
kind: Secret
metadata: { name: model-api-key, namespace: tenant-TENANT }
stringData: { key: "secret-for-tenant-TENANT" }
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: weights, namespace: tenant-TENANT }
spec:
  accessModes: ["ReadWriteOnce"]
  resources: { requests: { storage: 100Mi } }
---
apiVersion: apps/v1
kind: Deployment
metadata: { name: model, namespace: tenant-TENANT }
spec:
  replicas: 1
  selector: { matchLabels: { app: model } }
  template:
    metadata: { labels: { app: model } }
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser: 101
        fsGroup: 101
        seccompProfile: { type: RuntimeDefault }
      initContainers:
        - name: write-weights
          image: busybox:1.36
          command: ["sh", "-c", "echo weights-of-tenant-TENANT > /models/weights.bin"]
          volumeMounts: [{ name: weights, mountPath: /models }]
          resources: { requests: { cpu: 50m, memory: 32Mi } }
          securityContext: { allowPrivilegeEscalation: false, capabilities: { drop: ["ALL"] } }
      containers:
        - name: server
          image: nginxinc/nginx-unprivileged:1.27-alpine
          ports: [{ containerPort: 8080 }]
          volumeMounts: [{ name: weights, mountPath: /usr/share/nginx/html }]
          resources: { requests: { cpu: 100m, memory: 64Mi } }
          securityContext: { allowPrivilegeEscalation: false, capabilities: { drop: ["ALL"] } }
      volumes:
        - name: weights
          persistentVolumeClaim: { claimName: weights }
---
apiVersion: v1
kind: Service
metadata: { name: model, namespace: tenant-TENANT }
spec:
  selector: { app: model }
  ports: [{ port: 8080, targetPort: 8080 }]
---
apiVersion: apps/v1
kind: Deployment
metadata: { name: client, namespace: tenant-TENANT }
spec:
  replicas: 1
  selector: { matchLabels: { app: client } }
  template:
    metadata: { labels: { app: client } }
    spec:
      serviceAccountName: runner
      securityContext:
        runAsNonRoot: true
        runAsUser: 65534
        seccompProfile: { type: RuntimeDefault }
      containers:
        - name: shell
          image: busybox:1.36
          command: ["sleep", "infinity"]
          resources: { requests: { cpu: 50m, memory: 32Mi } }
          securityContext: { allowPrivilegeEscalation: false, capabilities: { drop: ["ALL"] } }
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: { name: default-deny, namespace: tenant-TENANT }
spec:
  podSelector: {}
  policyTypes: ["Ingress", "Egress"]
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: { name: allow-same-tenant, namespace: tenant-TENANT }
spec:
  podSelector: {}
  policyTypes: ["Ingress", "Egress"]
  ingress: [{ from: [{ podSelector: {} }] }]
  egress:
    - to: [{ podSelector: {} }]
    - to: [{ namespaceSelector: {}, podSelector: { matchLabels: { k8s-app: kube-dns } } }]
      ports: [{ protocol: UDP, port: 53 }, { protocol: TCP, port: 53 }]
  1. Create both tenants and wait for them.
for t in a b; do sed "s/TENANT/$t/g" tenant.yaml | kubectl apply -f -; done
for t in a b; do for d in model client; do kubectl -n tenant-$t rollout status deploy/$d --timeout=180s; done; done
  1. Prove the happy path works: tenant A's client reads tenant A's weights.
kubectl -n tenant-a exec deploy/client -- wget -qO- -T 3 http://model.tenant-a.svc.cluster.local:8080/weights.bin

Expect weights-of-tenant-a.

  1. Attack 1, the network: tenant A tries to fetch tenant B's weights over the network.
kubectl -n tenant-a exec deploy/client -- wget -qO- -T 3 http://model.tenant-b.svc.cluster.local:8080/weights.bin

Expect download timed out and a non-zero exit. Two policies block it: tenant A's egress rules and tenant B's ingress rules. Temporarily remove both with kubectl delete networkpolicy --all -n tenant-a and the same for tenant-b, rerun to see the request succeed, then re-apply the template for both tenants. That shows the policies, not luck, were blocking you.

  1. Attack 2, the API: check what tenant A's service account may do in each namespace.
SA=system:serviceaccount:tenant-a:runner
kubectl auth can-i get secrets -n tenant-a --as=$SA     # yes
kubectl auth can-i get secrets -n tenant-b --as=$SA     # no
kubectl auth can-i create pods -n tenant-b --as=$SA     # no
kubectl get secret model-api-key -n tenant-b --as=$SA   # Forbidden
  1. Attack 3, the storage: a pod can only reference a claim in its own namespace. Confirm the API has no field for another namespace, and that tenant A cannot list B's claims.
kubectl explain pod.spec.volumes.persistentVolumeClaim
kubectl get pvc -n tenant-b --as=system:serviceaccount:tenant-a:runner

The first shows only claimName and readOnly. The second returns Forbidden.

  1. Attack 4, resource exhaustion: try to take more than the quota.
kubectl -n tenant-a scale deploy/model --replicas=6
kubectl -n tenant-a get events --sort-by=.lastTimestamp | grep -i quota

Expect events reporting exceeded quota, with tenant B's pods unaffected.

Check your work: you have a short test log showing four blocked attempts (network, secrets, pod creation, storage listing), one quota rejection, and the same requests succeeding inside tenant A. Turn it into a script that exits non-zero if any cross-tenant request succeeds, and keep it in a public repo as a regression test.

Stretch: add a second node pool labelled for tenant B and use a taint plus node affinity so the two tenants never share a node, then explain which threats from this chapter that closes and which remain.

Check yourself

A public GPU cloud wants to rent slices of H100s to unrelated customers and proposes MIG instances inside containers on a shared host. What is the main gap?

What does attestation add to encrypting model weights at rest?

An inference platform shares one prefix cache across all customers. Which risk does that create?

In the lab, deleting both tenants' network policies lets tenant A fetch B's weights even though they are in different namespaces. What does this show?

Recap

  • Start every platform security design by deciding who must be unable to see which weights, prompts, data and logs.
  • GPU isolation ranges from time-slicing to bare metal; MIG isolates memory and performance but not the host, so pair it with VMs for untrusted tenants.
  • Memory residue and timing channels, including shared prefix caches, are real risks, so scrub between tenants and scope sharing per tenant.
  • Confidential computing and attestation protect workloads from the operator and let key services release weight keys only to verified code.
  • Weights need envelope encryption, least privilege, egress controls and audit, and logs are often the largest store of customer data.
  • SOC 2, ISO 27001, ISO/IEC 42001 and the EU AI Act all reward controls you can evidence, so build audit in from day one.

Go deeper