GHSA-rf68-8gjr-36q7: Go/github.com/nezhahq/nezha vulnerability

Published Sep 15, 2026
·
Updated

Summary

Nezha v2.2.3 regresses the GHSA-9rc6-8cjv-rcvx host header injection fix for deployments where the new dashboardhost setting is empty. In that configuration, /api/v1/oauth2/{provider} again reflects the request Host header into the OAuth2 redirecturi sent to the identity provider, even if installhost 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 redirecturi. 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 dashboardhost is a new optional field. The original v2.2.0 fix fell back to installhost; current v2.2.3 only falls back when dashboardhost is non-empty.

Reproduction

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

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

The generated OAuth2 authorization URL contains:

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

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

go func TestOAuth2RedirectRegressionWhenDashboardHostEmptyReflectsForgedHost(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("redirecturi")) }

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 dashboardhost fallback.

Root cause

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

go 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 dashboardhost 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 redirecturi.

Affected Software

1 affected component
go/github.com/nezhahq/nezha=2.2.3

Event History

Sep 15, 2026
Advisory Published
via GitHub·07:50 PM
Data Sourced
via GitHub·07:50 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are exposed?

Deployments running Nezha v2.2.3 or the identified master commit are exposed when OAuth2 is configured, dashboard_host is empty, and the dashboard host is configured only through install_host. This is a realistic upgrade or default state because dashboard_host is a new optional field.

2

What does an attacker need for exploitation to succeed?

The attacker must cause a victim to begin an OAuth2 login through a request that reaches Nezha with a forged Host header. The configured OAuth2 provider must also accept the attacker-controlled redirect URI.

3

How can I determine whether my configuration is affected?

Check whether dashboard_host is empty while install_host is the only setting defining the existing dashboard host, and whether OAuth2 is enabled. In that state, the OAuth2 endpoint can derive the redirect URI from the request Host header rather than using install_host.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203