← Security advisories

Claude MCP skill privilege escalation — skill review workflow and quality gate management endpoints — SA-SKL-PRIVESC46

SA-SKL-PRIVESC46 documents four privilege escalation vulnerabilities in MCP skill registry review workflow and quality gate management endpoints. The review workflow governs which skills are approved for the production registry — including security scan requirements, test coverage thresholds, documentation completeness checks, and the review queue assignment system that determines who can approve a skill for public distribution. PRIVESC46 identifies four privilege escalation paths: a JWT claim forgery that grants review_admin access bypassing the entire review queue; a missing level boundary check that allows any reviewer to self-assign review_admin capabilities; a missing ownership check that allows any authenticated user to lower global quality gate thresholds — effectively disabling security scan requirements across the entire registry; and a cache key design flaw that causes review permissions to persist across policy version upgrades.

SA-SKL-PRIVESC46 findings at a glance
CRITICALPRIVESC46-001 — review workflow access level read from JWT reviewAccessLevel claim — craft JWT with reviewAccessLevel:'review_admin' grants ability to approve any skill for production, bypass quality gates, and access all pending review queue items across all publishers; secondary risk: demoted reviewers reuse existing JWT to continue operating at previous access level until expiry; fix: DB-backed 60s Map cache keyed on userId; JWT carries only sub; invalidate cache on level change event
HIGHPRIVESC46-002 — POST /api/skills/review/assign missing level boundary check — any reviewer assigns review_admin level actions to themselves or others exceeding their own reviewer scope; Zod ReviewAccessLevelSchema absent; fix: requireSession; validate assigned level does not exceed assigning user's own reviewer scope; Zod ReviewAccessLevelSchema; audit log
HIGHPRIVESC46-003 — PATCH /api/registry/review/quality-gates missing ownership check — any authenticated user modifies global quality gate thresholds including minimum test coverage, required security scan passing score, and documentation completeness requirements; can empty requiredSecurityChecks array effectively disabling all security scan requirements; fix: require review_admin level; requireSession; Zod QualityGateSchema with requiredSecurityChecks min(1); audit log with previous/next diff
HIGHPRIVESC46-004 — review workflow access level cache key uses userId without reviewPolicyVersionId — cache entries bleed across review policy version upgrades; reviewers granted access under old policy continue receiving review_admin under new policy requiring additional review credentials and certifications; cache bleed is indefinite if DB not explicitly downgraded on upgrade; fix: cache key = reviewPolicyVersionId:userId; invalidate all keys for userId on access level change; invalidate entire cache on policy version upgrade event

PRIVESC46-001 — JWT reviewAccessLevel claim forgery grants full review queue admin access

Severity: CRITICAL

The review workflow authorization middleware reads the reviewer's access level from the reviewAccessLevel claim in the user's JWT. The JWT is signed by the auth service and cannot be directly modified — but several attack paths allow an attacker to obtain a JWT with an elevated reviewAccessLevel claim: exploiting a JWT signing key leak, chaining with PRIVESC46-002 to elevate the level in the database before it is encoded into a new JWT at the next token refresh, or exploiting a secondary injection vulnerability in the token issuance pipeline that allows claim injection.

A JWT containing reviewAccessLevel: 'review_admin' grants the bearer the ability to approve any skill in the registry for production deployment, access the full review queue including items assigned to other reviewers, bypass all quality gate checks during the approval flow, and modify review assignments for any pending skill. The secondary risk — demoted reviewers continuing to operate at their previous level until JWT expiry — means that a reviewer whose access is downgraded after a policy violation continues with full access for up to the JWT lifetime (typically 1–24 hours), creating a predictable window for a malicious insider to push through final approvals before their access is effectively revoked.

Vulnerable
// Review workflow middleware — reads access level from JWT claim
function requireReviewAccess(minLevel) {
  const LEVEL_ORDER = ['reviewer', 'senior_reviewer', 'review_admin'];
  return (req, res, next) => {
    const userLevel = req.jwt.reviewAccessLevel;  // attacker crafts JWT with 'review_admin'
    if (LEVEL_ORDER.indexOf(userLevel) < LEVEL_ORDER.indexOf(minLevel)) {
      return res.status(403).json({ error: 'Insufficient review access' });
    }
    req.reviewLevel = userLevel;
    next();
  };
}
Fixed
// Review workflow middleware — DB-backed cache, JWT carries only sub
const reviewLevelCache = new Map();
const CACHE_TTL_MS = 60_000;

async function getReviewLevel(userId) {
  const cached = reviewLevelCache.get(userId);
  if (cached && Date.now() - cached.at < CACHE_TTL_MS) return cached.level;
  const record = await ReviewAccess.findOne({ userId }).select('level');
  const level = record?.level ?? 'reviewer';
  reviewLevelCache.set(userId, { level, at: Date.now() });
  return level;
}

