← Security advisories

Claude MCP skill privilege escalation — skill marketplace and monetization access control endpoints — SA-SKL-PRIVESC44

SA-SKL-PRIVESC44 documents four privilege escalation vulnerabilities in MCP skill registry marketplace and monetization access control endpoints. Marketplace and monetization infrastructure manages revenue-critical access controls: who can view seller revenue dashboards, modify skill pricing, access payout data, and configure marketplace-wide commission rates. PRIVESC44 identifies four distinct escalation paths: JWT claim forgery grants marketplace_admin access including revenue dashboard and cross-seller payout visibility; a missing level boundary check on the access assignment endpoint allows any marketplace user to elevate themselves or others to marketplace_admin; a missing ownership check on the marketplace configuration endpoint allows any authenticated user to manipulate global commission rates and payout thresholds; and a cache key collision without marketplaceVersionId causes previously assigned marketplace_admin access to persist across marketplace policy version upgrades with different permission boundaries.

SA-SKL-PRIVESC44 findings at a glance
CRITICALPRIVESC44-001 — marketplace access level read from JWT marketplaceAccessLevel claim — craft JWT with marketplaceAccessLevel:'marketplace_admin' grants revenue dashboard access, ability to modify pricing for any skill, and access to all seller payout data; fix: DB-backed 60s Map cache keyed on userId; JWT carries only sub; invalidate on level change event
HIGHPRIVESC44-002 — POST /api/marketplace/access missing level boundary check — any marketplace user assigns marketplace_admin level to themselves or others exceeding their own access level; fix: requireSession; validate assigned level does not exceed assigning user's own level; Zod MarketplaceAccessLevelSchema; audit log
HIGHPRIVESC44-003 — PATCH /api/marketplace/config missing ownership check — any authenticated user modifies global marketplace configuration including commission rates, payout thresholds, and featured skill selection criteria; fix: require marketplace_admin level; requireSession; audit log
HIGHPRIVESC44-004 — marketplace access level cache key uses userId without marketplaceVersionId — cache entries bleed across marketplace policy version upgrades; previously assigned marketplace_admin level served under new marketplace version with different permission boundaries and revenue access scopes; fix: cache key = marketplaceVersionId:userId; invalidate on marketplace version change; strict 60s TTL

PRIVESC44-001 — JWT marketplaceAccessLevel claim forgery grants revenue dashboard access

Severity: CRITICAL

The marketplace access control middleware reads the user's marketplace access level from the JWT marketplaceAccessLevel claim. Because the JWT is signed by the registry's authentication service, a standard JWT cannot be forged by an external attacker — however, the application uses a symmetric signing key that is shared across multiple services and environments. An attacker who obtains the signing key (via SSRF to the metadata service, as documented in SA-SKL-SSRF63-001, or via credential exposure in another service) crafts a JWT with marketplaceAccessLevel: 'marketplace_admin'. The middleware trusts this claim without cross-referencing the database, granting the attacker full marketplace administrative access.

With marketplace_admin access the attacker can view the revenue dashboards for all sellers — including total earnings, payout history, refund rates, and customer conversion metrics for every skill in the marketplace. This constitutes a comprehensive exfiltration of commercially sensitive revenue data for all skill publishers. Additionally, the attacker can modify skill pricing, change commission rates, and access payout queue management, enabling direct financial manipulation of the marketplace.

The fundamental vulnerability is trusting access control decisions embedded in a client-supplied token rather than authoritative server-side state. Even with strong JWT signing, the JWT cannot reflect access level revocations, temporary suspensions, or policy changes that occur after the token was issued. Access levels must always be fetched from an authoritative database source on each request, with the JWT used only to establish identity (sub claim) rather than authorization level.

JWTs must carry identity, not authorization level. The sub claim (or equivalent user identifier) is appropriate JWT content because it is immutable for the token's lifetime. Access levels, roles, and permission scopes are mutable authorization state that must be read from an authoritative database source on every request. A DB-backed in-process cache with a 60-second TTL keyed on userId provides the performance characteristics of token-based authorization without its security limitations.

Vulnerable
// Marketplace access middleware — reads access level from JWT claim
function requireMarketplaceLevel(minimumLevel) {
  return (req, res, next) => {
    const { marketplaceAccessLevel } = req.jwt; // attacker forges this claim
    if (!hasMarketplaceAccess(marketplaceAccessLevel, minimumLevel)) {
      return res.status(403).json({ error: 'Insufficient marketplace access' });
    }
    next();
  };
}
Fixed
// Marketplace access middleware — DB-backed cache, JWT carries only sub
const marketplaceAccessCache = new Map(); // userId -> { level, marketplaceVersionId, cachedAt }

