← Blog

Privilege Escalation in MCP Skill Registry Skill Analytics Export and Reporting Permission Endpoints

SA-SKL-PRIVESC71 documents four privilege escalation vulnerabilities in the analytics export and reporting permission surface of MCP skill registries. The findings span JWT claim bypass, self-assignment path exploitation, global configuration manipulation, and policy version cache bleed that retains revoked tiers.

SA-SKL-PRIVESC71 findings
CRITICALPRIVESC71-001 — Analytics export tier read from JWT analyticsExportTier:'enterprise_full' claim; craft JWT with analyticsExportTier:'enterprise_full' grants access to competitor benchmarking data and revenue analytics without DB check; any publisher can self-escalate to full analytics access
CRITICALPRIVESC71-002 — POST /api/registry/analytics/export/tier/assign missing boundary check; any standard publisher assigns enterprise_full analytics export tier to themselves bypassing the enterprise agreement requirement; DB-backed path exploitable even after PRIVESC71-001 JWT fix
HIGHPRIVESC71-003 — PATCH /api/registry/analytics/export/config missing ownership check; any authenticated user modifies global analytics export thresholds and data retention windows affecting all publishers on the platform; attacker reduces retention to 1 day destroying historical analytics for all publishers
MEDIUMPRIVESC71-004 — Analytics export tier cache key uses publisherId without analyticsPolicyVersionId; cache entries bleed across policy updates; revoked enterprise_full tiers retained through incident response window until Redis TTL expiry

PRIVESC71-001 — JWT analyticsExportTier claim bypass

The analytics export tier check reads the analyticsExportTier claim directly from the JWT payload without cross-referencing the database. Any user who can generate a JWT with analyticsExportTier: "enterprise_full" gains access to enterprise analytics data, including competitor benchmarking dashboards, revenue analytics across all publishers, and market share breakdowns. The enterprise_full tier is sold as part of a negotiated enterprise agreement and is priced at several thousand dollars per month. By crafting a JWT with the appropriate claim, any free-tier publisher can access this data without payment or agreement.

Vulnerable
// PRIVESC71-001 — VULNERABLE
// Analytics export tier read from JWT claim — no DB cross-reference.

function getAnalyticsExportTier(req) {
  // VULNERABLE: trusts JWT payload claim directly
  // Any user with a JWT containing analyticsExportTier:'enterprise_full' gets full access
  return req.user?.analyticsExportTier ?? 'free';
}

router.get('/analytics/export', requireSession, async (req, res) => {
  const tier = getAnalyticsExportTier(req);
  if (tier === 'enterprise_full') {
    // Returns competitor benchmarking, revenue analytics, market share
    return res.json(await analytics.getEnterpriseExport(req.user.publisherId));
  }
  res.json(await analytics.getBasicExport(req.user.publisherId));
});

Competitor intelligence access via JWT forgery: Attacker generates or modifies a JWT to include "analyticsExportTier":"enterprise_full" in the payload. Response contains full competitor benchmarking data showing revenue, MAU, and market share for all publishers on the registry — data not available to standard tier users at any price below the enterprise agreement threshold.

Fixed
// PRIVESC71-001 — FIXED
// Always fetch export tier from DB — JWT claims never trusted for authorization.

async function getAnalyticsExportTier(publisherId) {
  // FIXED: DB lookup on every request — JWT claim ignored for tier determination
  const publisher = await db.publishers.findOne({
    where: { id: publisherId },
    attributes: ['analyticsExportTier'],
  });
  return publisher?.analyticsExportTier ?? 'free';
}

router.get('/analytics/export', requireSession, async (req, res) => {
  const tier = await getAnalyticsExportTier(req.user.publisherId);
  if (tier === 'enterprise_full') {
    return res.json(await analytics.getEnterpriseExport(req.user.publisherId));
  }
  res.json(await analytics.getBasicExport(req.user.publisherId));
});

PRIVESC71-002 — Self-assignment path missing boundary check

Even after the JWT fix for PRIVESC71-001, the POST /api/registry/analytics/export/tier/assign endpoint provides a secondary escalation path. This endpoint was designed to allow registry admins to assign analytics export tiers to publishers. The endpoint validates that the caller is authenticated and that the target publisher ID matches the body parameter, but it does not check that the target tier is a tier the caller is authorized to self-assign. Any publisher can POST {"publisherId":"self","targetTier":"enterprise_full"} and the endpoint writes enterprise_full to the publisher's DB record directly, bypassing the enterprise agreement requirement entirely.

Vulnerable
// PRIVESC71-002 — VULNERABLE
// Tier assignment endpoint accepts any targetTier from any authenticated caller.

router.post('/analytics/export/tier/assign', requireSession, async (req, res) => {
  const { publisherId, targetTier } = req.body;
  // VULNERABLE: no check that targetTier is within the caller's allowed assignment range
  // Any publisher can assign enterprise_full to themselves
  if (publisherId !== req.user.publisherId && !req.user.isRegistryAdmin) {
    return res.status(403).json({ error: 'Cannot assign tiers for other publishers' });
  }
  // VULNERABLE: direct DB write without enterprise agreement validation
  await db.publishers.update(
    { analyticsExportTier: targetTier },
    { where: { id: publisherId } }
  );
  res.json({ assigned: true, tier: targetTier });
});
Fixed
// PRIVESC71-002 — FIXED
// Restrict self-assignable tiers; enterprise_full requires admin or signed agreement.

