GHSA-RF68-8GJR-36Q7

GHSA-RF68-8GJR-36Q7 is a low-severity open redirect vulnerability in github.com/nezhahq/nezha (go), affecting versions = 2.2.3. No fixed version is listed yet.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Nezha: OAuth2 redirecturi Host header injection regression when dashboardhost is empty

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.

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.

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.

Untrusted input controls a URL used for redirection, which can forward users to attacker-controlled sites. Typical impact: phishing and credential harvesting via a trusted domain.

Affected versions

github.com/nezhahq/nezha (= 2.2.3)

Security releases

Not available

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

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.

Frequently Asked Questions

  1. What is GHSA-RF68-8GJR-36Q7? GHSA-RF68-8GJR-36Q7 is a low-severity open redirect vulnerability in github.com/nezhahq/nezha (go), affecting versions = 2.2.3. No fixed version is listed yet. Untrusted input controls a URL used for redirection, which can forward users to attacker-controlled sites.
  2. Which versions of github.com/nezhahq/nezha are affected by GHSA-RF68-8GJR-36Q7? github.com/nezhahq/nezha (go) versions = 2.2.3 is affected.
  3. Is there a fix for GHSA-RF68-8GJR-36Q7? No fixed version is listed for GHSA-RF68-8GJR-36Q7 yet. Monitor the advisory for updates and apply mitigations in the interim.
  4. Is GHSA-RF68-8GJR-36Q7 exploitable, and should I be worried? Whether GHSA-RF68-8GJR-36Q7 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  5. What actually determines whether GHSA-RF68-8GJR-36Q7 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  6. How do I fix GHSA-RF68-8GJR-36Q7? No fixed version is listed yet. In the interim: Validate redirect destinations against an allowlist of permitted URLs or paths. Reject destinations that include an unexpected authority component.

Stop the waste.
Protect your environment with Kodem.