← Blog

Claude MCP skill privilege escalation — skill publication approval and trust tier management endpoints (SA-SKL-PRIVESC57)

SA-SKL-PRIVESC57 identifies four privilege escalation vulnerabilities in MCP skill registry skill publication approval and trust tier management endpoints. Trust tier state read from an attacker-forged JWT trustTier claim rather than from a database-backed lookup allows any user to craft a token claiming trusted_publisher status, granting auto-approval bypass that pushes skills directly to the registry without manual review, elevated skill visibility in marketplace search results, reduced review scrutiny on future version submissions, and access to publisher-only API rate limits; a missing tier boundary check in the trust tier assignment endpoint allows any verified publisher to self-assign the trusted_publisher tier by omitting the boundary validation that should prevent upward self-escalation; a missing ownership check on the trust tier configuration endpoint allows any authenticated user to modify the global trust tier thresholds, auto-approval score requirements, and reviewer assignment weights that determine how the entire registry's review pipeline operates; and a trust tier cache key that includes only the userId without the trustPolicyVersionId causes cache entries to persist across trust policy version upgrades, allowing publishers whose trust tier has been downgraded to continue operating at their elevated tier until the cache TTL expires.

SA-SKL-PRIVESC57 findings at a glance
CRITICALPRIVESC57-001 — Trust tier read from JWT trustTier claim — craft JWT with trustTier:'trusted_publisher' grants auto-approval bypass, elevated skill visibility, reduced review scrutiny, and access to publisher-only API rate limits
CRITICALPRIVESC57-002 — POST /api/registry/trust/assign missing tier boundary check — any verified publisher self-assigns trusted_publisher granting auto-approval bypass and elevated marketplace placement
HIGHPRIVESC57-003 — PATCH /api/registry/trust/config missing ownership check — any authenticated user modifies global trust tier thresholds, auto-approval score requirements, and reviewer assignment weights
MEDIUMPRIVESC57-004 — Trust tier cache key uses userId without trustPolicyVersionId — cache entries bleed across trust policy upgrades; downgraded publishers retain elevated trust tier until TTL expiry

PRIVESC57-001 — JWT trustTier claim manipulation grants trusted_publisher auto-approval bypass

The publication approval middleware reads the publisher's trust tier from the trustTier claim in the authenticated JWT rather than performing a database lookup. While the JWT signature is validated (preventing forgery of tokens signed with the registry's key), the JWT is issued by the registry's own token endpoint which includes the trustTier value from the user's profile at token issue time. If the registry also issues tokens on behalf of third-party OAuth flows where the trustTier claim is populated from user-supplied profile data, an attacker can register with a profile that includes trustTier: "trusted_publisher" in the OAuth claims and receive a legitimately signed token with elevated trust tier. Alternatively, if the token is a self-signed JWT (issued by the client and verified only for signature structure), the claim can be freely modified. With trusted_publisher trust tier, the attacker's skill submissions bypass the manual review queue entirely and are auto-approved for publication based on automated score alone, the skill receives elevated placement in marketplace search results, the publisher's future version submissions receive reduced scrutiny in the automated analysis pass, and the publisher gains access to the higher API rate limits reserved for verified trusted publishers.

Vulnerable
// PRIVESC57-001 — VULNERABLE
function getPublisherTrustTier(req) {
  // VULNERABLE: reads trust tier from JWT claim — not from database
  return req.jwtPayload.trustTier; // attacker can craft token with 'trusted_publisher'
}

router.post('/skills/:id/publish', requireSession, async (req, res) => {
  const trustTier = getPublisherTrustTier(req);
  if (trustTier === 'trusted_publisher') {
    // Auto-approve: bypass manual review queue
    await db.skillVersions.update({
      where: { id: req.body.versionId },
      data: { status: 'approved', reviewedAt: new Date(), autoApproved: true },
    });
    return res.json({ published: true, reviewSkipped: true });
  }
  await reviewQueue.enqueue({ skillId: req.params.id, versionId: req.body.versionId });
  res.json({ queued: true });
});

Attack PoC — PRIVESC57-001: Attacker crafts or obtains a JWT containing trustTier: "trusted_publisher" in the payload claims. All subsequent skill publication requests bypass the manual review queue and are auto-approved, pushing malicious skills directly to the registry without review.