const SELF_ASSIGNABLE_TIERS = new Set(['free', 'standard']);

router.post('/analytics/export/tier/assign', requireSession, async (req, res) => {
  const { publisherId, targetTier } = req.body;
  if (publisherId !== req.user.publisherId && !req.user.isRegistryAdmin) {
    return res.status(403).json({ error: 'Cannot assign tiers for other publishers' });
  }
  // FIXED: non-admin publishers can only assign tiers within self-assignable set
  if (!req.user.isRegistryAdmin && !SELF_ASSIGNABLE_TIERS.has(targetTier)) {
    return res.status(403).json({ error: `Tier '${targetTier}' requires admin assignment or signed enterprise agreement` });
  }
  await db.publishers.update(
    { analyticsExportTier: targetTier },
    { where: { id: publisherId } }
  );
  res.json({ assigned: true, tier: targetTier });
});

PRIVESC71-003 — Global analytics config modification without ownership check

The PATCH /api/registry/analytics/export/config endpoint modifies the global analytics export configuration, including data retention windows (how many days of historical analytics to retain), export frequency limits, and aggregation thresholds for the minimum usage required before a skill's analytics are included in benchmarking aggregates. The endpoint requires authentication but has no ownership or admin role check. Any authenticated publisher can reduce the global data retention window to 1 day, causing the registry to purge all historical analytics older than 24 hours for every publisher on the platform — a platform-wide denial of historical analytics access.

Vulnerable
// PRIVESC71-003 — VULNERABLE
// Global analytics config modifiable by any authenticated user — no admin check.

router.patch('/analytics/export/config', requireSession, async (req, res) => {
  // VULNERABLE: missing requireRegistryAdmin middleware
  // Any authenticated publisher can modify global analytics config
  const { retentionDays, exportFrequency, aggregationThreshold } = req.body;
  await db.analyticsConfig.update({
    retentionDays,      // attacker sets to 1 — destroys all historical analytics
    exportFrequency,
    aggregationThreshold,
  }, { where: { id: 'global' } });
  res.json({ updated: true });
});
Fixed
// PRIVESC71-003 — FIXED
router.patch(
  '/analytics/export/config',
  requireSession,
  requireRegistryAdmin,  // FIXED: only registry admins can modify global config
  async (req, res) => {
    const { retentionDays, exportFrequency, aggregationThreshold } = req.body;
    // FIXED: validate values within acceptable ranges
    if (retentionDays !== undefined && (retentionDays < 30 || retentionDays > 730)) {
      return res.status(400).json({ error: 'retentionDays must be between 30 and 730' });
    }
    await db.analyticsConfig.update(
      { retentionDays, exportFrequency, aggregationThreshold },
      { where: { id: 'global' } }
    );
    res.json({ updated: true });
  }
);

PRIVESC71-004 — Policy version cache bleed retaining revoked tiers

The analytics export tier check caches the publisher's tier in Redis using only the publisherId as the cache key. When a publisher's enterprise_full tier is revoked (e.g., during incident response after a PRIVESC71-001 or PRIVESC71-002 exploit is detected), the DB record is updated immediately, but the Redis cache entry retains the stale enterprise_full value until the TTL expires (typically 1 hour). During this window, the revoked publisher continues to access enterprise analytics data despite the revocation. The fix requires including the analyticsPolicyVersionId — a monotonically incrementing counter that changes on every tier modification — in the cache key, ensuring revocation immediately invalidates the cache entry.

Vulnerable
// PRIVESC71-004 — VULNERABLE
// Cache key includes only publisherId — revocation does not invalidate cache.

async function getCachedExportTier(publisherId) {
  const cacheKey = `analyticsExportTier:${publisherId}`;
  const cached = await redis.get(cacheKey);
  if (cached) return cached;  // stale enterprise_full returned after revocation
  const tier = await db.publishers.findOne({
    where: { id: publisherId }, attributes: ['analyticsExportTier'],
  });
  await redis.set(cacheKey, tier.analyticsExportTier, 'EX', 3600);
  return tier.analyticsExportTier;
}
Fixed
// PRIVESC71-004 — FIXED
// Include analyticsPolicyVersionId in cache key — revocation bumps version, invalidates cache.

async function getCachedExportTier(publisherId) {
  const publisher = await db.publishers.findOne({
    where: { id: publisherId },
    attributes: ['analyticsExportTier', 'analyticsPolicyVersionId'],
  });
  if (!publisher) return 'free';
  // FIXED: cache key includes policy version — any tier change invalidates the entry
  const cacheKey = `analyticsExportTier:${publisherId}:v${publisher.analyticsPolicyVersionId}`;
  const cached = await redis.get(cacheKey);
  if (cached) return cached;
  await redis.set(cacheKey, publisher.analyticsExportTier, 'EX', 3600);
  return publisher.analyticsExportTier;
}

Version-keyed caching pattern: Including a version counter in cache keys is a broadly applicable pattern for any cached permission or tier check. Whenever the underlying permission state changes, increment the version counter. Existing cache entries for the old version become unreachable immediately, without requiring an explicit cache invalidation call. This pattern eliminates the entire category of revocation-window cache bleed vulnerabilities.

Scan your MCP skill registry for SA-SKL-PRIVESC71

SkillAudit detects JWT claim trust for authorization, missing tier boundary checks, absent admin role gates on global config endpoints, and cache key patterns that bleed across policy versions.

Run a free audit