← Blog

Claude MCP skill privilege escalation — analytics dashboard and report management endpoints (SA-SKL-PRIVESC63)

SA-SKL-PRIVESC63 identifies four privilege escalation vulnerabilities in MCP skill registry analytics dashboard and report management endpoints. The analytics dashboard access level is read from the JWT analyticsScope claim rather than from a database-backed authorization record; crafting a JWT with analyticsScope:'global_analytics' grants access to cross-skill revenue data, aggregate install metrics, and publisher revenue attribution figures across the entire skill catalog that should only be accessible to registry administrators; the analytics scope assignment endpoint at POST /api/registry/analytics/access is missing a scope boundary check that would prevent verified publishers from assigning the global_analytics scope to themselves, allowing any verified publisher to self-grant the highest-privilege analytics scope and bypass the manual review queue that the registry requires for administrative analytics access; the global analytics configuration endpoint at PATCH /api/registry/analytics/config is missing an ownership check, allowing any authenticated user to modify the global analytics retention periods, revenue attribution windows, and cohort analysis thresholds that affect revenue report calculations for every publisher in the registry; and the analytics scope cache key uses only userId without including analyticsConfigVersionId, meaning cache entries bleed across analytics configuration upgrades and revoked global_analytics scopes remain active until the cache TTL expires.

SA-SKL-PRIVESC63 findings at a glance
CRITICALPRIVESC63-001 — Analytics dashboard access level read from JWT analyticsScope claim — craft JWT with analyticsScope:'global_analytics' grants access to cross-skill revenue data, aggregate install metrics, and publisher revenue attribution across all skills
CRITICALPRIVESC63-002 — POST /api/registry/analytics/access missing scope boundary check — any verified publisher assigns global_analytics scope to themselves bypassing analytics access approval process
HIGHPRIVESC63-003 — PATCH /api/registry/analytics/config missing ownership check — any authenticated user modifies global analytics retention periods, revenue attribution windows, and cohort analysis thresholds affecting all publisher revenue reports
MEDIUMPRIVESC63-004 — Analytics scope cache key uses userId without analyticsConfigVersionId — cache entries bleed across analytics config upgrades; revoked global_analytics scopes retained until TTL expiry

PRIVESC63-001 — JWT analyticsScope forgery grants cross-skill revenue data access

The analytics dashboard access control reads the user's analytics scope from the JWT analyticsScope claim. Because the JWT is signed by the registry's authentication service, a standard user cannot forge this claim directly. However, if the registry's JWT signing key is ever leaked (a risk compounded by SSRF, command injection, or other server-side vulnerabilities in adjacent endpoints), an attacker can mint a JWT with analyticsScope:'global_analytics' that grants access to aggregate revenue data, cross-skill install attribution metrics, and publisher earnings breakdowns across the entire registry without any database-side authorization check.

Vulnerable
// PRIVESC63-001 — VULNERABLE: analyticsScope read from JWT claim
router.get('/analytics/dashboard', requireSession, async (req, res) => {
  const analyticsScope = req.session.jwt.analyticsScope;  // from JWT — forgeable
  const data = await analytics.getDashboard({
    userId: req.session.userId,
    globalAccess: analyticsScope === 'global_analytics',
  });
  res.json(data);
});
Fixed
// PRIVESC63-001 — FIXED: DB-backed analytics scope lookup by userId; JWT carries only sub
router.get('/analytics/dashboard', requireSession, async (req, res) => {
  const record = await db.getAnalyticsScope(req.session.userId);  // DB lookup — not JWT
  const data = await analytics.getDashboard({
    userId: req.session.userId,
    globalAccess: record?.scope === 'global_analytics' && record?.status === 'active',
  });
  res.json(data);
});

PRIVESC63-002 — Analytics scope self-assignment bypasses approval process

The analytics scope assignment endpoint processes scope grant requests submitted by verified publishers. The endpoint checks that the requesting user has at minimum the verified_publisher scope, but it does not check that the requested scope (targetScope in the request body) is at a level higher than the current user's scope. Any verified publisher can therefore submit a request assigning global_analytics to their own account, bypassing the manual admin review queue entirely and gaining immediate access to cross-skill revenue data.

Vulnerable
// PRIVESC63-002 — VULNERABLE: no scope boundary check on assignment
router.post('/registry/analytics/access', requireSession, async (req, res) => {
  const { targetUserId, targetScope } = req.body;
  if (!req.session.roles.includes('verified_publisher')) {
    return res.status(403).json({ error: 'Must be verified_publisher' });
  }
  // No check that targetScope <= requester's scope — self-assignment to global_analytics works:
  await db.setAnalyticsScope(targetUserId, targetScope);
  res.json({ assigned: true });
});
Fixed
// PRIVESC63-002 — FIXED: scope ordinal check; prevent self-assignment to global_analytics;
// require admin queue for top-tier scope
const ANALYTICS_SCOPE_ORDER = ['none', 'own_skills', 'verified_publisher', 'global_analytics'];