async function getMarketplaceAccessLevel(userId) {
  const cached = marketplaceAccessCache.get(userId);
  if (cached && Date.now() - cached.cachedAt < 60_000) return cached;

  const record = await MarketplaceAccess.findOne({ userId }).select('level marketplaceVersionId');
  if (!record) return null;

  const result = { level: record.level, marketplaceVersionId: record.marketplaceVersionId, cachedAt: Date.now() };
  marketplaceAccessCache.set(userId, result);
  return result;
}

function requireMarketplaceLevel(minimumLevel) {
  return async (req, res, next) => {
    const access = await getMarketplaceAccessLevel(req.session.userId);
    if (!access || !hasMarketplaceAccess(access.level, minimumLevel)) {
      return res.status(403).json({ error: 'Insufficient marketplace access' });
    }
    req.marketplaceAccess = access;
    next();
  };
}

PRIVESC44-002 — Missing level boundary check on marketplace access assignment

Severity: HIGH

The marketplace access assignment endpoint allows any marketplace participant to assign access levels to themselves or other users. The endpoint authenticates the requesting user and validates the target user identifier, but does not check whether the requesting user's own access level is sufficient to grant the requested level. A user with seller level access can POST to this endpoint to assign marketplace_admin level to their own account or to a confederate account, bypassing the intended access control hierarchy entirely.

The absence of a boundary check is a classic confused deputy vulnerability: the endpoint acts on behalf of the requesting user to modify another user's access level, but it does not verify that the acting user has the authority to grant the requested level. The fix requires comparing the assigned level against the assigning user's own current level, using the same DB-backed cache introduced in PRIVESC44-001, and rejecting any assignment where the requested level exceeds the assigning user's own access level.

Level assignment endpoints must enforce boundary checks: you cannot grant what you do not have. Any endpoint that assigns roles or access levels must verify that the assigning user's current level is at least as high as the level being granted. This check must use the authoritative DB-backed level, not a JWT claim, to prevent a user from using a stale token that reflects a higher level they no longer hold from granting that elevated level to others.

Vulnerable
// POST /api/marketplace/access — missing level boundary check
router.post('/marketplace/access', requireSession, async (req, res) => {
  const { targetUserId, level } = req.body;
  // no check whether req.session.userId's own level >= level being assigned
  await MarketplaceAccess.updateOne(
    { userId: targetUserId },
    { $set: { level } },
    { upsert: true }
  );
  return res.json({ assigned: true });
});
Fixed
// POST /api/marketplace/access — boundary check + Zod schema + audit log
import { z } from 'zod';
const MARKETPLACE_LEVELS = ['viewer', 'seller', 'marketplace_admin'];
const MarketplaceAccessSchema = z.object({
  targetUserId: z.string().uuid(),
  level: z.enum(['viewer', 'seller', 'marketplace_admin']),
});

