/

CVE-2026-49396

Severity:

HIGH RISK

(7.1)

CSRF (CWE-352) in Nezha Monitoring Cron Execution

CVE-2026-49396

Deferred

Vulnerability type

Category:

Cross-Site Request Forgery (CSRF)

CWE:

CWE-352

Impact:

Unauthorized Command Execution on Managed Agents

Severity:

HIGH RISK

(7.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A cross-site request forgery (CSRF) flaw in Nezha Monitoring allows crafted GET requests to trigger stored cron commands on connected agents.

If a logged-in user is tricked into visiting a malicious page, previously configured cron jobs may execute on their monitored servers without explicit consent.

Affected context

This vulnerability arises in Nezha Monitoring deployments where users manage cron-style commands for their monitored servers or agents through the web interface.

When a user with an active authenticated session is induced to load a malicious external page, that page can issue cross-site GET requests to the Nezha instance.

Under these conditions, the application may accept those requests as if the user had intentionally initiated them, causing stored cron commands to be triggered on agents.

Exploit preconditions

  • Attack surface: Nezha Monitoring web interface endpoints that trigger stored cron execution via HTTP GET.
  • Required access: The victim must be authenticated in Nezha (e.g., via active session or remembered login).
  • Trigger point: The victim's browser loads attacker-controlled HTML/JavaScript that silently issues cross-origin GET requests to Nezha.
  • Why exploitation is possible: The affected endpoints rely solely on the browser session for trust and lack robust CSRF protections (such as per-request tokens or same-site enforcement), so cross-origin GET requests are treated as legitimate user actions.

Why this happens

The root cause is a missing or insufficient CSRF protection mechanism on endpoints that trigger execution of stored cron commands.

In CSRF scenarios, a web application trusts any request carrying a valid session cookie, without verifying that the request originated from the legitimate site context.

This maps to CWE-352: Cross-Site Request Forgery (CSRF), where state-changing or sensitive operations are bound only to implicit browser authentication state rather than explicit proof of user intent, allowing attackers to cause unintended actions via cross-site requests.

Potential impact

  • Attackers could cause stored cron commands to run on one or more monitored agents.
  • Malicious or destructive maintenance tasks could be executed under the guise of legitimate automation.
  • System configuration, services, or application data on monitored servers could be altered through triggered cron jobs.
  • Monitoring infrastructure integrity and reliability could be degraded or manipulated.

General mitigation guidance

Effective mitigation focuses on requiring explicit proof of user intent for state-changing or sensitive operations exposed via the web interface.

Common defensive patterns include:

  • Enforcing anti-CSRF tokens on all endpoints that trigger command or cron execution, and validating them server-side.
  • Restricting sensitive actions to HTTP methods intended for state changes (e.g., POST/PUT/DELETE) instead of GET.
  • Applying SameSite and secure cookie attributes to reduce cross-site request impact, while not treating them as a complete CSRF solution.
  • Introducing additional confirmation mechanisms (e.g., confirmation dialogs or secondary checks) for high-impact operations targeting multiple agents.
  • Designing the API so that automation or remote triggering uses dedicated, scoped tokens rather than browser-based session cookies.

How teams detect issues like this

Detection and assurance efforts can focus on identifying endpoints that change state without CSRF protections:

  • Use static analysis or manual code review to flag state-changing handlers that are accessible via GET or lack CSRF token validation.
  • Review routing and controller logic for any command or cron execution paths that depend only on session cookies for authorization.
  • Implement automated security tests or integration tests that attempt cross-site requests without CSRF tokens and verify they are rejected.
  • Employ web application security scanners and CI-integrated tools configured to detect missing CSRF protections on sensitive endpoints.

Sources

SourceLink
github.comgithub.com/nezhahq/nezha/security/advisories/GHSA-8qhj-4f8c-j8qg

Frequently asked

questions

Yes, but indirectly. An attacker typically must lure a user who is logged into Nezha Monitoring into visiting a malicious page that issues the cross-site GET requests. The attacker does not need direct network access to the Nezha instance if the victim's browser can reach it.

The attacker does not require their own Nezha account. They rely on the victim's existing authenticated session. The victim must have privileges to manage or trigger cron commands on agents for exploitation to have meaningful effect.

Require robust CSRF protections on all endpoints that trigger cron or command execution, ensure these actions use non-idempotent HTTP methods (such as POST) with validated CSRF tokens, and avoid performing impactful state changes via simple GET requests.

Adopt a framework-level CSRF strategy, mandate CSRF tokens for any state-changing operation, define clear guidelines around using GET only for safe, idempotent reads, and enforce these rules via code review, static analysis, and automated security testing in the development pipeline.

Find out what's already
exploitable in your codebase.