← Blog

Claude MCP skill privilege escalation — skill marketplace revenue reporting and commission management endpoints (SA-SKL-PRIVESC53)

SA-SKL-PRIVESC53 identifies four privilege escalation vulnerabilities in MCP skill registry skill marketplace revenue reporting and commission management endpoints. The marketplace access level is read from a JWT marketplaceLevel claim — crafting a JWT with marketplaceLevel:'marketplace_admin' grants access to cross-seller revenue dashboards, pricing modification tools, and payout queue management; a POST endpoint for seller access assignment is missing a level boundary check, allowing any marketplace seller to assign marketplace_admin to themselves; a PATCH endpoint for commission configuration is missing an ownership check, allowing any authenticated user to set the commission rate to 0% or modify payout thresholds affecting all marketplace sellers; and the marketplace access level cache key uses only userId without marketplacePolicyVersionId, causing cache entries to bleed across marketplace policy upgrades so downgraded users retain stale elevated access until TTL expiry.

SA-SKL-PRIVESC53 findings at a glance
CRITICALPRIVESC53-001 — marketplace access level read from JWT marketplaceLevel claim — craft JWT with marketplaceLevel:'marketplace_admin' grants cross-seller revenue dashboard, pricing modification, and payout queue management
CRITICALPRIVESC53-002 — POST /api/marketplace/seller/access missing level boundary check — any marketplace seller assigns marketplace_admin to themselves
HIGHPRIVESC53-003 — PATCH /api/marketplace/commission/config missing ownership check — any authenticated user sets commission rate to 0% or modifies payout thresholds affecting all marketplace sellers
MEDIUMPRIVESC53-004 — marketplace access level cache key uses userId without marketplacePolicyVersionId — cache entries bleed across marketplace policy upgrades; downgraded users retain elevated access until TTL expiry

PRIVESC53-001 — JWT marketplaceLevel claim manipulation grants cross-seller revenue dashboard access

The marketplace revenue reporting middleware reads the user's access level directly from the marketplaceLevel field in the decoded JWT payload rather than querying the access level from the database. JWT payloads are signed but their claims are entirely determined by whatever value was in the token at issuance time. If the JWT signing key is weak, leaked, or the same key is used across multiple services (a common pattern in microservice deployments), an attacker can craft a token with marketplaceLevel: 'marketplace_admin' that passes signature verification. Alternatively, if the registry accepts tokens from a less-secure issuer in the same SSO federation, the attacker can obtain a token from that issuer with an elevated claim.

With marketplace_admin access, the attacker can retrieve the revenue dashboard for every seller in the marketplace, including their total gross revenue, net revenue after commissions, individual transaction history, payout amounts and bank account identifiers, and pricing configuration for each skill listing. The payout queue management access additionally allows the attacker to modify pending payout records, re-route payouts to different bank accounts, or delete pending payouts entirely. The pricing modification tools allow the attacker to change the listed prices of any skill in the marketplace, potentially setting them to zero (causing immediate revenue loss) or to arbitrarily high values (causing reputational damage to the affected seller).

Vulnerable
// PRIVESC53-001 — VULNERABLE
router.get('/revenue/dashboard', requireSession, async (req, res) => {
  // VULNERABLE: access level read from JWT claim — attacker controls claim value
  const marketplaceLevel = req.jwtPayload.marketplaceLevel;
  if (marketplaceLevel === 'marketplace_admin') {
    // Returns revenue data for ALL sellers in the marketplace
    const allReports = await db.allSellerRevenueReports();
    return res.json(allReports);
  }
  if (marketplaceLevel === 'marketplace_seller') {
    const myReport = await db.sellerRevenueReport(req.session.userId);
    return res.json(myReport);
  }
  return res.status(403).json({ error: 'Forbidden' });
});

Attack PoC — PRIVESC53-001: An attacker crafts a JWT with an elevated marketplaceLevel claim. The revenue dashboard returns cross-seller revenue data, transaction history, payout records, and bank account identifiers for every seller in the marketplace.

// PRIVESC53-001 — ATTACK PoC
// Attacker obtains or crafts a JWT with elevated marketplaceLevel claim
// Using a leaked or weak signing key:
const jwt = require('jsonwebtoken');
const maliciousToken = jwt.sign(
  {
    userId: 'attacker-user-id',
    email: 'attacker@example.com',
    marketplaceLevel: 'marketplace_admin', // elevated claim
    iat: Math.floor(Date.now() / 1000),
    exp: Math.floor(Date.now() / 1000) + 3600,
  },
  'leaked-or-weak-signing-key'
);

