Skip to main content

nebula-mesh CVE-2026-47726

HIGH
Improper Authorization (CWE-285)
2026-06-08 https://github.com/juev/nebula-mesh GHSA-qm33-p5p9-f8vg
Share

Lifecycle Timeline

2
Source Code Evidence Fetched
Jun 09, 2026 - 00:13 vuln.today
Analysis Generated
Jun 09, 2026 - 00:13 vuln.today

DescriptionCVE.org

internal/api/audit.go:12 - handleGetAuditLog does no admin check. The route is bearer-auth gated only; any operator API key returns the full audit log via store.ListAuditEntries (up to limit=1000). This includes cross-tenant actor names, host/CA/operator IDs, action timestamps, and masked-IP entries from rate-limit refusals - enough surface for a tenant to enumerate the server's activity, infer staffing patterns, or identify high-value targets.

Affected

All released versions up to v0.3.1.

Reproducer

curl -H "Authorization: Bearer <any-operator-key>" \
  https://server/api/v1/audit-log?limit=1000

Suggested fix

Two options, either acceptable:

  1. if !actorIsAdmin(ctx) { 403 } - strictest; matches the "operator management is admin-only" stance.
  2. Scope to actor: filter store.ListAuditEntries by actor.Username plus a subquery of CA IDs the actor owns. Operators see their own audit entries plus entries against their CA's resources.

Recommend option 1 unless the UI needs per-operator audit views.

Suggested patch

Verified locally: go vet, go test -race -count=1 ./..., golangci-lint v2.12 all clean.

diff
diff --git a/internal/api/audit.go b/internal/api/audit.go
index 3236631..57b57ce 100644
--- a/internal/api/audit.go
+++ b/internal/api/audit.go
@@ -10,6 +10,10 @@ import (
 const defaultAuditLimit = 100

 func (s *Server) handleGetAuditLog(w http.ResponseWriter, r *http.Request) {
+	if !actorIsAdmin(r.Context()) {
+		writeError(w, http.StatusForbidden, "audit log access requires the admin role")
+		return
+	}
 	filter := store.AuditFilter{
 		Action: r.URL.Query().Get("action"),
 		Limit:  defaultAuditLimit,
diff --git a/internal/api/audit_admin_test.go b/internal/api/audit_admin_test.go
new file mode 100644
index 0000000..47e1ca4
--- /dev/null
+++ b/internal/api/audit_admin_test.go
@@ -0,0 +1,62 @@
+package api
+
+import (
+	"context"
+	"crypto/sha256"
+	"encoding/hex"
+	"net/http"
+	"net/http/httptest"
+	"testing"
+
+	"github.com/google/uuid"
+	"github.com/juev/nebula-mesh/internal/models"
+)
+
+// TestHandleGetAuditLog_NonAdminForbidden confirms a non-admin operator
+// API key cannot read the audit log. The legacy config-key path stays
+// admin and is covered by the happy-path test elsewhere.
+func TestHandleGetAuditLog_NonAdminForbidden(t *testing.T) {
+	srv, _ := newTestServer(t)
+
+	nonAdminKey := uuid.New().String()
+	keyHash := sha256.Sum256([]byte(nonAdminKey))
+	if err := srv.store.CreateOperator(context.Background(), &models.Operator{
+		ID: uuid.New().String(), Username: "non-admin", PasswordHash: "x",
+		Role: "user", Status: models.OperatorStatusActive,
+	}); err != nil {
+		t.Fatal(err)
+	}
+	op, err := srv.store.GetOperatorByUsername(context.Background(), "non-admin")
+	if err != nil {
+		t.Fatal(err)
+	}
+	if err := srv.store.CreateOperatorAPIKey(context.Background(), &models.OperatorAPIKey{
+		ID: uuid.New().String(), OperatorID: op.ID, KeyHash: hex.EncodeToString(keyHash[:]),
+	}); err != nil {
+		t.Fatal(err)
+	}
+
+	req := httptest.NewRequest("GET", "/api/v1/audit-log", nil)
+	req.Header.Set("Authorization", "Bearer "+nonAdminKey)
+	rec := httptest.NewRecorder()
+	srv.ServeHTTP(rec, req)
+
+	if rec.Code != http.StatusForbidden {
+		t.Errorf("non-admin audit-log status = %d, want 403", rec.Code)
+	}
+}
+
+// TestHandleGetAuditLog_LegacyKeyAllowed confirms the legacy config-key
+// path still reaches the handler (preserves backward compatibility).
+func TestHandleGetAuditLog_LegacyKeyAllowed(t *testing.T) {
+	srv, _ := newTestServer(t)
+
+	req := httptest.NewRequest("GET", "/api/v1/audit-log", nil)
+	req.Header.Set("Authorization", "Bearer "+testAPIKey)
+	rec := httptest.NewRecorder()
+	srv.ServeHTTP(rec, req)
+
+	if rec.Code == http.StatusForbidden {
+		t.Errorf("legacy key rejected with 403; want pass-through")
+	}
+}

AnalysisAI

Information disclosure in nebula-mesh through v0.3.1 allows any holder of an operator API key to read the server-wide audit log via GET /api/v1/audit-log, exposing cross-tenant actor names, host/CA/operator IDs, action timestamps, and masked-IP entries. The handleGetAuditLog endpoint enforces only bearer authentication with no admin-role check, so a low-privilege tenant can enumerate staffing patterns and high-value targets. Publicly available exploit code exists in the form of a one-line curl reproducer published in the GHSA advisory; no public exploit identified at time of analysis as actively weaponized, and the issue is not on CISA KEV.

Technical ContextAI

nebula-mesh is a Go-based control-plane server (package github.com/juev/nebula-mesh) for managing Nebula overlay-network certificate authorities, hosts, and operators in a multi-tenant deployment. The root cause is CWE-285 (Improper Authorization): the HTTP handler at internal/api/audit.go:12 trusts the bearer-auth middleware to gate the route but performs no further role check, so authentication is conflated with authorization. The endpoint invokes store.ListAuditEntries with a caller-supplied limit (up to 1000) and returns unfiltered records that span all tenants, including operator IDs, CA IDs, host IDs, action verbs, timestamps, and masked source IPs captured from rate-limit refusals. The codebase already exposes an actorIsAdmin(ctx) helper used elsewhere, confirming an admin role model exists and was simply not applied to this route.

RemediationAI

Vendor-released patch: upgrade to nebula-mesh v0.3.2, published at https://github.com/forgekeep/nebula-mesh/releases/tag/v0.3.2, which adds an actorIsAdmin(r.Context()) gate returning HTTP 403 for non-admin callers (commit 8baaace54c2a23e7c351b3efab5a31ab07b125dc). If immediate upgrade is not possible, the most effective compensating control is to revoke or refuse to issue non-admin operator API keys until patched, since the route is bearer-auth gated and cannot distinguish roles; alternatively, block /api/v1/audit-log at a reverse proxy and restrict it by source IP or mTLS to admin workstations, accepting that legitimate non-admin audit-log UI features (if any) will break. A code-level alternative described in the advisory is to scope store.ListAuditEntries by actor.Username plus owned-CA IDs, which preserves per-operator audit visibility but requires custom backporting and is not the upstream fix.

Share

CVE-2026-47726 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy