Details
Expected vulnerable output:
=== RUN TestForgedAgentServiceResultCreatesHistoryForUnassignedService
--- PASS: TestForgedAgentServiceResultCreatesHistoryForUnassignedService
PASS
ok github.com/nezhahq/nezha/service/singleton
Observed output in my local test environment:
=== RUN TestForgedAgentServiceResultCreatesHistoryForUnassignedService
--- PASS: TestForgedAgentServiceResultCreatesHistoryForUnassignedService (0.01s)
PASS
ok github.com/nezhahq/nezha/service/singleton 0.020s
The test passes because a forged result from reporter server 2 creates a service-history row for victim service 10, even though service 10 only covers victim server 1.
A fixed version should reject or ignore this forged result. After a fix, the current PoC should fail at the assertion waiting for a ServiceHistory row unless the test is changed to assert that count == 0.
Note: this is a local processing-path PoC. It directly exercises the same service sentinel worker that the authenticated gRPC RequestTask path dispatches to. It does not open a network gRPC connection, send real notifications, or execute commands.
Impact
A low-privilege Nezha user with a valid agent secret can forge service-monitor results for services outside their ownership boundary.
Confirmed impact:
- Cross-tenant service-monitor integrity violation.
- False service history entries for victim-owned services.
- Poisoned service availability/current-state data.
Likely impact through the same processing path:
- Victim-owned service notifications can be triggered with attacker-controlled result text.
- Monitoring reliability can be degraded by false up/down/latency results.
This does not require dashboard administrator privileges. The attacker only needs a normal account/agent secret and one registered agent/server.