Mar 9, 2026·7 min read·3 visits
An authorization and data sanitization failure in Netmaker's REST API allows low-privileged authenticated users to extract the plaintext WireGuard private keys of all network endpoints.
Netmaker versions prior to 1.5.0 suffer from a critical excessive data exposure vulnerability (CWE-863). Authenticated users assigned the `platform-user` role can retrieve the cleartext WireGuard private keys for all nodes and external clients within a network via the REST API. This structural authorization failure allows an attacker to completely compromise network confidentiality by decrypting traffic and impersonating legitimate nodes.
Netmaker relies on the WireGuard protocol to establish encrypted overlay networks between distributed nodes. The security model depends entirely on the confidentiality of the WireGuard private keys generated for each node and external client. The Netmaker management server is responsible for coordinating these keys and distributing configuration data to endpoints.
The application implements role-based access control (RBAC) to distinguish between administrative users and standard users. Standard users, designated by the platform-user role, are permitted to view specific network topologies and basic configuration details. The Netmaker web interface actively masks sensitive cryptographic material from these users to prevent unauthorized key extraction.
However, the underlying REST API does not enforce the same data masking policies. The API endpoints responsible for serving node and external client configurations return the complete, unsanitized database objects to any authenticated user with access to the target network. This discrepancy between UI presentation and API response constitutes a critical excessive data exposure vulnerability.
By querying the API directly, a platform-user bypasses the UI-level masking and retrieves the cleartext WireGuard private keys. This flaw exists in Netmaker versions prior to 1.5.0 and fundamentally breaks the intended isolation between network administrators and standard participants.
The vulnerability originates from a structural failure in how the Go backend serializes internal data models into JSON responses. When an API request is made to retrieve network nodes, the endpoint handler queries the database and instantiates a slice of models.Node or models.ExtClient structures. These internal structures are designed to hold the complete state of the endpoint, including sensitive cryptographic material.
The models.Node struct contains a PrivateKey field which stores the base64-encoded WireGuard private key. In Go, the encoding/json standard library automatically serializes all exported fields (fields starting with a capital letter) unless explicitly instructed otherwise via struct tags. The PrivateKey field lacked the json:"-" tag, and the handler logic did not zero out this field before passing the object to the JSON encoder.
Furthermore, the authorization middleware protecting these endpoints only verifies that the requester holds the platform-user role for the specified network ID. It does not perform field-level authorization to conditionally strip sensitive data based on the user's privilege level. The middleware permits the read operation, and the handler indiscriminately returns the entire data model.
Because the backend logic assumes the frontend UI will handle data masking, it violates the principle of defense-in-depth. APIs must enforce security controls at the data serialization boundary, ensuring that clients only receive the data they are explicitly authorized to view.
An analysis of the vulnerable implementation reveals a direct pipeline from the database retrieval function to the HTTP response writer. The handler fetches the internal models and encodes them without an intermediate transformation step.
// VULNERABLE CODE PATTERN
func GetNodes(w http.ResponseWriter, r *http.Request) {
network := mux.Vars(r)["network"]
// Authorization check passes for 'platform-user'
// Fetches full internal models from database
nodes, err := database.GetNodesForNetwork(network)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
// Directly serializes internal models, exposing PrivateKey
json.NewEncoder(w).Encode(nodes)
}The remediation implemented in version 1.5.0 introduces a Data Transfer Object (DTO) pattern. Instead of serializing the internal models.Node struct directly, the application maps the data to a presentation-layer struct that explicitly omits sensitive fields for non-administrative users. Alternatively, the application conditionally blanks the fields based on the requester's role context.
// PATCHED CODE PATTERN
func GetNodes(w http.ResponseWriter, r *http.Request) {
network := mux.Vars(r)["network"]
userRole := GetUserRole(r)
nodes, err := database.GetNodesForNetwork(network)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
// Apply data sanitization based on role
for i := range nodes {
if userRole != "admin" {
nodes[i].PrivateKey = "" // Scrub sensitive data
}
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(nodes)
}This structural refactor ensures that the JSON encoder never receives the private cryptographic material when processing requests from unprivileged accounts, closing the excessive data exposure vector entirely.
Exploiting this vulnerability requires a valid set of credentials for the Netmaker management platform and assignment of the platform-user role to at least one target network. The attacker must also be able to route traffic to the Netmaker API endpoint.
The exploitation process begins with the attacker authenticating to the Netmaker server to obtain a JSON Web Token (JWT). This token serves as the Bearer credential for subsequent API requests. The attacker then extracts the target network ID, which is typically exposed in the legitimate application traffic or the UI dashboard.
Using a standard HTTP client, the attacker issues a GET request to the vulnerable endpoint, bypassing the UI entirely. The request targets /api/nodes/{network} or /api/extclients/{network}, supplying the obtained JWT in the Authorization header.
curl -s -H "Authorization: Bearer eyJhbGci..." \
https://api.netmaker.example.com/api/nodes/my-corporate-network | jq '.[].privatekey'The API responds with a JSON array containing objects for every node in the specified network. Because the serialization logic fails to strip sensitive fields, the privatekey attribute is populated with the base64-encoded WireGuard private key. The attacker parses this output to collect the cryptographic material for all network participants.
The exposure of WireGuard private keys results in a complete compromise of the logical network perimeter managed by Netmaker. WireGuard's security guarantees are predicated entirely on the secrecy of the private key; possessing this key grants the attacker identical capabilities to the legitimate node owner.
With the compromised keys, an attacker can passively decrypt captured WireGuard traffic destined for any node in the network. This breaks the confidentiality of all internal communications, potentially exposing secondary credentials, proprietary data, and internal application traffic.
Furthermore, the attacker can utilize the private keys to actively impersonate legitimate nodes. By configuring a local WireGuard interface with a stolen key and the corresponding network parameters, the attacker authenticates to the network infrastructure. This grants unauthorized access to restricted internal subnets and services that trust the Netmaker overlay network.
This vulnerability introduces a severe persistence mechanism. Because the attacker operates using valid cryptographic identities rather than exploited software services, the intrusion blends seamlessly with legitimate network traffic. Revoking the compromised keys requires a complete cryptographic rotation of the entire Netmaker environment, imposing significant operational overhead on the incident response team.
The definitive remediation for CVE-2026-29196 is upgrading the Netmaker application to version 1.5.0 or later. This release contains the necessary structural refactoring to enforce field-level authorization and prevent the serialization of cryptographic material in low-privileged API responses.
Organizations unable to immediately apply the patch must restrict access to the Netmaker API. Implementing strict network access controls via a Web Application Firewall (WAF) or reverse proxy to block requests to /api/nodes/* and /api/extclients/* from non-administrative IP addresses mitigates the direct exploitation vector. However, this may disrupt legitimate functionality for standard users.
Following the application of the patch, security teams must conduct a thorough audit of the Netmaker environment. All existing WireGuard private keys for nodes and external clients in environments where non-administrative users had access must be considered compromised. A complete key rotation is strictly required to evict any persistent attackers.
Detection of prior exploitation requires analyzing HTTP access logs for the Netmaker API. Security personnel should identify GET requests to the vulnerable endpoints originating from user accounts or IP addresses not associated with platform administrators. Additionally, network monitoring tools should baseline WireGuard connection patterns to detect anomalous IP addresses connecting with known legitimate public keys.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N| Product | Affected Versions | Fixed Version |
|---|---|---|
Netmaker Gravitl | < 1.5.0 | 1.5.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-863 (Incorrect Authorization) |
| Attack Vector | Network |
| CVSS Score | 8.7 (High) |
| EPSS Score | 0.00041 |
| Impact | Cryptographic Key Exposure / Full Network Decryption |
| Exploit Status | None Publicly Disclosed |
| KEV Status | Not Listed |
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check, leading to excessive data exposure.