Get a Demo

Let's Patch It!

Book a short call with one our specialists, we'll walk you through how Endor Patches work, and ask you a few questions about your environment (like your primary programming languages and repository management). We'll also send you an email right after you fill out the form, feel free to reply with any questions you have in advance!

CVE

CVE-2026-101090

Nezha: OAuth2 redirect_uri Host header injection regression when dashboard_host is empty
Back to all
CVE

CVE-2026-101090

Nezha: OAuth2 redirect_uri Host header injection regression when dashboard_host is empty

Summary

Nezha v2.2.3 regresses the GHSA-9rc6-8cjv-rcvx host header injection fix for deployments where the new dashboard_host setting is empty. In that configuration, /api/v1/oauth2/{provider} again reflects the request Host header into the OAuth2 redirect_uri sent to the identity provider, even if install_host is configured.

Impact

An attacker who can get a victim to start OAuth2 login through a request that reaches Nezha with a forged Host header can make Nezha send an attacker-controlled callback URL as the OAuth2 redirect_uri. If the configured OAuth2 provider accepts that redirect URI, the victim's authorization code is sent to the attacker origin. The attacker can then complete the OAuth2 binding or login flow described in GHSA-9rc6.

This is configuration-dependent, but it affects a realistic upgrade/default state because dashboard_host is a new optional field. The original v2.2.0 fix fell back to install_host; current v2.2.3 only falls back when dashboard_host is non-empty.

Reproduction

On current v2.2.3 / master commit 3d74cd9431a48fa89c6489689eac82a872799ea0, configure OAuth2 and set an existing dashboard host only through install_host, leaving dashboard_host empty. Then send the OAuth2 redirect request with a forged Host header:

GET /api/v1/oauth2/github?type=1 HTTP/1.1
Host: evil.attacker.test
X-Forwarded-Proto: https

The generated OAuth2 authorization URL contains:

redirect_uri=https%3A%2F%2Fevil.attacker.test%2Fapi%2Fv1%2Foauth2%2Fcallback

A minimal route-level unit test demonstrating the issue is:

func TestOAuth2Redirect_RegressionWhenDashboardHostEmptyReflectsForgedHost(t *testing.T) {
    defer setupOAuth2Test(t)()
    singleton.Conf.InstallHost = "legit-dashboard.example.com"
    singleton.Conf.DashboardHost = ""
    singleton.Conf.Oauth2["github"] = &model.Oauth2Config{
        ClientID: "client-id",
        ClientSecret: "client-secret",
        Endpoint: model.Oauth2Endpoint{AuthURL: "https://idp.example.test/authorize", TokenURL: "https://idp.example.test/token"},
        Scopes: []string{"openid"},
    }
    c, _ := newOAuth2Ctx(t)
    c.Params = gin.Params{{Key: "provider", Value: "github"}}
    c.Request.Host = "evil.attacker.test"
    c.Request.URL.RawQuery = "type=1"
    c.Request.Header.Set("X-Forwarded-Proto", "https")
    resp, err := oauth2redirect(c)
    require.NoError(t, err)
    parsed, err := url.Parse(resp.Redirect)
    require.NoError(t, err)
    require.Equal(t, "https://evil.attacker.test/api/v1/oauth2/callback", parsed.Query().Get("redirect_uri"))
}

The corresponding control with DashboardHost = "panel.example.com" pins the same forged request to https://panel.example.com/api/v1/oauth2/callback, so the issue is specifically the empty dashboard_host fallback.

Root cause

Current cmd/dashboard/controller/oauth2.go chooses the request Host unless DashboardHost is non-empty:

host := c.Request.Host
if !singleton.IsReservedDashboardHost(host) && singleton.Conf != nil && singleton.Conf.DashboardHost != "" {
    host = singleton.Conf.DashboardHost
}
return scheme + host + "/api/v1/oauth2/callback"

The v2.2.0 fix used InstallHost as the fallback for untrusted request hosts. After DashboardHost was introduced, empty dashboard_host now disables host pinning and reintroduces the original Host header injection behavior for those deployments.

Remediation

Build the OAuth2 callback URL from a deterministic configured origin. For example:

  1. Use DashboardHost when it is set.
  2. Otherwise fall back to InstallHost if it is set, preserving the v2.2.0 invariant for existing deployments.
  3. If neither value is set, reject OAuth2 redirect initiation with a configuration error instead of reflecting request Host.

Please also add a regression test that InstallHost plus empty DashboardHost does not reflect a forged Host into redirect_uri.

Package Versions Affected

Package Version
patch Availability
No items found.

Automatically patch vulnerabilities without upgrading

Fix Without Upgrading
Detect compatible fix
Apply safe remediation
Fix with a single pull request

CVSS Version

Severity
Base Score
CVSS Version
Score Vector
C
H
U
9.3
-
4.0
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
C
H
U
0
-
C
H
U
-

Related Resources

No items found.

References

https://github.com/nezhahq/nezha/security/advisories/GHSA-rf68-8gjr-36q7, https://github.com/nezhahq/nezha/commit/38824dbc11a63964c5b9296ae4c68e62b34fa04b, https://github.com/nezhahq/nezha

Severity

9.8

CVSS Score
0
10

Basic Information

Base CVSS
9.8
EPSS Probability
0.00358%
EPSS Percentile
0.27496%
Introduced Version
Fix Available

Fix Critical Vulnerabilities Instantly

Secure your app without upgrading.
Fix Without Upgrading