fetch('/api/marketplace/revenue/dashboard', {
  headers: { Authorization: `Bearer ${maliciousToken}` },
})
  .then(r => r.json())
  .then(allReports => {
    // allReports contains revenue, payout, and bank account data for ALL sellers
    console.log('Cross-seller revenue data exfiltrated:', allReports.length, 'sellers');
  });
Fixed
// PRIVESC53-001 — FIXED
router.get('/revenue/dashboard', requireSession, async (req, res) => {
  // FIXED: access level ALWAYS read from database — never from JWT claim
  const { marketplaceLevel } = await db.marketplaceAccess.findOne({
    where: { userId: req.session.userId },
    attributes: ['marketplaceLevel'],
  });
  if (marketplaceLevel === 'marketplace_admin') {
    const allReports = await db.allSellerRevenueReports();
    return res.json(allReports);
  }
  if (marketplaceLevel === 'marketplace_seller') {
    const myReport = await db.sellerRevenueReport(req.session.userId);
    return res.json(myReport);
  }
  return res.status(403).json({ error: 'Forbidden' });
});

PRIVESC53-002 — Missing level boundary check enables marketplace_admin self-assignment

The seller access assignment endpoint allows an authenticated user to set the marketplace access level for a target user ID. The endpoint correctly requires the caller to hold the marketplace_seller role, preventing unauthenticated or regular-user access. However, it does not check whether the requested level is within the bounds of what the caller's own role is permitted to assign. Any marketplace_seller can therefore call the endpoint with {targetUserId: attackerUserId, level: 'marketplace_admin'} and immediately grant themselves the highest marketplace access level.

The absence of a self-assignment prevention check compounds the issue: the attacker sets their own targetUserId, so the escalation is entirely self-service and requires no cooperation from any other user. After a successful PRIVESC53-002 exploitation, the attacker holds a database-backed marketplace_admin role that persists until an administrator explicitly revokes it. Because the assignment is made via the legitimate API endpoint with a valid session, the event appears in the audit log as a routine access assignment operation. Without a Zod schema that restricts assignable levels based on the caller's current role, any marketplace seller in the organization — including third-party plugin developers who registered as sellers to distribute their skills — can self-escalate to full marketplace administration.

Vulnerable
// PRIVESC53-002 — VULNERABLE
router.post(
  '/seller/access',
  requireSession,
  requireRole('marketplace_seller'), // VULNERABLE: only checks caller is a seller
  async (req, res) => {
    const { targetUserId, level } = req.body;
    // VULNERABLE: no level boundary check — any seller can assign any level
    // VULNERABLE: no self-assignment prevention
    await db.marketplaceAccess.upsert({
      userId: targetUserId,
      marketplaceLevel: level,
      assignedByUserId: req.session.userId,
      assignedAt: new Date(),
    });
    res.json({ ok: true });
  }
);

Attack PoC — PRIVESC53-002: Any marketplace_seller self-assigns marketplace_admin in a single API call. The escalation is database-backed and persists until manually revoked. The audit log records a routine access assignment with the attacker as both actor and subject.

// PRIVESC53-002 — ATTACK PoC
// Attacker is an authenticated marketplace_seller
fetch('/api/marketplace/seller/access', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    targetUserId: 'attacker-own-user-id', // self-assignment
    level: 'marketplace_admin',           // elevated level — no boundary check
  }),
})
  .then(r => r.json())
  .then(() => {
    // Attacker now holds marketplace_admin in database
    // All subsequent requests using database-backed access check return admin access
    console.log('Escalated to marketplace_admin');
  });
Fixed
// PRIVESC53-002 — FIXED

// Permission matrix: maps caller role to assignable levels
const ASSIGNABLE_LEVELS = {
  marketplace_admin: ['marketplace_seller', 'marketplace_viewer'],
  // marketplace_seller cannot assign any role — handled below
};

router.post(
  '/seller/access',
  requireSession,
  requireRole('marketplace_admin'), // FIXED: only admins may assign access levels
  async (req, res) => {
    const parsed = MarketplaceAccessAssignSchema.safeParse(req.body);
    if (!parsed.success) return res.status(422).json({ error: parsed.error.issues });
    const { targetUserId, level } = parsed.data;
    // FIXED: prevent self-assignment
    if (targetUserId === req.session.userId) {
      return res.status(403).json({ error: 'Self-assignment is not permitted' });
    }
    const callerLevel = await db.getMarketplaceLevel(req.session.userId);
    const allowedLevels = ASSIGNABLE_LEVELS[callerLevel] ?? [];
    if (!allowedLevels.includes(level)) {
      return res.status(403).json({ error: 'You are not permitted to assign this level' });
    }
    await db.marketplaceAccess.upsert({
      userId: targetUserId,
      marketplaceLevel: level,
      assignedByUserId: req.session.userId,
      assignedAt: new Date(),
    });
    await auditLog.write({ action: 'marketplace.access.assigned', targetUserId, level, actorId: req.session.userId });
    res.json({ ok: true });
  }
);

