/

CVE-2026-22771

Severity:

HIGH RISK

(8.8)

Code Injection / Script Abuse in Envoy Gateway

CVE-2026-22771

Modified

Vulnerability type

Category:

Code Injection / Script Abuse

CWE:

CWE-94

Impact:

Credential and Secret Compromise via Script-Based Code Injection

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Envoy Gateway versions prior to 1.5.7 and 1.6.2 allow EnvoyExtensionPolicy Lua scripts to access and exfiltrate the Envoy proxy's own control-plane credentials.

An attacker who can influence or supply these Lua scripts may use the stolen credentials to communicate with the control plane and retrieve all secrets used by Envoy, including TLS private keys and authentication material for upstream and downstream connections.

Affected context

This vulnerability affects deployments of Envoy Gateway where:

  • Envoy is extended using EnvoyExtensionPolicy Lua scripts, and
  • Scripts can be created, modified, or influenced by users or services that should not have full access to control-plane credentials.

The issue manifests in environments where Lua extensions run with elevated capabilities relative to the trust level of the script author, enabling access to credentials that are otherwise intended to be internal to the proxy-control-plane relationship.

Exploit preconditions

  • Attack surface: The Lua extension mechanism exposed via EnvoyExtensionPolicy in Envoy Gateway-managed proxies.
  • Required access: Ability to author, modify, upload, or cause execution of Lua scripts (directly or indirectly) within EnvoyExtensionPolicy.
  • Trigger point: Execution of a malicious or compromised Lua script by the Envoy proxy as part of request/response processing or other scripted events.
  • Why exploitation is possible: The Lua execution context is granted access—directly or indirectly—to credentials used by Envoy to communicate with its control plane, without adequate isolation or enforcement of least privilege, allowing scripts to read and exfiltrate those credentials.

Why this happens

The root cause is an over-privileged script execution environment where Lua code operating under EnvoyExtensionPolicy can reach sensitive credentials that should remain internal to the proxy.

This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), as untrusted or semi-trusted script logic is effectively treated as trusted code with broad capabilities.

Instead of strictly sandboxing Lua scripts and limiting their access to a narrow, documented API surface, the design allows injected or manipulated scripts to interact with control-plane authentication material, enabling credential leakage and subsequent misuse.

Potential impact

  • Theft of control-plane credentials used by Envoy proxy.
  • Retrieval of all secrets managed by the control plane for that proxy instance, including:
  • TLS private keys and certificates.
  • API tokens, client certificates, and other upstream authentication credentials.
  • Downstream authentication material such as mTLS keys.
  • Impersonation of the Envoy proxy to the control plane, potentially modifying configuration or policy.
  • Decryption and inspection of otherwise confidential TLS traffic handled by the proxy.
  • Lateral movement within the service mesh or gateway environment by abusing stolen credentials and secrets.

General mitigation guidance

Mitigations generally focus on reducing the privilege and trust given to extension scripts and tightening the boundary around proxy-control-plane credentials:

  • Sandbox script execution: Restrict the Lua runtime to a minimal, well-audited API that does not expose control-plane credentials or other high-value secrets.
  • Apply least privilege to credentials: Separate credentials for control-plane communication from other secret material, and avoid exposing them to extension layers that operate on user or tenant data.
  • Constrain who can define extensions: Limit EnvoyExtensionPolicy creation and modification to tightly controlled administrative roles and trusted pipelines, avoiding multi-tenant or untrusted user control over Lua scripts.
  • Segment secrets and configuration: Use distinct identities and scoped secrets per proxy, per tenant, or per environment to reduce blast radius if any credentials are leaked.
  • Use policy-based guardrails: Adopt organizational policies that discourage or forbid arbitrary dynamic code in data-plane extensions where possible, favoring configuration-driven features over Turing-complete scripting.

How teams detect issues like this

Effective detection approaches concentrate on configuration analysis, behavioral monitoring, and code review of extensions:

  • Static analysis of Lua extensions: Scan Lua scripts used in EnvoyExtensionPolicy for patterns that indicate access to internal metadata, credentials, or outbound exfiltration endpoints.
  • Configuration and policy review: Periodically review EnvoyExtensionPolicy resources to ensure extensions are only defined by trusted teams and that scripting is minimized or tightly controlled.
  • Runtime monitoring and logging: Monitor outbound connections and requests generated by Lua scripts or from the proxy that deviate from expected control-plane patterns, including unusual destinations or protocols.
  • CI/CD controls: Integrate automated checks into deployment pipelines that flag or block introduction of high-risk Lua capabilities or usage of sensitive APIs in extension code.
  • Access pattern analysis: Use telemetry to detect anomalous retrieval of secrets from the control plane, such as spikes in secret fetches or access from unexpected identities or proxies.

Sources

SourceLink
github.comgithub.com/envoyproxy/gateway/security/advisories/GHSA-xrwg-mqj6-6m22
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-22771
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2428735
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-22771.json

Frequently asked

questions

Exploitability depends on who can influence EnvoyExtensionPolicy Lua scripts. In environments where only highly trusted operators can define or change these scripts, exposure is more limited; in multi-tenant or less restricted environments, the risk extends to any party who can introduce or modify Lua extensions.

An attacker needs the ability to author, alter, or cause execution of Lua scripts within EnvoyExtensionPolicy, either directly via control-plane APIs or indirectly through a compromised administrative workflow or CI/CD pipeline.

The safest pattern is to harden the extension model by sandboxing Lua execution, preventing scripts from reaching control-plane credentials or other sensitive secrets, and strictly limiting who can deploy or modify extension policies.

Future designs should treat extension code as untrusted or semi-trusted, enforce least privilege on script runtimes, segregate secret access away from extension surfaces, and employ automated review and policy enforcement to catch risky script capabilities before deployment.

Find out what's already
exploitable in your codebase.