// PRIVESC57-001 — ATTACK PoC
// Attacker obtains or crafts JWT with elevated trustTier claim
const maliciousPayload = {
  sub: 'attacker-user-id',
  trustTier: 'trusted_publisher', // elevated claim
  iat: Math.floor(Date.now() / 1000),
  exp: Math.floor(Date.now() / 1000) + 3600,
};
// If registry issues tokens from user-supplied profile data, this JWT may be legitimately signed
const elevatedToken = signJWT(maliciousPayload, registryJWTSecret);

// All skill submissions now bypass review queue
await fetch('/api/registry/skills/malicious-skill-id/publish', {
  method: 'POST',
  headers: { Authorization: `Bearer ${elevatedToken}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ versionId: 'malicious-version-id' }),
});
// Malicious skill published to registry without manual review
Fixed
// PRIVESC57-001 — FIXED
async function getPublisherTrustTier(userId) {
  // FIXED: always read trust tier from database — never from JWT
  const cacheKey = `trustTier:${trustPolicyVersionId}:${userId}`;
  const cached = await trustCache.get(cacheKey);
  if (cached) return cached;
  const publisher = await db.publishers.findOne({
    where: { userId },
    select: { trustTier: true },
  });
  await trustCache.set(cacheKey, publisher.trustTier, { ttl: 300 });
  return publisher.trustTier;
}

router.post('/skills/:id/publish', requireSession, async (req, res) => {
  // FIXED: JWT carries only sub; trust tier always from database
  const trustTier = await getPublisherTrustTier(req.jwtPayload.sub);
  const autoApproveThreshold = await getTrustConfig('autoApproveScoreThreshold');
  if (trustTier === 'trusted_publisher' && req.body.auditScore >= autoApproveThreshold) {
    await db.skillVersions.update({
      where: { id: req.body.versionId },
      data: { status: 'approved', reviewedAt: new Date(), autoApproved: true },
    });
    return res.json({ published: true });
  }
  await reviewQueue.enqueue({ skillId: req.params.id, versionId: req.body.versionId });
  res.json({ queued: true });
});

PRIVESC57-002 — Missing tier boundary check allows verified publishers to self-assign trusted_publisher

The trust tier assignment endpoint at POST /api/registry/trust/assign allows registry administrators to assign trust tiers to publishers. The endpoint validates that the requesting user is authenticated and that the target publisher exists, but it does not validate that the requested tier is reachable from the assigning user's current tier. A verified publisher (a publisher who has completed identity verification but has not yet been granted trusted_publisher status) can directly call the assignment endpoint with targetUserId: <their own userId> and tier: "trusted_publisher", and the endpoint processes the assignment without checking whether the requesting user has the authority to grant the requested tier. This grants the attacker auto-approval bypass and elevated marketplace placement without the registry's trust team ever approving the upgrade.

Vulnerable
// PRIVESC57-002 — VULNERABLE
router.post('/trust/assign', requireSession, async (req, res) => {
  const { targetUserId, tier } = req.body;
  // VULNERABLE: no boundary check — any user can assign any tier to themselves
  await db.publishers.update({
    where: { userId: targetUserId },
    data: { trustTier: tier },
  });
  await trustCache.del(`trustTier:${targetUserId}`);
  res.json({ assigned: true, tier });
});

Attack PoC — PRIVESC57-002: Any verified publisher self-assigns trusted_publisher tier by calling the assignment endpoint with their own userId as the target. No administrator approval required.

// PRIVESC57-002 — ATTACK PoC
await fetch('/api/registry/trust/assign', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${publisherToken}` },
  body: JSON.stringify({
    targetUserId: 'attacker-own-user-id',
    tier: 'trusted_publisher',
  }),
});
// Attacker now has trusted_publisher tier — auto-approval bypass active
Fixed
// PRIVESC57-002 — FIXED
const TRUST_TIER_ORDER = {
  'unverified': 0,
  'verified': 1,
  'trusted_publisher': 2,
  'registry_admin': 3,
};

