Skip to content

Contour has Lua code injection via Cookie Path Rewrite Policy

High severity GitHub Reviewed Published Apr 20, 2026 in projectcontour/contour • Updated Apr 24, 2026

Package

gomod github.com/projectcontour/contour (Go)

Affected versions

>= 1.19.0, < 1.31.6
>= 1.32.0, < 1.32.5
>= 1.33.0, < 1.33.4

Patched versions

1.31.6
1.32.5
1.33.4

Description

Impact

Contour's Cookie Rewriting feature is vulnerable to Lua code injection. An attacker with RBAC permissions to create or modify HTTPProxy resources can craft a malicious value in the following fields that results in arbitrary code execution in the Envoy proxy:

  • spec.routes[].cookieRewritePolicies[].pathRewrite.value
  • spec.routes[].services[].cookieRewritePolicies[].pathRewrite.value

The cookie rewriting feature is internally implemented using Envoy's HTTP Lua filter. User-controlled values are interpolated into Lua source code using Go text/template without sufficient sanitization.

The injected code only executes when processing traffic on the attacker's own route, which they already control. However, since Envoy runs as shared infrastructure, the injected code can also:

  • Read Envoy's xDS client credentials from the filesystem, which could be used to read all Contour xDS configuration, including TLS certificates and private keys of other tenants.
  • Cause denial of service for other tenants sharing the Envoy instance.

Other use cases of Lua filter are not vulnerable.

Patches

The fix is available in Contour v1.33.4, v1.32.5, and v1.31.6.

  • v1.33.4: User-provided values are no longer interpolated into Lua code. Use of text/template is removed. Requires Envoy 1.35.0 or later.
  • v1.32.5, v1.31.6: User-provided values are escaped before interpolation into Lua code.

Workarounds

There are no workarounds. Users should upgrade to a patched version.

References

@tsaarni tsaarni published to projectcontour/contour Apr 20, 2026
Published by the National Vulnerability Database Apr 23, 2026
Published to the GitHub Advisory Database Apr 24, 2026
Reviewed Apr 24, 2026
Last updated Apr 24, 2026

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(19th percentile)

Weaknesses

Improper Control of Generation of Code ('Code Injection')

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. Learn more on MITRE.

CVE ID

CVE-2026-41246

GHSA ID

GHSA-x4mj-7f9g-29h4

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.