← Security advisories

Claude MCP skill privilege escalation — skill publisher verification and trust level management endpoints — SA-SKL-PRIVESC45

SA-SKL-PRIVESC45 documents four privilege escalation vulnerabilities in MCP skill registry publisher verification and trust level management endpoints. Publisher trust levels are the gatekeeping mechanism that determines which publishers can bypass the skill review queue, display verified badges, and publish skills directly to production — making these endpoints high-value escalation targets. PRIVESC45-001 identifies trust level elevation via JWT claim manipulation, granting any JWT holder verified_publisher status without completing verification; PRIVESC45-002 identifies missing level boundary enforcement on trust assignment, allowing any publisher to self-escalate or elevate others to levels exceeding their own; PRIVESC45-003 identifies global publisher verification configuration modification without ownership or admin check, allowing any authenticated user to weaken the verification requirements that protect the registry's trust model; PRIVESC45-004 identifies a cache key design flaw that bleeds previously-granted trust levels across verification policy version upgrades, granting verified_publisher status under new policy requirements without completing the additional verification documents the upgrade requires.

SA-SKL-PRIVESC45 findings at a glance
CRITICALPRIVESC45-001 — publisher trust level read from JWT publisherTrustLevel claim — craft JWT with publisherTrustLevel:'verified_publisher' grants ability to bypass skill review queue, publish skills directly to the production registry, and display the verified publisher badge on all skills; fix: DB-backed 60s Map cache keyed on userId; JWT carries only sub; invalidate on level change event
HIGHPRIVESC45-002 — POST /api/publishers/trust missing level boundary check — any publisher assigns verified_publisher level to themselves or others exceeding their own trust level; fix: requireSession; validate assigned level does not exceed assigning user's own level; Zod PublisherTrustLevelSchema; audit log
HIGHPRIVESC45-003 — PATCH /api/registry/publisher/verification/config missing ownership check — any authenticated user modifies global publisher verification configuration including required verification documents, verification expiry periods, and trust level renewal criteria; fix: require registry_admin level; requireSession; audit log
HIGHPRIVESC45-004 — publisher trust level cache key uses userId without verificationPolicyVersionId — cache entries bleed across verification policy version upgrades; previously verified publisher trust level served under new policy requiring additional verification documents; fix: cache key = verificationPolicyVersionId:userId; invalidate on policy version change; strict 60s TTL

PRIVESC45-001 — JWT publisherTrustLevel claim manipulation grants verified_publisher status

Severity: CRITICAL

The publisher trust level authorization check reads the publisherTrustLevel field from the decoded JWT payload rather than from a database-backed authority source. Any user who can forge or modify a JWT — or who obtains a JWT signing key — can embed publisherTrustLevel: 'verified_publisher' in the token payload, bypassing the entire publisher verification workflow. The verified_publisher level grants the ability to publish skills directly to the production registry without review queue processing, display the registry's verified publisher badge on all published skills (increasing their apparent trustworthiness to users), and access publisher-only APIs for bulk skill management and analytics.

Beyond token forgery, the JWT claim approach creates a secondary risk: when a publisher's trust level is downgraded due to a policy violation, the downgrade takes effect only when the publisher's current JWT expires. Any publisher who notices a downgrade can continue operating at the previous level by simply reusing their existing JWT until expiry — the authorization check reads the claim from the token, not from the current database state.

Vulnerable
// Publisher trust level read from JWT claim — forgeable and stale on downgrade
router.use((req, res, next) => {
  const token = req.headers.authorization?.replace('Bearer ', '');
  const decoded = jwt.verify(token, process.env.JWT_SECRET);
  // publisherTrustLevel claim in JWT — craft to 'verified_publisher' to bypass review queue
  req.publisherTrustLevel = decoded.publisherTrustLevel;
  req.userId = decoded.sub;
  next();
});

router.post('/publish', requireSession, async (req, res) => {
  if (req.publisherTrustLevel === 'verified_publisher') {
    await publishDirectToProduction(req.body.skillId);  // bypasses review queue
  } else {
    await enqueueForReview(req.body.skillId);
  }
  return res.json({ queued: req.publisherTrustLevel !== 'verified_publisher' });
});
Fixed
// Publisher trust level from DB-backed cache — invalidated on level change, not JWT expiry
const trustLevelCache = new Map();  // userId → { level, expiresAt }
const CACHE_TTL_MS = 60_000;