PRIVESC53-003 — Missing ownership check on commission config allows global rate override

The commission configuration endpoint accepts a commissionRate and payoutThreshold in the request body and applies them to all marketplace sellers via a WHERE {} condition in the update query (an empty where clause matches every row). The endpoint requires only an active session — no ownership check, no role check, and no scope restriction to the caller's own seller account. Any authenticated user, including buyers with no seller role and third-party developers who have never published a skill, can call this endpoint and set the global commission rate to 0% and the payout threshold to $0.

Setting the commission rate to 0% eliminates all marketplace revenue for the registry operator for as long as the configuration remains in place. Setting the payout threshold to $0 triggers an immediate payout cycle for every seller with any pending balance, potentially triggering hundreds or thousands of financial transactions simultaneously. The combination of zero commission and immediate payouts can deplete the registry operator's payment processor balance and trigger fraud detection holds across all seller payout accounts. Because the endpoint logs only the user ID of the caller without a role-check assertion, the attack is difficult to attribute quickly during incident response — any user in the system is a valid suspect until the missing authorization check is identified.

Vulnerable
// PRIVESC53-003 — VULNERABLE
router.patch(
  '/commission/config',
  requireSession, // VULNERABLE: only requires a valid session — no role check
  async (req, res) => {
    const { commissionRate, payoutThreshold } = req.body;
    // VULNERABLE: WHERE {} matches ALL rows — no ownership or scope restriction
    await db.marketplaceCommissionConfig.update(
      { commissionRate, payoutThreshold },
      { where: {} }
    );
    res.json({ ok: true });
  }
);

Attack PoC — PRIVESC53-003: Any authenticated user sets the global commission rate to 0% and payout threshold to $0. This eliminates all marketplace revenue, triggers immediate payouts for every seller, and potentially causes payment processor fraud holds across all seller accounts.

// PRIVESC53-003 — ATTACK PoC
// Any authenticated user (buyer, viewer, third-party developer) can call this
fetch('/api/marketplace/commission/config', {
  method: 'PATCH',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    commissionRate: 0,      // 0% commission — registry earns nothing
    payoutThreshold: 0,     // $0 threshold — triggers immediate payouts for all sellers
  }),
})
  .then(r => r.json())
  .then(() => {
    // Global commission config overwritten — affects all sellers in the marketplace
    // Immediate payout cycle triggered for every seller with any pending balance
    console.log('Commission rate set to 0%; mass payout triggered');
  });
Fixed
// PRIVESC53-003 — FIXED
const CommissionConfigSchema = z.object({
  commissionRate: z.number().min(0.01).max(0.5), // 1%–50%, not zero
  payoutThreshold: z.number().min(10).max(10000), // $10–$10000 minimum threshold
});

router.patch(
  '/commission/config',
  requireSession,
  requireRole('marketplace_admin'), // FIXED: admin role required
  async (req, res) => {
    const parsed = CommissionConfigSchema.safeParse(req.body);
    if (!parsed.success) return res.status(422).json({ error: parsed.error.issues });
    const { commissionRate, payoutThreshold } = parsed.data;
    const before = await db.marketplaceCommissionConfig.findOne();
    await db.marketplaceCommissionConfig.update(
      { commissionRate, payoutThreshold, updatedByUserId: req.session.userId },
      { where: {} }
    );
    await auditLog.write({
      action: 'marketplace.commission.config.updated',
      actorId: req.session.userId,
      before: { commissionRate: before.commissionRate, payoutThreshold: before.payoutThreshold },
      after: { commissionRate, payoutThreshold },
    });
    res.json({ ok: true });
  }
);

PRIVESC53-004 — Access level cache key without policy version causes cross-upgrade bleed

The marketplace access level middleware caches the resolved access level for each user using the cache key 'marketplace_level:' + userId with a 300-second TTL. When a marketplace administrator downgrades a user's access level — for example, removing marketplace_admin and replacing it with marketplace_seller after a policy violation — the cached entry for the downgraded user continues to return the old elevated level for up to five minutes. During this window, the downgraded user retains full access to cross-seller revenue dashboards, payout queue management, and pricing modification tools despite the database reflecting the lower access level.

