← Security advisories

Claude MCP skill privilege escalation — skill review and approval gate management endpoints — SA-SKL-PRIVESC36

SA-SKL-PRIVESC36 documents four privilege escalation vulnerabilities in MCP skill registry review and approval gate management endpoints. Review and approval gates are the platform's trust enforcement mechanism — the gates that determine whether a skill can be published, listed in directories, and installed by users. When these gates are bypassable, the security review process that protects every downstream user is rendered cosmetic. A JWT claim elevation in the review gate approval level check grants any attacker who can forge a token the power to approve any skill submission, bypassing every configured review requirement. A missing approval authority check allows any tier-1 reviewer to approve gates that require platform-admin authority, silently promoting their own decisions above their privilege tier. A missing ownership check on gate configuration allows any authenticated user to lower the minimum approval thresholds for any gate on the platform. And a cache key collision allows stale approval state from a deleted and recreated gate to populate a new gate's approval status without any reviewer action.

SA-SKL-PRIVESC36 findings at a glance
CRITICALPRIVESC36-001 — review gate approval level read from JWT reviewGateLevel claim; craft JWT with reviewGateLevel:'platform_admin' grants power to approve any skill submission bypassing all review workflows; fix: DB-backed 60s Map cache keyed on userId+gateId; JWT carries only sub; invalidate on level change event
HIGHPRIVESC36-002 — POST /api/review/gates missing approval authority check; any reviewer approves gates requiring authority levels above their own, bypassing security review requirements; fix: validate approver's authority meets or exceeds gate minimum_authority; Zod ReviewApprovalSchema; audit log
HIGHPRIVESC36-003 — PATCH /api/review/gates/:id/config missing ownership check; any authenticated user modifies any gate's required_approvers, minimum_authority, and bypass_conditions; fix: require gate.ownerId === session.userId OR platform_admin role; audit log
MEDIUMPRIVESC36-004 — approval cache key uses gateId without reviewerId; cache bleeds across gate reset and recreation; previously approved state served to new gate with same sequential integer ID, allowing skills to appear approved without passing review; fix: cache key = reviewerId:gateId; invalidate on gate reset; strict 60s TTL

PRIVESC36-001 — JWT reviewGateLevel claim elevation grants platform_admin approval power

Severity: CRITICAL

The review gate approval middleware reads the reviewer's approval level from the reviewGateLevel claim embedded in the JWT access token. JWT claims are cryptographically signed but not encrypted — their contents are visible and, if the signing key is compromised or if the platform issues JWTs without restricting which claims callers can request, can be forged. An attacker who obtains a JWT with reviewGateLevel: "platform_admin" can approve any skill submission on the platform, including submissions that require platform-admin authority — the highest tier of review authority available. This bypasses all configured approval workflows: security reviews, manual verification steps, mandatory multi-reviewer gates, and embargo holds.

The practical exploit path does not require key compromise. If the JWT issuance endpoint allows callers to include arbitrary claims in their token request (a common misconfiguration when JWT claim generation is driven by user-supplied input), an attacker can simply request a token with the elevated claim. Even if claim injection is not possible at issuance time, any JWT signing key rotation failure, weak key generation, or key storage vulnerability creates a window to forge tokens with elevated claims. The fix removes all authorization-sensitive claims from JWTs, loading authority levels exclusively from the database and caching the result for 60 seconds to bound the latency impact without creating a stale-data window long enough to be useful for privilege escalation timing attacks.

Vulnerable
// Review gate approval middleware — approval level from JWT claim
function requireReviewAuthority(minimumLevel) {
  return (req, res, next) => {
    const { reviewGateLevel } = req.jwtPayload; // from JWT — attacker-controllable
    if (!meetsAuthorityLevel(reviewGateLevel, minimumLevel)) {
      return res.status(403).json({ error: 'Insufficient review authority' });
    }
    req.reviewerLevel = reviewGateLevel;
    next();
  };
}
Fixed
// Review gate approval middleware — authority from DB with 60s cache; JWT carries only sub
const reviewerLevelCache = new Map(); // key: userId:gateId, value: { level, expiresAt }

async function requireReviewAuthority(minimumLevel) {
  return async (req, res, next) => {
    const userId = req.session.userId; // from session, not JWT
    const gateId = req.params.gateId || req.body.gateId;
    const cacheKey = `${userId}:${gateId}`;

    let level;
    const cached = reviewerLevelCache.get(cacheKey);
    if (cached && cached.expiresAt > Date.now()) {
      level = cached.level;
    } else {
      const reviewer = await Reviewer.findOne({ userId, gateId }).select('authorityLevel');
      if (!reviewer) return res.status(403).json({ error: 'Not a reviewer for this gate' });
      level = reviewer.authorityLevel;
      reviewerLevelCache.set(cacheKey, { level, expiresAt: Date.now() + 60_000 });
    }

    if (!meetsAuthorityLevel(level, minimumLevel)) {
      return res.status(403).json({ error: 'Insufficient review authority' });
    }
    req.reviewerLevel = level;
    next();
  };
}