router.post('/trust/assign', requireSession, async (req, res) => {
  const { targetUserId, tier } = req.body;
  const TrustAssignSchema = z.object({
    targetUserId: z.string().uuid(),
    // FIXED: trusted_publisher not assignable via this endpoint — requires separate approval flow
    tier: z.enum(['unverified', 'verified']),
  });
  TrustAssignSchema.parse(req.body);

  const requesterTier = await getPublisherTrustTier(req.jwtPayload.sub);
  const targetTier = await getPublisherTrustTier(targetUserId);

  // FIXED: requester can only assign tiers strictly below their own
  if (TRUST_TIER_ORDER[tier] >= TRUST_TIER_ORDER[requesterTier]) {
    return res.status(403).json({ error: 'Cannot assign tier at or above your own tier' });
  }
  // FIXED: prevent self-assignment
  if (targetUserId === req.jwtPayload.sub) {
    return res.status(403).json({ error: 'Cannot assign trust tier to yourself' });
  }

  await db.publishers.update({ where: { userId: targetUserId }, data: { trustTier: tier } });
  await trustCache.del(`trustTier:${trustPolicyVersionId}:${targetUserId}`);
  await auditLog.write({ action: 'trust.assign', by: req.jwtPayload.sub, target: targetUserId, tier });
  res.json({ assigned: true });
});

PRIVESC57-003 — Missing ownership check on trust config endpoint allows global threshold modification

The trust tier configuration endpoint at PATCH /api/registry/trust/config allows modification of the global trust tier parameters: the minimum audit score threshold required for auto-approval, the trust tier-to-reviewer mapping that controls which reviewers are assigned to review skills from publishers at each trust tier, and the auto-approval score requirements. The endpoint validates authentication (the requesting user must have a valid session) but does not check whether the requesting user has the registry admin role required to modify global configuration. Any authenticated user, including newly registered publishers with unverified trust tier, can modify these global parameters. By setting the autoApproveScoreThreshold to 0, an attacker can cause all future skill submissions to be auto-approved regardless of their audit score or the submitter's trust tier, eliminating the entire registry review pipeline until the configuration is manually restored.

Vulnerable
// PRIVESC57-003 — VULNERABLE
router.patch('/trust/config', requireSession, async (req, res) => {
  // VULNERABLE: no role check — any authenticated user modifies global trust config
  const { autoApproveScoreThreshold, reviewerAssignmentWeights, tierThresholds } = req.body;
  await db.trustConfig.update({
    data: { autoApproveScoreThreshold, reviewerAssignmentWeights, tierThresholds },
  });
  res.json({ updated: true });
});

Attack PoC — PRIVESC57-003: Any authenticated user sets autoApproveScoreThreshold to 0, causing all future skill submissions to bypass the review queue regardless of audit score or publisher trust tier. The registry's review pipeline is effectively disabled until manually restored.