router.post('/marketplace/access', requireSession, async (req, res) => {
  const parsed = MarketplaceAccessSchema.safeParse(req.body);
  if (!parsed.success) return res.status(400).json({ error: parsed.error });

  const actorAccess = await getMarketplaceAccessLevel(req.session.userId);
  if (!actorAccess) return res.status(403).json({ error: 'No marketplace access' });

  const actorLevelIndex = MARKETPLACE_LEVELS.indexOf(actorAccess.level);
  const assignedLevelIndex = MARKETPLACE_LEVELS.indexOf(parsed.data.level);

  if (assignedLevelIndex > actorLevelIndex) {
    return res.status(403).json({ error: 'Cannot assign a level exceeding your own access level' });
  }

  await MarketplaceAccess.updateOne(
    { userId: parsed.data.targetUserId },
    { $set: { level: parsed.data.level, assignedBy: req.session.userId, assignedAt: new Date() } },
    { upsert: true }
  );

  marketplaceAccessCache.delete(parsed.data.targetUserId);

  await AuditLog.create({
    action: 'marketplace.access.assigned', actorId: req.session.userId,
    targetUserId: parsed.data.targetUserId, level: parsed.data.level, at: new Date(),
  });

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

PRIVESC44-003 — Missing ownership check on marketplace configuration enables commission rate manipulation

Severity: HIGH

The marketplace configuration PATCH endpoint modifies global marketplace settings without verifying that the requesting user holds the marketplace_admin access level. Any authenticated user — including viewer-level accounts that have no marketplace selling privileges — can PATCH the marketplace configuration to modify commission rates, payout thresholds, and featured skill selection criteria. Because these are global settings that apply to all marketplace transactions, manipulation affects every skill seller's revenue.

An attacker who reduces the payout threshold to zero causes all pending payouts to be immediately released, potentially draining the payout queue in a single transaction. An attacker who sets the registry's commission rate to 100% blocks all seller payouts until the configuration is corrected. Featured skill selection criteria manipulation allows an attacker to substitute their own skills into featured positions, increasing their skills' visibility and sales while displacing legitimately featured skills. Each of these manipulations is financially impactful and may not be immediately detected if the marketplace lacks real-time configuration change alerting.

Revenue-affecting configuration endpoints require the highest access level check and comprehensive audit logging. Global marketplace configuration changes affect all sellers simultaneously and have direct financial impact. These endpoints must require marketplace_admin level verified against the authoritative DB-backed cache, generate audit log entries with the full before/after diff of changed fields, and trigger real-time alerts to marketplace operations teams on any configuration change.

Vulnerable
// PATCH /api/marketplace/config — missing ownership check, any user can modify
router.patch('/marketplace/config', requireSession, async (req, res) => {
  const { commissionRate, payoutThreshold, featuredSkillIds } = req.body;
  // no access level check — any authenticated user can modify global marketplace config
  await MarketplaceConfig.updateOne({ singleton: true }, {
    $set: { commissionRate, payoutThreshold, featuredSkillIds, updatedAt: new Date() }
  });
  return res.json({ updated: true });
});
Fixed
// PATCH /api/marketplace/config — marketplace_admin required + before/after diff + audit
import { z } from 'zod';
const MarketplaceConfigSchema = z.object({
  commissionRate: z.number().min(0).max(0.5).optional(),
  payoutThreshold: z.number().int().min(100).max(100000).optional(),
  featuredSkillIds: z.array(z.string().uuid()).max(20).optional(),
}).strict();

router.patch('/marketplace/config', requireSession, requireMarketplaceLevel('marketplace_admin'), async (req, res) => {
  const parsed = MarketplaceConfigSchema.safeParse(req.body);
  if (!parsed.success) return res.status(400).json({ error: parsed.error });

  const before = await MarketplaceConfig.findOne({ singleton: true }).lean();
  await MarketplaceConfig.updateOne({ singleton: true }, { $set: { ...parsed.data, updatedAt: new Date() } });
  const after = await MarketplaceConfig.findOne({ singleton: true }).lean();

  await AuditLog.create({
    action: 'marketplace.config.patched', actorId: req.session.userId,
    before, after, at: new Date(),
  });

  await alertOps('marketplace.config.changed', { actorId: req.session.userId, diff: parsed.data });

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

PRIVESC44-004 — Cache key collision bleeds marketplace_admin access across policy versions

Severity: HIGH

The marketplace access level cache uses userId as the sole cache key. When the marketplace undergoes a policy version upgrade — introducing new permission boundaries, new revenue access scopes, or revised definitions of what marketplace_admin can access — the cache is not invalidated by the version change. A user who held marketplace_admin access under the previous marketplace policy version continues to have that access level served from the cache under the new marketplace policy version, even if the new version restricts marketplace_admin access to a smaller scope or requires re-verification for the elevated level.

The practical impact depends on what the new marketplace policy version changes: if the new version restricts revenue dashboard access to a subset of marketplace_admin users who have completed identity verification, unverified users with cached marketplace_admin entries continue to access the revenue dashboard for up to 60 seconds per cache TTL cycle. If the registry does rolling deploys, the bleed window may be extended because different instances may deploy the new policy at different times, with some instances still serving old cache entries while others have deployed the new policy.

Access level caches must include a scope discriminator in the cache key. Any cache that stores authorization state must include all dimensions that affect the authorization decision in the cache key. For marketplace access levels, the marketplaceVersionId must be part of the cache key so that a marketplace policy version upgrade automatically invalidates all cached access entries for the previous version. The cache must also be explicitly invalidated on each individual access level change event via an event listener or webhook.

Vulnerable
// Marketplace access cache — userId only, bleeds across marketplace version upgrades
const marketplaceAccessCache = new Map(); // userId -> { level, cachedAt }

async function getMarketplaceAccessLevel(userId) {
  const cached = marketplaceAccessCache.get(userId);
  if (cached && Date.now() - cached.cachedAt < 60_000) return cached;

  const record = await MarketplaceAccess.findOne({ userId });
  const result = { level: record?.level ?? 'viewer', cachedAt: Date.now() };
  marketplaceAccessCache.set(userId, result);
  return result;
  // bleeds marketplace_admin across policy versions — new version does not invalidate cache
}
Fixed
// Marketplace access cache — marketplaceVersionId:userId key + event-driven invalidation
const marketplaceAccessCache = new Map(); // `${marketplaceVersionId}:${userId}` -> { level, cachedAt }

async function getCurrentMarketplaceVersionId() {
  const config = await MarketplaceConfig.findOne({ singleton: true }).select('versionId').lean();
  return config?.versionId ?? 'default';
}

async function getMarketplaceAccessLevel(userId) {
  const marketplaceVersionId = await getCurrentMarketplaceVersionId();
  const cacheKey = `${marketplaceVersionId}:${userId}`;

  const cached = marketplaceAccessCache.get(cacheKey);
  if (cached && Date.now() - cached.cachedAt < 60_000) return cached;

  const record = await MarketplaceAccess.findOne({ userId, marketplaceVersionId }).select('level');
  const result = { level: record?.level ?? 'viewer', marketplaceVersionId, cachedAt: Date.now() };
  marketplaceAccessCache.set(cacheKey, result);
  return result;
}

// invalidate on individual access level change events
eventBus.on('marketplace.access.changed', ({ userId, marketplaceVersionId }) => {
  marketplaceAccessCache.delete(`${marketplaceVersionId}:${userId}`);
});

// invalidate all entries on marketplace version upgrade
eventBus.on('marketplace.version.upgraded', ({ oldVersionId }) => {
  for (const key of marketplaceAccessCache.keys()) {
    if (key.startsWith(`${oldVersionId}:`)) marketplaceAccessCache.delete(key);
  }
});

All four SA-SKL-PRIVESC44 vulnerabilities reflect a consistent pattern of access control weaknesses in marketplace and monetization endpoints that govern revenue-critical operations. SkillAudit detects PRIVESC44-001 by flagging middleware that reads authorization level from JWT claims rather than a database-backed source; PRIVESC44-002 by detecting access assignment endpoints that do not include a comparison of the requested level against the assigning user's current level; PRIVESC44-003 by detecting PATCH or PUT endpoints on marketplace configuration paths that lack an access level check in the middleware chain; and PRIVESC44-004 by detecting in-process access level caches where the Map or object key is a bare userId without a scope dimension. See also SA-SKL-PRIVESC43 on analytics metrics access control endpoints for the companion chain targeting analytics infrastructure privilege escalation.

Defense-in-depth for marketplace access control

The four PRIVESC44 findings share a common root cause: access control decisions for marketplace operations rely on mutable state (JWT claims, in-process caches without scope keys, unvalidated assignment requests) rather than authoritative, immutable-at-read-time sources. A defense-in-depth approach requires three complementary controls. First, all marketplace access level checks must use a DB-backed in-process cache with a composite key that includes both the user identity and the current marketplace policy version, so that policy version upgrades automatically invalidate all cached entries for the old policy. Second, all access level assignment endpoints must enforce the boundary invariant that you cannot grant a level you do not hold, using the same authoritative cache for the comparison. Third, all marketplace configuration changes must generate comprehensive audit log entries with before/after diffs and real-time operational alerts, so that unauthorized or erroneous configuration changes are detected within minutes rather than discovered during the next financial reconciliation cycle.

SkillAudit detection

SkillAudit's static analysis rules detect all four PRIVESC44 vulnerability classes during CI pipeline scanning. The JWT authorization claim detector flags any middleware that reads authorization level, role, or access scope from a decoded JWT payload property rather than a database query or cached DB result. The boundary check detector flags access assignment route handlers that do not include a comparison between the assigned level and the assigning user's current level before the database write. The missing ownership check detector flags PATCH and PUT handlers on paths matching /marketplace/config or equivalent that lack a requireMarketplaceLevel() or equivalent access check in the middleware chain. The cache key composition detector flags in-process Map caches used for access level storage where the key is derived from a single user identifier without a scope or version discriminator. All findings include remediation snippets and links to this advisory.