The cache bleed is particularly acute around marketplace policy version upgrades. When the registry deploys a new marketplace access control policy that reorganizes role boundaries (a common operation when the marketplace tiers are restructured), all existing cache entries that predate the policy change continue to authorize users under the old policy rules. Users who had elevated access under the old policy but are not supposed to have it under the new policy retain that access for up to 300 seconds per cache cycle. In a high-traffic registry with many concurrent users, this window can affect dozens of active sessions simultaneously. The fix is to include the current marketplace policy version identifier in the cache key, ensuring that any policy change immediately invalidates all existing level cache entries for all users.

Vulnerable
// PRIVESC53-004 — VULNERABLE
async function getMarketplaceLevel(userId) {
  // VULNERABLE: cache key contains only userId — no policy version
  const cacheKey = 'marketplace_level:' + userId;
  const cached = await cache.get(cacheKey);
  if (cached) {
    // Returns stale elevated level for up to 300s after downgrade
    return cached;
  }
  const { marketplaceLevel } = await db.marketplaceAccess.findOne({
    where: { userId },
    attributes: ['marketplaceLevel'],
  });
  await cache.set(cacheKey, marketplaceLevel, 'EX', 300);
  return marketplaceLevel;
}

router.get('/revenue/dashboard', requireSession, async (req, res) => {
  const marketplaceLevel = await getMarketplaceLevel(req.session.userId);
  if (marketplaceLevel === 'marketplace_admin') {
    return res.json(await db.allSellerRevenueReports());
  }
  // ...
});

Attack PoC — PRIVESC53-004: An admin downgrades the attacker from marketplace_admin to marketplace_seller. The attacker continues to access cross-seller revenue dashboards and payout management for up to 300 seconds while the stale cache entry persists. During a policy upgrade, all users affected by the policy change retain their old access levels for the same window.

// PRIVESC53-004 — ATTACK PoC
// Scenario: admin has downgraded attacker from marketplace_admin to marketplace_seller
// Attacker's cache entry still returns 'marketplace_admin' for up to 300s

// Attacker continues calling admin-only endpoints within the TTL window:
fetch('/api/marketplace/revenue/dashboard')
  .then(r => r.json())
  .then(allReports => {
    // Still returns cross-seller data despite database downgrade
    console.log('Stale cache: still have admin access,', allReports.length, 'sellers');
  });

// Policy upgrade scenario: marketplace policy version incremented to v2
// All cache entries for users whose roles changed under v2 are still keyed to v1 values
// Users downgraded by the new policy retain v1 elevated access for up to 300s per entry
Fixed
// PRIVESC53-004 — FIXED
async function getMarketplacePolicyVersion() {
  // Policy version increments on every access policy change or tier restructure
  return db.marketplacePolicyVersion.findOne({ order: [['createdAt', 'DESC']] });
}

async function getMarketplaceLevel(userId) {
  // FIXED: include policy version in cache key — policy change invalidates all entries
  const policyVersion = await getMarketplacePolicyVersion();
  const cacheKey = `marketplace_level:${policyVersion.id}:${userId}`;
  const cached = await cache.get(cacheKey);
  if (cached) return cached;
  const { marketplaceLevel } = await db.marketplaceAccess.findOne({
    where: { userId },
    attributes: ['marketplaceLevel'],
  });
  await cache.set(cacheKey, marketplaceLevel, 'EX', 300);
  return marketplaceLevel;
}

// FIXED: on any access level change, also explicitly invalidate the specific user's entry
async function updateMarketplaceLevel(userId, newLevel, actorId) {
  await db.marketplaceAccess.upsert({
    userId, marketplaceLevel: newLevel, assignedByUserId: actorId, assignedAt: new Date(),
  });
  // Explicit invalidation across all policy versions for this user
  const keys = await cache.keys(`marketplace_level:*:${userId}`);
  if (keys.length > 0) await cache.del(keys);
}

SkillAudit detection: The scanner identifies PRIVESC53 patterns using four AST query classes: req.jwtPayload. access on fields that gate privilege decisions in marketplace route handlers; requireRole( calls that allow seller-tier roles on access assignment endpoints without a level boundary check against ASSIGNABLE_LEVELS; db. update calls with an empty where: {} condition on configuration tables in endpoints lacking requireRole('marketplace_admin'); and cache key construction patterns that concatenate only userId without a policy version identifier. Submit your MCP skill registry codebase to SkillAudit for a full audit report.

Related: SA-SKL-PRIVESC52 — Privilege escalation in analytics dashboard and report management endpoints • All advisories