CVE-2026-41246: Github.com/projectcontour/contour Contour Has Lua Code Injection Vulnerability

HIGH
Advisory Identifier: GHSA-x4mj-7f9g-29h4
CVSS 8.1
CWE-94
Published
Advisory Summary

CVE-2026-41246 is a HIGH (CVSS 8.1) contour has lua code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Github.com/projectcontour/contour libraries in the Go ecosystem. The issue involves contour has lua code injection via cookie path rewrite policy. Remediation is available by upgrading affected packages to version 1.31.6, 1.32.5, 1.33.4.

CVE-2026-41246 at a Glance

CVE Identifier CVE-2026-41246
GHSA Identifier GHSA-x4mj-7f9g-29h4
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Github.com/projectcontour/contour
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.1

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:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-41246

To remediate this vulnerability, upgrade all affected Github.com/projectcontour/contour dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/projectcontour/contour fixed: 1.31.6
Upgrade github.com/projectcontour/contour to 1.31.6
github.com/projectcontour/contour fixed: 1.32.5
Upgrade github.com/projectcontour/contour to 1.32.5
github.com/projectcontour/contour fixed: 1.33.4
Upgrade github.com/projectcontour/contour to 1.33.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/projectcontour/contour

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-41246, inspect your project dependencies for Github.com/projectcontour/contour:

inspect dependencies for github.com/projectcontour/contour

Analyze the terminal output to locate any version of Github.com/projectcontour/contour in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.31.6), 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/projectcontour/contour, 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

### Impact Contour's [Cookie Rewriting](https://projectcontour.io/docs/1.33/config/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](https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/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](https://github.com/projectcontour/contour/releases/tag/v1.33.4), [v1.32.5](https://github.com/projectcontour/contour/releases/tag/v1.32.5), and [v1.31.6](https://github.com/projectcontour/contour/releases/tag/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.

CVE-2026-41246 Affected Github.com/projectcontour/contour Versions

3 component(s)
Fixed Versions:
1.31.61.32.51.33.4
Product / Package Ecosystem Affected Versions Fixed Version
github.com/projectcontour/contour
Go
≥ 1.19.0
< 1.31.6
1.31.6
github.com/projectcontour/contour
Go
≥ 1.32.0
< 1.32.5
1.32.5
github.com/projectcontour/contour
Go
≥ 1.33.0
< 1.33.4
1.33.4

References

Frequently Asked Questions

What is CVE-2026-41246?
CVE-2026-41246 is a security vulnerability in Github.com/projectcontour/contour involving Contour has Lua code injection via Cookie Path Rewrite Policy under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Github.com/projectcontour/contour versions are affected?
Affected versions include releases prior to 1.31.6, 1.32.5, 1.33.4 across affected packages: github.com/projectcontour/contour.
What version fixes CVE-2026-41246?
Upgrading to 1.31.6, 1.32.5, 1.33.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/projectcontour/contour affected?
Yes, github.com/projectcontour/contour is affected in releases prior to 1.31.6, 1.32.5, 1.33.4. Upgrade your dependency to 1.31.6, 1.32.5, 1.33.4 or later.
What is the CVSS score of CVE-2026-41246?
CVE-2026-41246 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H.
What CWE is associated with CVE-2026-41246?
CVE-2026-41246 is classified under CWE-94: 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.).
How can I check Go dependencies for CVE-2026-41246?
Run the dependency tree command: 'inspect dependencies for github.com/projectcontour/contour'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-x4mj-7f9g-29h4",
  "modified" : "2026-07-01T22:20:13Z",
  "published" : "2026-04-24T15:19:49Z",
  "aliases" : [ "CVE-2026-41246" ],
  "summary" : "Contour has Lua code injection via Cookie Path Rewrite Policy",
  "details" : "### Impact\n\nContour's [Cookie Rewriting](https://projectcontour.io/docs/1.33/config/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:\n\n- `spec.routes[].cookieRewritePolicies[].pathRewrite.value`\n- `spec.routes[].services[].cookieRewritePolicies[].pathRewrite.value`\n\nThe cookie rewriting feature is internally implemented using Envoy's [HTTP Lua filter](https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/lua_filter). User-controlled values are interpolated into Lua source code using Go `text/template` without sufficient sanitization.\n\nThe 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:\n\n- 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.\n- Cause denial of service for other tenants sharing the Envoy instance.\n\nOther use cases of Lua filter are not vulnerable.\n\n### Patches\n\nThe fix is available in Contour [v1.33.4](https://github.com/projectcontour/contour/releases/tag/v1.33.4), [v1.32.5](https://github.com/projectcontour/contour/releases/tag/v1.32.5), and [v1.31.6](https://github.com/projectcontour/contour/releases/tag/v1.31.6).\n\n- 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.\n- v1.32.5, v1.31.6: User-provided values are escaped before interpolation into Lua code.\n\n### Workarounds\n\nThere are no workarounds. Users should upgrade to a patched version.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/projectcontour/contour"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.19.0"
      }, {
        "fixed" : "1.31.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/projectcontour/contour"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.32.0"
      }, {
        "fixed" : "1.32.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/projectcontour/contour"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.33.0"
      }, {
        "fixed" : "1.33.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/projectcontour/contour/security/advisories/GHSA-x4mj-7f9g-29h4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-41246"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/security/cve/CVE-2026-41246"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2461257"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/projectcontour/contour"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/projectcontour/contour/releases/tag/v1.31.6"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/projectcontour/contour/releases/tag/v1.32.5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/projectcontour/contour/releases/tag/v1.33.4"
  }, {
    "type" : "WEB",
    "url" : "https://projectcontour.io/docs/1.33/config/cookie-rewriting"
  }, {
    "type" : "WEB",
    "url" : "https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-41246.json"
  }, {
    "type" : "WEB",
    "url" : "https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/lua_filter"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-24T15:19:49Z",
    "nvd_published_at" : "2026-04-23T19:17:29Z"
  }
}