Background

Nezha is a self-hosted, lightweight server and website monitoring and operations tool written in Go. Small agents installed on each machine report CPU, memory, network and uptime to a central dashboard, and the dashboard also lets users manage those machines.

Several people can share one dashboard. A member account sees and manages only the servers assigned to it, and an administrator manages everything. Each server has a numeric ID, and requests such as “read the configuration of server 42” use that ID in the URL. Keeping members from seeing each other’s machines is the tenant isolation the dashboard enforces.

Terms used below:

  • Enumeration is systematically trying identifiers to learn which ones exist.
  • Oracle is any behavior that answers a yes/no question for an attacker, even when the answer is hidden inside an error message.
  • IDOR (insecure direct object reference) is a family of bugs where an application uses an identifier from the request to find an object without confirming that the caller may access it.

Summary

The configuration endpoints reveal whether a guessed server ID belongs to another tenant, even though the caller cannot access that server. They return a permission error for an existing foreign server but empty success data for an unknown ID. Comparing those responses lets an ordinary member map other users’ server inventory.

For example, a member whose own server has ID 101 can probe nearby numbers and distinguish “another tenant owns this server” from “this number has never been assigned.” Tenant isolation should hide that distinction as well as the server’s configuration. The leak comes from the difference between the responses, rather than either response in isolation.

How the Vulnerability Works

This is a quieter kind of access-control bug. The attacker does not read or change anything they should not. They only learn whether something exists. The permission system works for the server’s data, and the error handling gives the answer away.

Two endpoints, GET /api/v1/server/config/{id} and POST /api/v1/server/config, handle a configuration request. For a server ID, the handler first looks the server up and only then checks that the caller owns it. There are three possible outcomes, and two of them look different from the outside:

Guessed IDWhat the handler doesResponse to the caller
One of the caller’s own serversFound, ownership check passesSuccess (normal response)
A server belonging to someone elseFound, ownership check failspermission denied
An ID that nobody has been assignedLookup failsSuccess with empty data

The difference between the second and third rows is the leak. A member whose own server has ID 101 can ask for 102, 103, 104 and so on, and the responses reveal which numbers belong to other tenants. Repeating this over the whole range gives a picture of how many servers the instance has and how the IDs are laid out. In a hosting setting that can reveal the size of the deployment and which numbers to target next.

The fix is to make the two failures indistinguishable, so that “not yours” and “does not exist” produce the same response. Nezha’s maintainers had already done this for a sibling endpoint, forceUpdateServer, so the intended behavior was already established. The impact is small (the published rating is 4.3, medium, under CVSS v3.1), but existence leaks are a standard first step toward heavier attacks. The advisory classifies it as information exposure (CWE-200) through an insecure direct object reference (CWE-639).

Prerequisites

A signed-in member account is sufficient. Administrator privileges, ownership of the target server and an agent connection are unnecessary. The account only needs to call the configuration endpoints with guessed identifiers.

Server IDs are application identifiers, not authentication tokens. Their predictability makes repeated probing practical, but the underlying failure is that an unauthorized caller can learn whether a protected object exists.

Attack Path

Attack route
Attacker routeMitigationCtrl + scroll to zoom
  1. START
    Authenticated member
  2. STEP 01
    Submit a guessed server ID

    The member can call both configuration endpoints without owning the guessed server.

    MITIGATION Enforce tenant-scoped object lookup

  3. STEP 02
    Compare foreign and missing responses

    A permission error identifies an existing foreign object. Empty success data identifies a missing object.

    MITIGATION Return indistinguishable responses for inaccessible and unknown IDs

  4. STEP 03
    Repeat across sequential IDs

    Each comparison adds one observation about the instance’s server inventory.

  5. STEP 04
    Infer other tenants’ server inventory

Root Cause

Both getServerConfig and setServerConfig expose the same response difference.

The relevant checks happen in GET /api/v1/server/config/{id} and POST /api/v1/server/config. The handlers look up the server before checking ownership. A failed lookup produces a successful response with empty data, whereas a successful lookup followed by a failed permission check produces permission denied. An attacker does not need to defeat the ownership check: its distinct failure response supplies the information.

This is an example of an existence oracle, where an operation reveals one fact about a protected object even though it refuses the operation itself. The maintainers had already fixed the same pattern in forceUpdateServer (commit 710a2c73), which treats foreign and missing identifiers alike.

Validation

The proof of concept on v2.3.14 compared foreign server ID 100 with absent ID 999999. The GET responses were a permission error and {"success":true,"data":null} respectively. The POST responses were a permission error and {"success":true,"data":{}}. An owned server provided a normal-use control. These comparisons show that the response body alone is sufficient. The attacker does not need a timing side channel.

An update attempt against the foreign server was denied. This confirms that the leaked identifier did not grant write access.

Probe as a memberIntended observationRecorded observation
Own serverNormal authorized behaviorSuccessful response
Existing foreign serverIndistinguishable from an inaccessible or missing objectPermission error
Missing serverSame observable outcome as the foreign caseSuccess with empty data

Impact

The demonstrated leak is server existence across tenant boundaries, allowing a member to build an inventory of other users’ machines. The controls did not establish configuration access or cross-tenant modification: knowing a server ID did not make that server writable.

GitHub rates the finding 4.3 under CVSS v3.1, while VulnCheck rates it 5.3 under CVSS v4.0. The Overview uses the GitHub assessment.

Remediation

Upgrade to 2.3.15 or later. The maintainer resolution makes foreign and unknown IDs indistinguishable.

The important correction is response equivalence for callers without access: unknown and inaccessible objects should reach the same externally observable outcome. Applying that rule consistently to both handlers closes the oracle without relying on server IDs being difficult to guess.

Apply the same response treatment to bulk operations and configuration writes, including their error bodies. A fix in one handler leaves the inventory exposed if another handler still distinguishes foreign and missing IDs.

References