async function getPublisherTrustLevel(userId) {
  const cached = trustLevelCache.get(userId);
  if (cached && cached.expiresAt > Date.now()) return cached.level;
  const publisher = await Publisher.findOne({ userId }).select('+trustLevel');
  if (!publisher) return 'unverified';
  trustLevelCache.set(userId, { level: publisher.trustLevel, expiresAt: Date.now() + CACHE_TTL_MS });
  return publisher.trustLevel;
}

// Invalidate cache immediately on trust level change events
publisherEventEmitter.on('trustLevel.changed', ({ userId }) => trustLevelCache.delete(userId));

// JWT carries only sub — trust level always resolved from DB-backed cache
router.use((req, res, next) => {
  const token = req.headers.authorization?.replace('Bearer ', '');
  const decoded = jwt.verify(token, process.env.JWT_SECRET);
  req.userId = decoded.sub;  // only sub from JWT — no authorization claims
  next();
});

router.post('/publish', requireSession, async (req, res) => {
  const trustLevel = await getPublisherTrustLevel(req.userId);
  if (trustLevel === 'verified_publisher') {
    await publishDirectToProduction(req.body.skillId);
  } else {
    await enqueueForReview(req.body.skillId);
  }
  return res.json({ queued: trustLevel !== 'verified_publisher' });
});

PRIVESC45-002 — Trust level assignment without boundary check allows self-escalation

Severity: HIGH

The publisher trust assignment endpoint accepts a targetUserId and a trustLevel value and assigns the specified level to the target user without checking whether the assigning user's own trust level is at or above the level being assigned. Any authenticated publisher can call this endpoint to assign verified_publisher level to themselves or any other user — a one-call privilege escalation that bypasses the entire publisher verification workflow. The endpoint has no Zod schema validation on the trustLevel field, so callers can also attempt to assign implementation-specific level strings beyond the documented enum.

Vulnerable
// POST /api/publishers/trust — no level boundary check, no Zod schema
router.post('/trust', requireSession, async (req, res) => {
  const { targetUserId, trustLevel } = req.body;
  // any publisher assigns 'verified_publisher' to themselves — no boundary check
  await Publisher.updateOne({ userId: targetUserId }, { trustLevel });
  return res.json({ updated: true });
});
Fixed
// POST /api/publishers/trust — boundary check + Zod schema + audit log
import { z } from 'zod';
const PublisherTrustLevelSchema = z.object({
  targetUserId: z.string().uuid(),
  trustLevel:   z.enum(['unverified', 'community', 'verified_publisher', 'featured_publisher']),
});
const TRUST_LEVEL_ORDER = { unverified: 0, community: 1, verified_publisher: 2, featured_publisher: 3 };

router.post('/trust', requireSession, async (req, res) => {
  const parsed = PublisherTrustLevelSchema.safeParse(req.body);
  if (!parsed.success) return res.status(400).json({ error: 'Invalid payload', issues: parsed.error.issues });

  const assigningLevel = await getPublisherTrustLevel(req.userId);
  const assigningOrdinal = TRUST_LEVEL_ORDER[assigningLevel] ?? 0;
  const targetOrdinal    = TRUST_LEVEL_ORDER[parsed.data.trustLevel] ?? 0;

  // assigning user cannot grant a level higher than their own
  if (targetOrdinal > assigningOrdinal)
    return res.status(403).json({ error: 'Cannot assign trust level exceeding your own' });

  await Publisher.updateOne({ userId: parsed.data.targetUserId }, { trustLevel: parsed.data.trustLevel });
  publisherEventEmitter.emit('trustLevel.changed', { userId: parsed.data.targetUserId });

  await AuditLog.create({
    action:       'publisher.trustLevel.assigned',
    actorId:      req.userId,
    targetUserId: parsed.data.targetUserId,
    newLevel:     parsed.data.trustLevel,
    at:           new Date(),
  });

  return res.json({ updated: true });
});

PRIVESC45-003 — Global verification config modification without admin check

Severity: HIGH

The global publisher verification configuration endpoint is protected only by requireSession, meaning any authenticated user — including unverified publishers — can modify the global configuration that governs what documents are required for publisher verification, how long verification remains valid before renewal is required, and what criteria determine trust level upgrades. An attacker who reduces the required verification documents to an empty list, sets the verification expiry to a large value, or lowers the trust level renewal threshold can weaken the registry's publisher verification model for all future verifications without any administrative oversight.

