Summary
Nezha Monitoring contains an authorization flaw that allows a user with the RoleMember role to trigger cron tasks owned by other users via the AlertRule.FailTriggerTasks functionality.
When an attacker abuses this missing ownership check, they can cause arbitrary scheduled jobs to run, potentially impacting monitored systems and operational workflows.
Affected context
The vulnerability appears in Nezha Monitoring deployments using versions from 1.4.0 up to but not including 2.0.8 where role-based access control governs who can manage and trigger cron-style tasks.
Specifically, the AlertRule.FailTriggerTasks logic does not verify task ownership, so any user granted the RoleMember role can invoke that path to fire cron tasks associated with other accounts, regardless of task isolation expectations.
Environments that rely on Nezha's scheduled tasks for operational or automation workflows are particularly exposed.
Exploit preconditions
- Attack surface: Nezha Monitoring web/API interface where AlertRule.FailTriggerTasks is exposed
- Required access: Valid authenticated account with RoleMember privileges in the affected Nezha instance
- Trigger point: Invoking the alert rule failure handling or the relevant endpoint that calls AlertRule.FailTriggerTasks
- Why exploitation is possible: The implementation does not enforce an ownership or permission check linking the caller's identity to the cron task being triggered, enabling horizontal privilege abuse across users' tasks
Why this happens
The underlying issue is a broken access control pattern where authorization is either missing or incorrectly enforced on a sensitive operation.
AlertRule.FailTriggerTasks is responsible for firing configured cron tasks when alert conditions are met, but it lacks a check to ensure that the caller is authorized to operate on the specific task instance.
This maps to CWE-863: Incorrect Authorization and is closely related to CWE-862: Missing Authorization, because the code relies on the RoleMember role alone and does not validate resource ownership or fine-grained permissions before triggering tasks belonging to other users.
Potential impact
- Unauthorized execution of other users' cron tasks that may affect monitored servers or services
- Indirect access to systems or data through tasks that encapsulate privileged actions
- Disruption of operational workflows, including premature, repeated, or out-of-window job runs
- Facilitation of lateral movement if triggered tasks perform administrative or maintenance operations on downstream infrastructure
General mitigation guidance
Effective mitigation centers on enforcing strict, resource-level access control for any operation that manipulates or triggers scheduled tasks.
Implementations commonly:
- Validate task ownership or explicit ACLs before allowing a user to fire or modify a cron task
- Apply the principle of least privilege so that generic roles like RoleMember are limited to their own resources by default
- Centralize authorization checks in middleware or service layers to avoid ad-hoc or inconsistent permission logic
- Introduce clear boundaries between alert-handling mechanisms and task execution, ensuring that cross-user actions require elevated, audited permissions
- Log all cross-resource operations and design the system so that sensitive operations are safe to invoke even when alerts are misconfigured or abused
How teams detect issues like this
Detection can focus on both code-level patterns and runtime behavior:
- Static analysis and code review to identify controller or handler paths that invoke task execution without verifying the requesting user's ownership or scope
- Policy checks that flag any use of broad roles (such as RoleMember) in high-impact actions where no resource-level authorization exists
- Logging and monitoring to surface anomalous patterns where one user frequently triggers tasks belonging to many different users or projects
- Periodic security testing and authorization mapping exercises to verify that each API endpoint involving task operations enforces consistent, central authorization rules
- Incorporation of automated review tools that look for missing or inconsistent authorization guards around business logic methods like AlertRule.FailTriggerTasks