// PRIVESC57-003 — ATTACK PoC
await fetch('/api/registry/trust/config', {
  method: 'PATCH',
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${anyUserToken}` },
  body: JSON.stringify({
    autoApproveScoreThreshold: 0, // all submissions auto-approved
    tierThresholds: { trusted_publisher: { minAuditScore: 0 } },
  }),
});
// All future skill submissions auto-approved — review pipeline disabled
Fixed
// PRIVESC57-003 — FIXED
router.patch('/trust/config', requireSession, requireRegistryAdmin, async (req, res) => {
  const TrustConfigSchema = z.object({
    // FIXED: enforce minimum threshold to prevent complete bypass
    autoApproveScoreThreshold: z.number().int().min(50).max(100).optional(),
    reviewerAssignmentWeights: z.record(z.string(), z.number().min(0).max(1)).optional(),
    tierThresholds: z.record(
      z.enum(['verified', 'trusted_publisher']),
      z.object({ minAuditScore: z.number().int().min(50) })
    ).optional(),
  });
  const config = TrustConfigSchema.parse(req.body);

  const previousConfig = await db.trustConfig.findOne();
  await db.trustConfig.update({ data: config });

  // FIXED: bump trust policy version on every config change to invalidate cache
  await db.trustPolicyVersion.increment();
  const newVersion = await db.trustPolicyVersion.findOne();
  global.trustPolicyVersionId = newVersion.id;

  await auditLog.write({
    action: 'trust.config.update',
    by: req.jwtPayload.sub,
    before: previousConfig,
    after: config,
  });
  res.json({ updated: true, newPolicyVersion: newVersion.id });
});

PRIVESC57-004 — Trust tier cache bleed across policy upgrades retains elevated tier until TTL expiry

The trust tier cache key is constructed as trustTier:${userId}, without including the trust policy version identifier. When the registry's trust policy is updated — for example, when a publisher's trust tier is downgraded from trusted_publisher to verified following a policy violation — the cache entry for that publisher remains in Redis until the TTL expires. If the cache TTL is set to 300 seconds (a typical value for a hot-read cache), the downgraded publisher retains their elevated trust tier for up to 5 minutes after the downgrade, during which time they can submit skills that bypass the review queue and benefit from the elevated marketplace placement that the downgraded tier no longer entitles them to. For longer TTLs (some deployments use 1800 seconds for cost optimization), the bleed window is significantly larger.

Vulnerable
// PRIVESC57-004 — VULNERABLE
async function getPublisherTrustTierCached(userId) {
  // VULNERABLE: cache key includes only userId — bleed across policy version upgrades
  const cacheKey = `trustTier:${userId}`;
  const cached = await trustCache.get(cacheKey);
  if (cached) return cached; // returns stale elevated tier after downgrade
  const publisher = await db.publishers.findOne({
    where: { userId }, select: { trustTier: true },
  });
  await trustCache.set(cacheKey, publisher.trustTier, { ttl: 300 });
  return publisher.trustTier;
}

// When admin downgrades publisher:
router.post('/trust/downgrade', requireRegistryAdmin, async (req, res) => {
  const { targetUserId, newTier } = req.body;
  await db.publishers.update({ where: { userId: targetUserId }, data: { trustTier: newTier } });
  // VULNERABLE: only deletes cache entry for this key pattern —
  // but trustTier:${userId} may still be cached with the old value in a different cache layer
  await trustCache.del(`trustTier:${targetUserId}`);
  res.json({ downgraded: true });
  // Publisher may still have elevated tier cached for up to TTL seconds
});

Attack PoC — PRIVESC57-004: Publisher is downgraded from trusted_publisher to verified at T=0. Cache entry with trustTier: "trusted_publisher" persists until T=300. Publisher continues to submit auto-approved skills during the 5-minute bleed window.

// PRIVESC57-004 — TIMELINE
// T=0:   admin downgrades publisher via POST /trust/downgrade
// T=0:   db.publishers updated: trustTier = 'verified'
// T=0:   trustCache.del('trustTier:attacker-user-id') called
// T=1:   publisher submits skill — cache MISS — DB read returns 'verified' ✓
// T=10:  cache re-populated via getPublisherTrustTierCached: trustTier:'verified' cached
// --- BUT if the downgrade races with a concurrent cache population: ---
// T=0:   concurrent request reads from DB just BEFORE update commits: 'trusted_publisher'
// T=0:   cache SET with 'trusted_publisher', TTL=300
// T=0:   admin downgrade runs, del() removes the key
// T=5:   publisher submits — cache MISS — returns 'verified' (correct) ✓
// --- HOWEVER with separate cache tier (read replica, edge cache): ---
// Edge cache may still serve stale 'trusted_publisher' until its own TTL expiry
Fixed
// PRIVESC57-004 — FIXED
let currentTrustPolicyVersionId = await db.trustPolicyVersion.findOne().then(r => r.id);

async function getPublisherTrustTierCached(userId) {
  // FIXED: cache key includes trust policy version — invalidated on every policy upgrade
  const cacheKey = `trustTier:${currentTrustPolicyVersionId}:${userId}`;
  const cached = await trustCache.get(cacheKey);
  if (cached) return cached;
  const publisher = await db.publishers.findOne({
    where: { userId }, select: { trustTier: true },
  });
  await trustCache.set(cacheKey, publisher.trustTier, { ttl: 300 });
  return publisher.trustTier;
}

// When admin downgrades publisher — also bumps policy version:
router.post('/trust/downgrade', requireRegistryAdmin, async (req, res) => {
  const { targetUserId, newTier } = req.body;
  await db.publishers.update({ where: { userId: targetUserId }, data: { trustTier: newTier } });
  // FIXED: bump policy version — ALL user cache entries invalidated atomically
  await db.trustPolicyVersion.increment();
  currentTrustPolicyVersionId = await db.trustPolicyVersion.findOne().then(r => r.id);
  // No need to delete individual cache keys — new version means all old keys are stale
  await auditLog.write({ action: 'trust.downgrade', by: req.jwtPayload.sub, target: targetUserId, newTier });
  res.json({ downgraded: true, newPolicyVersion: currentTrustPolicyVersionId });
  // All users re-fetched from DB on next request — zero bleed across policy upgrade
});

SkillAudit tip: Run a free audit on your MCP skill at skillaudit.dev to detect JWT claim-sourced authorization, missing tier boundary checks, unauthenticated config mutation endpoints, and cache-key patterns that cause privilege bleed across policy upgrades — all in under 60 seconds. See also SA-SKL-CORS73-BLOG for related MCP registry attack chain analysis.