PRIVESC36-002 — Missing approval authority check lets any reviewer approve above-tier gates

Severity: HIGH

The gate approval endpoint authenticates the caller as a reviewer and verifies they have submitted a valid approval payload, but it does not check whether the caller's authority level meets or exceeds the gate's configured minimum_authority requirement. A reviewer with tier-1 (community_reviewer) authority can submit an approval for a gate configured with minimum_authority: "platform_admin", and the platform will accept and record the approval — crediting it toward the gate's required approval count at the platform-admin tier.

The consequence is that multi-tier review workflows can be satisfied entirely by low-tier reviewers. An attacker who coordinates with other community-tier reviewers can approve a skill through a platform-admin security review gate without any platform administrator ever seeing the submission. Because the approval records show the correct number of approvals at the stated tier, the gate appears to have been correctly cleared in the audit log — the tier validation failure is invisible without an additional query to compare the approver's tier against the gate's minimum authority field.

Vulnerable
// POST /api/review/gates/:gateId/approve — no authority tier check
router.post('/gates/:gateId/approve', requireSession, async (req, res) => {
  const ReviewApprovalSchema = z.object({ verdict: z.enum(['approved', 'rejected']), notes: z.string().max(2000) });
  const body = ReviewApprovalSchema.parse(req.body);

  const gate = await ReviewGate.findById(req.params.gateId);
  if (!gate) return res.status(404).json({ error: 'Gate not found' });

  // Missing: check that req.session.userId's authority level >= gate.minimum_authority
  await gate.recordApproval(req.session.userId, body);
  return res.json({ approved: true });
});
Fixed
// POST /api/review/gates/:gateId/approve — authority tier check required
router.post('/gates/:gateId/approve', requireSession, async (req, res) => {
  const ReviewApprovalSchema = z.object({
    verdict: z.enum(['approved', 'rejected']),
    notes: z.string().max(2000),
  });
  const body = ReviewApprovalSchema.parse(req.body);

  const gate = await ReviewGate.findById(req.params.gateId);
  if (!gate) return res.status(404).json({ error: 'Gate not found' });

  // Fetch approver's authority level from DB (not JWT — see PRIVESC36-001)
  const reviewer = await Reviewer.findOne({ userId: req.session.userId, gateId: gate._id });
  if (!reviewer || !meetsAuthorityLevel(reviewer.authorityLevel, gate.minimum_authority)) {
    return res.status(403).json({ error: 'Approval authority below gate minimum' });
  }

  await gate.recordApproval(req.session.userId, body);

  await AuditLog.create({
    action: 'review.gate.approved',
    gateId: gate._id,
    approverId: req.session.userId,
    approverAuthority: reviewer.authorityLevel,
    gateMinimumAuthority: gate.minimum_authority,
    verdict: body.verdict,
    timestamp: new Date(),
  });

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

PRIVESC36-003 — Missing gate config ownership check lets any user lower approval thresholds

Severity: HIGH

The gate configuration update endpoint requires only that the caller be authenticated. It does not verify that the caller owns or administers the gate being modified. Any authenticated user can send a PATCH /api/review/gates/:id/config request to any gate ID and modify the gate's required_approvers count, minimum_authority level, and bypass_conditions array — the three fields that determine how stringent the review requirement is.

An attacker with a standard user account can lower any platform security gate's required_approvers from 3 to 1, reduce the minimum_authority from platform_admin to community_reviewer, and add a bypass_conditions entry that waives review for any submission with a specific metadata tag. Because gate configuration changes take effect immediately and the endpoint returns success with no ownership verification, the modification is instant, silent, and persistent — the gate will accept weaker evidence for all future skill submissions until an administrator notices the configuration change and reverts it.

Broken object-level authorization (BOLA) in gate config is a silent policy downgrade. Unlike direct privilege escalation that grants the attacker elevated access, gate config manipulation lowers the platform's security bar for everyone. Future skill submissions — including those from legitimate authors who are unaware of the manipulation — bypass the security review that all downstream users are relying on. Detection requires a configuration audit, not an access log review, making the window between attack and discovery significantly longer.

Vulnerable
// PATCH /api/review/gates/:id/config — no ownership check
router.patch('/gates/:id/config', requireSession, async (req, res) => {
  const GateConfigSchema = z.object({
    required_approvers: z.number().int().min(1).optional(),
    minimum_authority: z.string().optional(),
    bypass_conditions: z.array(z.string()).optional(),
  });
  const updates = GateConfigSchema.parse(req.body);

  // Missing: verify req.session.userId === gate.ownerId OR has platform_admin role
  await ReviewGate.findByIdAndUpdate(req.params.id, updates);
  return res.json({ updated: true });
});
Fixed
// PATCH /api/review/gates/:id/config — ownership check required
router.patch('/gates/:id/config', requireSession, async (req, res) => {
  const GateConfigSchema = z.object({
    required_approvers: z.number().int().min(1).max(10).optional(),
    minimum_authority: z.enum(['community_reviewer', 'trusted_reviewer', 'platform_admin']).optional(),
    bypass_conditions: z.array(z.string().max(100)).max(5).optional(),
  }).strict();
  const updates = GateConfigSchema.parse(req.body);

  const gate = await ReviewGate.findById(req.params.id);
  if (!gate) return res.status(404).json({ error: 'Gate not found' });

  const isPlatformAdmin = await hasRole(req.session.userId, 'platform_admin');
  if (gate.ownerId.toString() !== req.session.userId && !isPlatformAdmin) {
    return res.status(403).json({ error: 'Forbidden: not gate owner or platform admin' });
  }

  const previous = gate.toObject();
  await gate.set(updates).save();

  await AuditLog.create({
    action: 'review.gate.config.updated',
    gateId: gate._id,
    actorId: req.session.userId,
    isPlatformAdmin,
    previousConfig: previous,
    newConfig: updates,
    timestamp: new Date(),
  });

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

PRIVESC36-004 — Approval cache key collision allows stale gate approval to bypass new gate review

Severity: MEDIUM

The gate approval cache uses only gateId as the cache key, omitting the reviewerId. This means a single cache entry tracks whether any reviewer has approved a given gate ID, not whether a specific reviewer has approved it. When a gate is reset (approval state cleared) and subsequently recreated with the same integer ID — a common pattern in sequential database ID allocation — the new gate inherits the approval cache entries from the previous gate that occupied that ID.

An attacker who controls a previously approved gate (or who can trigger a gate reset on a gate they previously approved) can arrange for a new security gate — requiring fresh review for a different skill submission — to appear pre-approved in the cache. Because the cache TTL is 60 seconds and the gate lifecycle (create, reset, recreate) can be manipulated faster than the TTL window, the attacker can keep the false approval alive until the skill submission is accepted. The resulting skill publication carries the appearance of having passed review, but the approval was recorded against a different gate for a different submission.

Vulnerable
// Gate approval cache — keyed on gateId only; bleeds across gate resets
const approvalCache = new Map(); // key: gateId, value: { approved, expiresAt }

function checkApprovalCache(gateId) {
  const cached = approvalCache.get(gateId); // misses reviewerId in key
  return cached && cached.expiresAt > Date.now() ? cached.approved : null;
}

function setApprovalCache(gateId, approved) {
  approvalCache.set(gateId, { approved, expiresAt: Date.now() + 60_000 });
}
Fixed
// Gate approval cache — keyed on reviewerId:gateId; invalidated on gate reset
const approvalCache = new Map(); // key: reviewerId:gateId

function checkApprovalCache(reviewerId, gateId) {
  const key = `${reviewerId}:${gateId}`;
  const cached = approvalCache.get(key);
  return cached && cached.expiresAt > Date.now() ? cached.approved : null;
}

function setApprovalCache(reviewerId, gateId, approved) {
  const key = `${reviewerId}:${gateId}`;
  approvalCache.set(key, { approved, expiresAt: Date.now() + 60_000 });
}

// Called whenever a gate is reset or recreated
function invalidateGateApprovalCache(gateId) {
  for (const key of approvalCache.keys()) {
    if (key.endsWith(`:${gateId}`)) approvalCache.delete(key);
  }
}

Remediation summary

FindingSeverityPrimary remediationSecondary hardening
PRIVESC36-001CriticalRemove authorization claims from JWT; load authority level from DB with 60s cache keyed on userId:gateId; JWT carries only subInvalidate authority cache on role change events; alert on cache miss rate spikes (potential enumeration); audit all JWT claim consumers across codebase
PRIVESC36-002HighValidate approver's authority level meets or exceeds gate minimum_authority before recording approval; audit log with both authority levelsZod ReviewApprovalSchema; return 403 with authority delta for operator visibility; add review authority tier to approval audit records for retrospective analysis
PRIVESC36-003HighRequire gate.ownerId === req.session.userId OR platform_admin role before any gate config mutation; audit log previous and new config on every updateAlert on gate minimum_authority reductions; add platform-admin notification for any gate config change; consider 2-of-2 approval requirement for security-critical gate modifications
PRIVESC36-004MediumCache key = reviewerId:gateId; call invalidateGateApprovalCache(gateId) on every gate reset and recreationMigrate to UUID gate IDs to eliminate sequential ID reuse; add gate lifecycle events to audit log; strict 60s TTL enforced at set time, not read time

Find privilege escalation vulnerabilities like these before attackers do. SkillAudit scans your MCP skill registry review and approval gate endpoints for all four SA-SKL-PRIVESC36 patterns plus the broader privilege escalation advisory series. See the SA-SKL-INJECTION43 artifact signing injection advisory and the SA-SKL-SSRF55 collaboration SSRF advisory for related findings. Connect your repository at skillaudit.dev.