CVE-2026-40302: zrok Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-4fxq-2x3x-6xqx
CVSS 6.1
CWE-116 CWE-79
Published
Advisory Summary

CVE-2026-40302 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-116: Improper Encoding or Escaping of Output) affecting zrok libraries in the Go ecosystem. The issue involves reflected xss in github oauth callback via unsanitized refreshinterval error rendering. Remediation is available by upgrading affected packages to version 2.0.1.

CVE-2026-40302 at a Glance

CVE Identifier CVE-2026-40302
GHSA Identifier GHSA-4fxq-2x3x-6xqx
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-116: Improper Encoding or Escaping of Output
Affected Product zrok
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).

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

How to Fix CVE-2026-40302

To remediate this vulnerability, upgrade all affected zrok 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/openziti/zrok fixed: Latest secure release
Upgrade github.com/openziti/zrok to Latest secure release
github.com/openziti/zrok/v2 fixed: 2.0.1
Upgrade github.com/openziti/zrok/v2 to 2.0.1
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/openziti/zrok

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-40302, inspect your project dependencies for zrok:

inspect dependencies for github.com/openziti/zrok

Analyze the terminal output to locate any version of zrok in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.1), 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-116: Improper Encoding or Escaping of Output, where the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. as a result, the intended structure of the message is not preserved. In zrok, 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

**Summary** The proxyUi template engine uses Go's text/template (which performs no HTML escaping) instead of html/template. The GitHub OAuth callback handlers in both publicProxy and dynamicProxy embed the attacker-controlled refreshInterval query parameter verbatim into an error message when time.ParseDuration fails, and render that error unescaped into HTML. An attacker can deliver a crafted login URL to a victim; after the victim completes the GitHub OAuth flow, the callback page executes arbitrary JavaScript in the OAuth server's origin. - Attack Vector: Network — the attack is delivered as a crafted URL over the internet. - Attack Complexity: Low — no race conditions or special environment prerequisites. - Privileges Required: None — the attacker needs no account on the zrok instance. - User Interaction: Required — the victim must click the crafted link and complete the GitHub OAuth flow. - Scope: Changed — the injected script executes in the OAuth server's origin, not the victim's share origin. - Confidentiality Impact: Low — the script runs in the OAuth server origin after a failed flow; no session cookie is set at this point, limiting what can be exfiltrated to what is visible in the DOM and what can be requested from the OAuth server. - Integrity Impact: Low — the script can initiate new OAuth flows or submit forms on behalf of the victim in the OAuth server origin. - Availability Impact: None. **Affected Components** - endpoints/proxyUi/template.go — init() / WriteTemplate (lines 8, 18, 99) — text/template used for HTML rendering - endpoints/proxyUi/template.html — line 119 — {{ .Error }} in HTML without escaping - endpoints/publicProxy/providerGithub.go — login callback closure (lines 93, 128, 130) - endpoints/dynamicProxy/providerGithub.go — loginHandler() (lines 110, 146, 148)

CVE-2026-40302 Affected zrok Versions

2 component(s)
Fixed Versions:
2.0.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/openziti/zrok
Go
≤ 1.1.11
github.com/openziti/zrok/v2
Go
< 2.0.1
2.0.1

References

Frequently Asked Questions

What is CVE-2026-40302?
CVE-2026-40302 is a security vulnerability in zrok involving Reflected XSS in GitHub OAuth callback via unsanitized refreshInterval error rendering under CWE-116: Improper Encoding or Escaping of Output.
Which zrok versions are affected?
Affected versions include releases prior to 2.0.1 across affected packages: github.com/openziti/zrok, github.com/openziti/zrok/v2.
What version fixes CVE-2026-40302?
Upgrading to 2.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/openziti/zrok affected?
Yes, github.com/openziti/zrok is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
Is github.com/openziti/zrok/v2 affected?
Yes, github.com/openziti/zrok/v2 is affected in releases prior to 2.0.1. Upgrade your dependency to 2.0.1 or later.
What is the CVSS score of CVE-2026-40302?
CVE-2026-40302 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2026-40302?
CVE-2026-40302 is classified under CWE-116: Improper Encoding or Escaping of Output (The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.).
How can I check Go dependencies for CVE-2026-40302?
Run the dependency tree command: 'inspect dependencies for github.com/openziti/zrok'. 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-4fxq-2x3x-6xqx",
  "modified" : "2026-04-24T20:48:45Z",
  "published" : "2026-04-16T21:08:55Z",
  "aliases" : [ "CVE-2026-40302" ],
  "summary" : "zrok: Reflected XSS in GitHub OAuth callback via unsanitized refreshInterval error rendering",
  "details" : "**Summary**\nThe proxyUi template engine uses Go's text/template (which performs no HTML escaping) instead of html/template. The GitHub OAuth callback handlers in both publicProxy and dynamicProxy embed the attacker-controlled refreshInterval query parameter verbatim into an error message when time.ParseDuration fails, and render that error unescaped into HTML. An attacker can deliver a crafted login URL to a victim; after the victim completes the GitHub OAuth flow, the callback page executes arbitrary JavaScript in the OAuth server's origin.\n\n- Attack Vector: Network — the attack is delivered as a crafted URL over the internet.\n- Attack Complexity: Low — no race conditions or special environment prerequisites.\n- Privileges Required: None — the attacker needs no account on the zrok instance.\n- User Interaction: Required — the victim must click the crafted link and complete the GitHub OAuth flow.\n- Scope: Changed — the injected script executes in the OAuth server's origin, not the victim's share origin.\n- Confidentiality Impact: Low — the script runs in the OAuth server origin after a failed flow; no session cookie is set at this point, limiting what can be exfiltrated to what is visible in the DOM and what can be requested from the OAuth server.\n- Integrity Impact: Low — the script can initiate new OAuth flows or submit forms on behalf of the victim in the OAuth server origin.\n- Availability Impact: None.\n\n**Affected Components**\n\n- endpoints/proxyUi/template.go — init() / WriteTemplate (lines 8, 18, 99) — text/template used for HTML rendering\n- endpoints/proxyUi/template.html — line 119 — {{ .Error }} in HTML without escaping\n- endpoints/publicProxy/providerGithub.go — login callback closure (lines 93, 128, 130)\n- endpoints/dynamicProxy/providerGithub.go — loginHandler() (lines 110, 146, 148)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/openziti/zrok"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "1.1.11"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/openziti/zrok/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/openziti/zrok/security/advisories/GHSA-4fxq-2x3x-6xqx"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40302"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/openziti/zrok"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openziti/zrok/releases/tag/v2.0.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-116", "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-16T21:08:55Z",
    "nvd_published_at" : "2026-04-17T21:16:34Z"
  }
}