router.post('/registry/analytics/access', requireSession, async (req, res) => {
  const { targetUserId, targetScope } = req.body;
  const requesterScope = await db.getAnalyticsScope(req.session.userId);
  const requesterOrdinal = ANALYTICS_SCOPE_ORDER.indexOf(requesterScope?.scope || 'none');
  const targetOrdinal = ANALYTICS_SCOPE_ORDER.indexOf(targetScope);
  if (targetOrdinal < 0) return res.status(400).json({ error: 'Invalid targetScope' });
  if (targetOrdinal >= requesterOrdinal) {
    return res.status(403).json({ error: 'Cannot assign scope >= own scope' });
  }
  if (targetScope === 'global_analytics') {
    await db.queueAnalyticsScopeRequest(targetUserId, targetScope, req.session.userId);
    return res.json({ queued: true, requiresAdminApproval: true });
  }
  await db.setAnalyticsScope(targetUserId, targetScope);
  await auditLog.write({ action: 'analytics.scope.assign', actorId: req.session.userId,
    targetUserId, targetScope, at: new Date() });
  res.json({ assigned: true });
});

PRIVESC63-003 — Global analytics config writable by any authenticated user

The global analytics configuration endpoint processes PATCH requests that modify registry-wide settings including data retention periods, revenue attribution windows, and cohort analysis thresholds. The endpoint requires a valid session but does not check whether the requesting user has the analytics_admin role or any elevated privilege level. Any authenticated user can modify the global configuration, potentially shortening retention periods to destroy historical data, adjusting revenue attribution windows to shift earnings between publishers, or disabling cohort analysis features that the registry provides as a premium service.

Vulnerable
// PRIVESC63-003 — VULNERABLE: no role check on global analytics config update
router.patch('/registry/analytics/config', requireSession, async (req, res) => {
  const updates = req.body;  // any authenticated user can update global config
  await db.updateAnalyticsConfig(updates);
  res.json({ updated: true });
});
Fixed
// PRIVESC63-003 — FIXED: require analytics_admin role; Zod schema with bounds;
// reAuthRequired; bump configVersion; audit log with before/after diff
router.patch('/registry/analytics/config', requireSession, requireRole('analytics_admin'),
  reAuthRequired, async (req, res) => {
  const updates = AnalyticsConfigUpdateSchema.parse(req.body);  // Zod: bounds on all fields
  const before = await db.getAnalyticsConfig();
  await db.updateAnalyticsConfig(updates);
  const newVersion = await db.bumpAnalyticsConfigVersion();
  await auditLog.write({ action: 'analytics.config.update', actorId: req.session.userId,
    configVersion: newVersion, before, after: updates, at: new Date() });
  res.json({ updated: true, configVersion: newVersion });
});

PRIVESC63-004 — Analytics scope cache bleed across config upgrades

The analytics scope authorization cache stores entries keyed by userId alone. When an analytics configuration upgrade occurs (for example, when the global_analytics scope definition is revised to exclude a previously included data category), or when a user's global_analytics scope is explicitly revoked, the existing cache entries for that user remain valid until their TTL expires (typically 15 minutes). An attacker whose scope has been revoked retains full global_analytics access for up to 15 minutes after the revocation event.

Vulnerable
// PRIVESC63-004 — VULNERABLE: cache key uses only userId — bleed across config upgrades
async function getAnalyticsScopeFromCache(userId) {
  const cached = await cache.get(`analytics:scope:${userId}`);
  return cached ? JSON.parse(cached) : null;
}
Fixed
// PRIVESC63-004 — FIXED: cache key = configVersionId:userId; revokeAnalyticsScope bumps version
async function getAnalyticsScopeFromCache(userId) {
  const configVersion = await db.getCurrentAnalyticsConfigVersion();
  const cached = await cache.get(`analytics:scope:${configVersion}:${userId}`);
  return cached ? JSON.parse(cached) : null;
}

async function revokeAnalyticsScope(userId) {
  await db.setAnalyticsScope(userId, 'none');
  // Bump config version — invalidates ALL cached scope entries for all users:
  await db.bumpAnalyticsConfigVersion();
  await auditLog.write({ action: 'analytics.scope.revoke', targetUserId: userId, at: new Date() });
}

SkillAudit scans for all SA-SKL-PRIVESC63 patterns — JWT claim-based authorization bypasses, missing role boundary checks on scope assignment, unprotected global config endpoints, and cache key scope bleed. Get a free audit to detect privilege escalation vulnerabilities in your MCP skill or server.