Vulnerable
// PATCH /api/registry/publisher/verification/config — only requireSession, no admin check
router.patch('/verification/config', requireSession, async (req, res) => {
  // any authenticated user modifies global publisher verification requirements
  await VerificationConfig.updateOne({}, req.body);
  return res.json({ updated: true });
});
Fixed
// PATCH /api/registry/publisher/verification/config — registry_admin level + audit log
const VerificationConfigSchema = z.object({
  requiredDocuments:      z.array(z.enum(['tax_id', 'business_registration', 'identity_verification', 'code_signing_cert'])).min(1),
  verificationExpiryDays: z.number().int().min(30).max(730),
  renewalGracePeriodDays: z.number().int().min(0).max(30),
  minCommitsForUpgrade:   z.number().int().min(1).max(100),
});

router.patch('/verification/config', requireSession, async (req, res) => {
  const callerLevel = await getPublisherTrustLevel(req.userId);
  if (callerLevel !== 'registry_admin')
    return res.status(403).json({ error: 'registry_admin level required' });

  const parsed = VerificationConfigSchema.safeParse(req.body);
  if (!parsed.success) return res.status(400).json({ error: 'Invalid config payload', issues: parsed.error.issues });

  const previous = await VerificationConfig.findOne();
  await VerificationConfig.updateOne({}, parsed.data);

  await AuditLog.create({
    action:   'verificationConfig.updated',
    actorId:  req.userId,
    previous: previous?.toObject(),
    next:     parsed.data,
    at:       new Date(),
  });

  return res.json({ updated: true });
});

PRIVESC45-004 — Cache key bleed across verification policy version upgrades

Severity: HIGH

The publisher trust level cache uses userId as the sole cache key. When the registry deploys a new publisher verification policy version — for example, adding a mandatory code signing certificate requirement for verified_publisher status — publishers who achieved verified_publisher status under the previous policy continue to receive that level from the cache for up to 60 seconds per cache entry lifetime. More critically, since the cache is keyed only on userId, a publisher who completed verification under the old policy will continue to receive their cached verified_publisher level on every request until either the cache entry expires and the DB lookup returns the downgraded level, or the cache is manually invalidated. If the registry does not explicitly downgrade publishers during a policy upgrade, the cache bleed is indefinite — the DB query on cache miss will still return verified_publisher (since no downgrade was performed), and the cache will be repopulated with the same level.

Vulnerable
// Trust level cache keyed on userId only — bleeds across policy version upgrades
const trustLevelCache = new Map();  // key: userId → { level, expiresAt }

async function getPublisherTrustLevel(userId) {
  const cached = trustLevelCache.get(userId);
  if (cached && cached.expiresAt > Date.now()) return cached.level;
  const publisher = await Publisher.findOne({ userId });
  // returns 'verified_publisher' even after policy upgrade requiring new documents
  trustLevelCache.set(userId, { level: publisher.trustLevel, expiresAt: Date.now() + 60_000 });
  return publisher.trustLevel;
}
Fixed
// Trust level cache keyed on verificationPolicyVersionId:userId — invalidated on policy upgrade
const trustLevelCache = new Map();  // key: `${policyVersionId}:${userId}` → { level, expiresAt }

async function getCurrentPolicyVersionId() {
  // cached separately with a short TTL — policy versions change infrequently
  return policyVersionCache.get('current') || (await VerificationConfig.findOne().select('+policyVersionId'))?.policyVersionId;
}

async function getPublisherTrustLevel(userId) {
  const policyVersionId = await getCurrentPolicyVersionId();
  const cacheKey = `${policyVersionId}:${userId}`;
  const cached = trustLevelCache.get(cacheKey);
  if (cached && cached.expiresAt > Date.now()) return cached.level;

  const publisher = await Publisher.findOne({ userId });
  // On policy version upgrade, check if publisher has completed all required documents
  // for the new policy version — if not, return the reduced level for the new policy
  const effectiveLevel = await computeEffectiveTrustLevel(publisher, policyVersionId);
  trustLevelCache.set(cacheKey, { level: effectiveLevel, expiresAt: Date.now() + 60_000 });
  return effectiveLevel;
}

// Invalidate all cache entries for a publisher across all policy versions on trust level change
publisherEventEmitter.on('trustLevel.changed', ({ userId }) => {
  for (const key of trustLevelCache.keys()) {
    if (key.endsWith(`:${userId}`)) trustLevelCache.delete(key);
  }
});
// Invalidate entire cache on policy version upgrade — forces re-evaluation for all publishers
publisherEventEmitter.on('verificationPolicy.upgraded', () => trustLevelCache.clear());

Run SkillAudit to detect JWT authorization claim reads, missing level boundary checks on trust assignment endpoints, missing admin-level guards on global configuration endpoints, and cache key designs that omit policy version identifiers in your MCP skill registry publisher verification pipeline. Join the waitlist for access.