// Called from review access change event handler:
function invalidateReviewLevelCache(userId) { reviewLevelCache.delete(userId); }

function requireReviewAccess(minLevel) {
  const LEVEL_ORDER = ['reviewer', 'senior_reviewer', 'review_admin'];
  return async (req, res, next) => {
    const userLevel = await getReviewLevel(req.session.userId);  // DB, not JWT
    if (LEVEL_ORDER.indexOf(userLevel) < LEVEL_ORDER.indexOf(minLevel)) {
      return res.status(403).json({ error: 'Insufficient review access' });
    }
    req.reviewLevel = userLevel;
    next();
  };
}

PRIVESC46-002 — Missing level boundary on review assignment allows self-escalation to review_admin

Severity: HIGH

The review assignment endpoint accepts a targetUserId and newLevel parameter and updates the target user's review access level in the database. The endpoint requires an active session but does not enforce a boundary preventing users from assigning a level higher than their own current access level. Any authenticated reviewer can POST to this endpoint with their own userId as targetUserId and review_admin as newLevel — the endpoint accepts the request and updates the database.

Once the level is updated in the database, the fix in PRIVESC46-001 (DB-backed cache) correctly returns the elevated level on the next review workflow request — meaning PRIVESC46-002 is an escalation path that bypasses the JWT forgery requirement. An attacker with any reviewer-level account can self-elevate to review_admin by directly calling the assignment endpoint, then immediately approve their own malicious skill submissions. The assignment endpoint may also be used to escalate other accounts — granting review_admin to multiple accounts before the escalation is detected.

Vulnerable
// POST /api/skills/review/assign — no level boundary check
router.post('/assign', requireSession, async (req, res) => {
  const { targetUserId, newLevel } = req.body;
  // attacker: targetUserId = req.session.userId, newLevel = 'review_admin'
  await ReviewAccess.updateOne({ userId: targetUserId }, { $set: { level: newLevel } }, { upsert: true });
  return res.json({ assigned: true });
});
Fixed
// POST /api/skills/review/assign — level boundary check + Zod + audit log
const { z } = require('zod');
const LEVEL_ORDER = ['reviewer', 'senior_reviewer', 'review_admin'];

const ReviewAssignSchema = z.object({
  targetUserId: z.string().uuid(),
  newLevel:     z.enum(['reviewer', 'senior_reviewer', 'review_admin']),
});

router.post('/assign', requireSession, async (req, res) => {
  const parsed = ReviewAssignSchema.safeParse(req.body);
  if (!parsed.success) return res.status(400).json({ error: 'Invalid assign payload' });
  const actorLevel = await getReviewLevel(req.session.userId);
  if (LEVEL_ORDER.indexOf(parsed.data.newLevel) >= LEVEL_ORDER.indexOf(actorLevel)) {
    return res.status(403).json({ error: 'Cannot assign level equal to or exceeding own level' });
  }
  await ReviewAccess.updateOne({ userId: parsed.data.targetUserId },
    { $set: { level: parsed.data.newLevel } }, { upsert: true });
  invalidateReviewLevelCache(parsed.data.targetUserId);
  await AuditLog.create({ action: 'review.level.assigned', actorId: req.session.userId,
    targetUserId: parsed.data.targetUserId, newLevel: parsed.data.newLevel, at: new Date() });
  return res.json({ assigned: true });
});

PRIVESC46-003 — Missing ownership check on quality gate config allows disabling security scan requirements

Severity: HIGH

The quality gate configuration endpoint accepts PATCH requests to update the global quality gate thresholds — including minimum test coverage percentage, required security scan passing score, documentation completeness requirements, and the list of required security checks (SSRF scan, command injection scan, prompt injection analysis, etc.). The endpoint requires an active session but no role boundary check. Any authenticated user — including a skill publisher with no reviewer role — can send a PATCH request setting requiredSecurityChecks: [].

When requiredSecurityChecks is an empty array, the review workflow's quality gate evaluation loop iterates over zero items and returns passed: true for the security gate. Skills that would have failed due to detected SSRF vulnerabilities, command injection paths, or prompt injection risks are approved automatically. The impact affects all skills pending review and all future submissions until the configuration is restored — a single API call disables registry-wide security review for all publishers simultaneously.

Vulnerable
// PATCH /api/registry/review/quality-gates — no role check, no audit log
router.patch('/quality-gates', requireSession, async (req, res) => {
  const { minTestCoverage, requiredSecurityChecks, minDocScore } = req.body;
  // attacker: requiredSecurityChecks = [] disables all security scan requirements
  await QualityGateConfig.updateOne({}, { $set: { minTestCoverage, requiredSecurityChecks, minDocScore } });
  return res.json({ updated: true });
});
Fixed
// PATCH /api/registry/review/quality-gates — review_admin + Zod min(1) + audit log with diff
const QualityGateSchema = z.object({
  minTestCoverage:        z.number().min(0).max(100),
  minDocScore:            z.number().min(0).max(100),
  requiredSecurityChecks: z.array(z.enum(['ssrf', 'cmd_injection', 'prompt_injection',
    'credential_exposure', 'permissions_hygiene'])).min(1),
});

router.patch('/quality-gates', requireSession, requireReviewAccess('review_admin'), async (req, res) => {
  const parsed = QualityGateSchema.safeParse(req.body);
  if (!parsed.success) return res.status(400).json({ error: 'Invalid quality gate config', issues: parsed.error.issues });
  const previous = await QualityGateConfig.findOne({});
  await QualityGateConfig.updateOne({}, { $set: parsed.data }, { upsert: true });
  await AuditLog.create({ action: 'quality_gate.config.updated', actorId: req.session.userId,
    previous: previous?.toObject(), next: parsed.data, at: new Date() });
  await opsAlert({ event: 'quality_gate.config.changed', actorId: req.session.userId, diff: { previous, next: parsed.data } });
  return res.json({ updated: true });
});

PRIVESC46-004 — Review access level cache key lacks policy version causing permissions bleed

Severity: HIGH

The review access level cache introduced to fix PRIVESC46-001 uses userId as the sole cache key. When the registry administrator upgrades the review policy — requiring additional certifications, background checks, or seniority criteria for review_admin level — the existing cache entries remain valid. Reviewers who held review_admin under the old policy continue to pass the requireReviewAccess('review_admin') middleware checks for up to 60 seconds per request cycle, indefinitely, as the cache is refreshed from the database which still holds their review_admin level (the policy upgrade does not automatically downgrade existing assignments).

The bleed is indefinite because the cache TTL (60 seconds) is applied per access, not from first insertion. As long as the user continues making requests, the cache entry is refreshed from the database every 60 seconds and continues to return the pre-upgrade level. Policy upgrades that are intended to tighten access are silently ineffective for all users who held the elevated level before the upgrade — which is typically the set of users most likely to be mis-using the access level in the first place.

Vulnerable
// Review level cache — userId key only, no policy version
const reviewLevelCache = new Map();

async function getReviewLevel(userId) {
  const cached = reviewLevelCache.get(userId);  // key = userId only
  if (cached && Date.now() - cached.at < 60_000) return cached.level;
  const record = await ReviewAccess.findOne({ userId }).select('level');
  const level = record?.level ?? 'reviewer';
  reviewLevelCache.set(userId, { level, at: Date.now() });  // no policy version in key
  return level;
}
Fixed
// Review level cache — cache key = reviewPolicyVersionId:userId + invalidate on upgrade
let currentPolicyVersionId = null;

async function getCurrentPolicyVersionId() {
  if (!currentPolicyVersionId) {
    const config = await ReviewPolicyVersion.findOne({}).sort({ activatedAt: -1 }).select('versionId');
    currentPolicyVersionId = config?.versionId ?? 'default';
  }
  return currentPolicyVersionId;
}

const reviewLevelCache = new Map();

async function getReviewLevel(userId) {
  const policyVersionId = await getCurrentPolicyVersionId();
  const cacheKey = `${policyVersionId}:${userId}`;  // version-scoped key
  const cached = reviewLevelCache.get(cacheKey);
  if (cached && Date.now() - cached.at < 60_000) return cached.level;
  const record = await ReviewAccess.findOne({ userId, policyVersionId }).select('level');
  const level = record?.level ?? 'reviewer';
  reviewLevelCache.set(cacheKey, { level, at: Date.now() });
  return level;
}

// Called when review policy version is upgraded:
async function onReviewPolicyUpgrade(newVersionId) {
  currentPolicyVersionId = newVersionId;
  // invalidate entire cache — all old-policy entries now stale
  for (const key of reviewLevelCache.keys()) {
    if (!key.startsWith(newVersionId + ':')) reviewLevelCache.delete(key);
  }
}

// Called when a specific user's access level changes:
async function invalidateUserReviewLevel(userId) {
  const policyVersionId = await getCurrentPolicyVersionId();
  reviewLevelCache.delete(`${policyVersionId}:${userId}`);
}

Run SkillAudit to detect JWT authorization claim usage, missing level boundary checks on privilege assignment endpoints, unprotected global config mutation routes, and cache key design flaws in your MCP skill registry review workflow. Join the waitlist for access.