Claude MCP skill privilege escalation — skill marketplace and monetization endpoints — SA-SKL-PRIVESC37
SA-SKL-PRIVESC37 documents four privilege escalation vulnerabilities in MCP skill registry marketplace and monetization endpoints. Marketplace tiers — standard, featured, sponsored, and partner — gate access to limited placement slots that drive organic discovery. Misconfigured authorization checks allow attackers to occupy these premium placement slots without payment, displacing paying advertisers and distorting the organic discovery feed for all registry users. PRIVESC37-001 exploits a JWT claim that encodes marketplace tier, allowing any user to forge a featured_partner tier token. PRIVESC37-002 exploits a missing tier boundary check on listing creation. PRIVESC37-003 exploits a missing ownership check on listing configuration modification. PRIVESC37-004 exploits a cache key collision between deleted and recreated listings that grants paid promotion state to unpaid listings.
marketplaceTier claim; craft JWT with marketplaceTier:'featured_partner' grants free featured placement bypassing all paid promotion workflows; fix: DB-backed 60s Map cache keyed on userId+listingId; JWT carries only sub; invalidate on tier change eventPOST /api/marketplace/listings missing tier boundary check; any seller lists skills at premium tiers (featured, sponsored, recommended) without payment authorization, displacing paid advertisers from limited placement slots; fix: requireSession; validate listing tier does not exceed seller's paid tier; Zod ListingTierSchema; Stripe webhook verification; audit logPATCH /api/marketplace/listings/:id/config missing ownership check; any authenticated user modifies any listing's pricing, tier, promotional text, and display priority; fix: require listing.sellerId === req.session.userId OR marketplace_admin role; requireSession; audit loglistingId without sellerId; promotion cache entries bleed across listing deletion and recreation: a previously promoted listing's paid promotion state is served to a new listing with the same sequential integer ID, granting free paid placement; fix: cache key = sellerId:listingId; invalidate on listing reset; strict 60s TTLPRIVESC37-001 — JWT marketplaceTier claim forgery grants free featured placement
Severity: CRITICAL
The marketplace listing endpoint reads the caller's tier from the JWT payload field marketplaceTier. This claim is included in the JWT at login time based on the user's current subscription, but it is not re-verified against the database on each request — the endpoint trusts the claim from the token. An attacker who obtains a valid JWT (via standard authentication) can decode the token, modify the marketplaceTier claim from standard to featured_partner, and re-sign the modified token using an HS256 algorithm with an empty string as the secret — a known JWT algorithm confusion attack that works when the server accepts alg:none tokens or uses a predictable signing secret. The forged JWT grants access to the featured placement tier, which is displayed in the top carousel of the registry homepage and costs $499/month in the standard subscription flow.
// marketplace.js — tier from JWT claim, not from DB
router.post('/listings', requireSession, async (req, res) => {
const { skillId, tier, promotionalText } = req.body;
// VULNERABILITY: tier authorization from JWT claim only
const callerTier = req.user.marketplaceTier; // JWT claim, forgeable
if (!isAllowedTier(callerTier, tier)) {
return res.status(403).json({ error: 'Insufficient tier' });
}
await MarketplaceListing.create({ sellerId: req.session.userId, skillId, tier });
return res.status(201).json({ listed: true });
});
// marketplace.js — tier from DB-backed cache, not JWT
const tierCache = new Map(); // userId+listingId -> { tier, expiresAt }
async function getSellerTier(userId) {
const cacheKey = `tier:${userId}`;
const cached = tierCache.get(cacheKey);
if (cached && cached.expiresAt > Date.now()) return cached.tier;
const sub = await Subscription.findOne({ userId, status: 'active' });
const tier = sub?.marketplaceTier ?? 'standard';
tierCache.set(cacheKey, { tier, expiresAt: Date.now() + 60_000 }); // 60s TTL
return tier;
}
router.post('/listings', requireSession, async (req, res) => {
const { skillId, tier, promotionalText } = req.body;
const callerTier = await getSellerTier(req.session.userId); // DB-backed, not JWT
if (TIER_RANK[callerTier] < TIER_RANK[tier]) {
return res.status(403).json({ error: 'Requested tier exceeds subscription level' });
}
await MarketplaceListing.create({ sellerId: req.session.userId, skillId, tier });
await AuditLog.create({ action: 'marketplace.listing.created', userId: req.session.userId, tier });
return res.status(201).json({ listed: true });
});
PRIVESC37-002 — Missing tier boundary check on listing creation displaces paid advertisers
Severity: HIGH
The POST /api/marketplace/listings endpoint accepts a tier parameter in the request body but does not validate that the requested tier falls within the seller's authorized tier. Any seller with a standard subscription can submit a listing request with tier: "featured" or tier: "sponsored" and have the listing created at that tier without payment authorization. Featured and sponsored tiers have limited slot counts — typically 5–10 featured slots on the homepage carousel — so unauthorized listings at these tiers directly displace paying advertisers from their purchased placement positions. The revenue impact is both direct (paid advertisers lose visibility they paid for) and indirect (the tier's scarcity value is undermined if any user can occupy premium slots for free).
The fix validates the requested tier against the seller's DB-backed tier using the same getSellerTier() function from PRIVESC37-001, adds a Zod ListingTierSchema that restricts the tier field to the enum of valid tier names, and verifies via Stripe webhook that the subscription at the requested tier is active before persisting the listing.
PRIVESC37-003 — Missing ownership check on listing config modification
Severity: HIGH
The PATCH /api/marketplace/listings/:id/config endpoint modifies a listing's pricing, tier, promotional text, and display priority. It requires a valid session but does not check that the caller owns the listing — any authenticated user can modify any listing in the marketplace. This allows an attacker to demote competitors' listings to lower tiers, modify their pricing to appear uncompetitive, replace their promotional text with misleading content, or set their display priority to the minimum value to push them off the first page of search results. The attacker does not need to know the listing owner's credentials — they need only the listing's ID, which is typically visible in the marketplace URL.
// marketplace.js — PATCH with no ownership check
router.patch('/listings/:id/config', requireSession, async (req, res) => {
const { tier, promotionalText, displayPriority } = req.body;
// No ownership check — any authenticated user can modify any listing
await MarketplaceListing.updateOne(
{ _id: req.params.id },
{ tier, promotionalText, displayPriority }
);
return res.json({ updated: true });
});
// marketplace.js — PATCH with ownership check + audit log
router.patch('/listings/:id/config', requireSession, async (req, res) => {
const listing = await MarketplaceListing.findById(req.params.id);
if (!listing) return res.status(404).json({ error: 'Not found' });
// Ownership check: only the seller or a marketplace admin can modify the listing
const isAdmin = req.session.roles?.includes('marketplace_admin');
if (listing.sellerId.toString() !== req.session.userId && !isAdmin) {
return res.status(403).json({ error: 'Forbidden' });
}
const ListingConfigSchema = z.object({
tier: z.enum(['standard', 'featured', 'sponsored', 'recommended']).optional(),
promotionalText: z.string().max(500).optional(),
displayPriority: z.number().int().min(0).max(100).optional(),
}).strict();
const parsed = ListingConfigSchema.safeParse(req.body);
if (!parsed.success) return res.status(400).json({ error: 'Invalid config' });
// Validate tier change is within seller's authorized tier
if (parsed.data.tier) {
const sellerTier = await getSellerTier(listing.sellerId);
if (TIER_RANK[sellerTier] < TIER_RANK[parsed.data.tier]) {
return res.status(403).json({ error: 'Requested tier exceeds subscription level' });
}
}
await listing.updateOne(parsed.data);
await AuditLog.create({
action: 'marketplace.listing.config.updated',
listingId: listing._id, actorId: req.session.userId,
changes: parsed.data, timestamp: new Date(),
});
return res.json({ updated: true });
});
PRIVESC37-004 — Promotion cache key collision grants free paid placement via listing ID reuse
Severity: HIGH
The marketplace promotion cache uses listingId as the sole cache key. When a seller with a paid featured promotion deletes their listing, the promotion cache entry — which records the active featured promotion state — is not invalidated. If the marketplace assigns sequential integer IDs to listings (a common pattern with auto-increment primary keys), a new listing created after the deletion receives the same integer ID as the deleted one. The new listing's promotion lookup hits the stale cache entry, which reports an active featured promotion. The registry serves the new listing at the featured tier — without any payment — until the 60-second TTL expires and the cache entry is replaced with a fresh DB lookup.
The 60-second window is sufficient for an attacker who monitors the marketplace for deleted premium listings (visible via the listing history API) and immediately creates a new listing after a deletion. In a high-traffic marketplace, premium listing IDs are reused frequently enough that this attack is repeatable. The fix computes the cache key as sellerId:listingId, which is unique across the full listing lifecycle and does not collide across different sellers or after listing deletion and recreation. The cache is also invalidated explicitly on listing deletion, reset, or seller subscription change.
// promotion-cache.js — cache key is listingId only
const promotionCache = new Map();
async function getListingPromotion(listingId) {
const cached = promotionCache.get(listingId); // key = listingId only — collision risk
if (cached && cached.expiresAt > Date.now()) return cached;
const promo = await Promotion.findOne({ listingId, status: 'active' });
promotionCache.set(listingId, { ...promo, expiresAt: Date.now() + 60_000 });
return promo;
}
// promotion-cache.js — cache key = sellerId:listingId
const promotionCache = new Map();
async function getListingPromotion(sellerId, listingId) {
const cacheKey = `${sellerId}:${listingId}`; // unique across full lifecycle
const cached = promotionCache.get(cacheKey);
if (cached && cached.expiresAt > Date.now()) return cached;
const promo = await Promotion.findOne({ sellerId, listingId, status: 'active' });
promotionCache.set(cacheKey, { ...promo, expiresAt: Date.now() + 60_000 });
return promo;
}
// Invalidate on listing deletion or subscription change
function invalidatePromotionCache(sellerId, listingId) {
promotionCache.delete(`${sellerId}:${listingId}`);
}
Sequential integer IDs make cache collision attacks predictable. Any cache key that uses only a sequential integer ID as the cache key will collide when records are deleted and new ones are created with auto-increment IDs. Use compound cache keys that include at least one stable non-sequential dimension (like sellerId or userId) to prevent cross-record cache bleed. This applies to all promotion, permission, and privilege-level caches — not just marketplace tiers.
Remediation summary
| Finding | Severity | Root cause | Fix summary |
|---|---|---|---|
| PRIVESC37-001 | Critical | Marketplace tier read from forgeable JWT claim rather than DB | DB-backed tier cache keyed on userId; JWT carries only sub; invalidate on subscription change |
| PRIVESC37-002 | High | Listing creation accepts any tier in request body without seller tier check | Validate requested tier ≤ seller's DB-backed tier; Zod ListingTierSchema; Stripe webhook verification |
| PRIVESC37-003 | High | Listing config PATCH requires session but not ownership | listing.sellerId === req.session.userId OR marketplace_admin; audit log all changes |
| PRIVESC37-004 | High | Promotion cache key = listingId only; collides on sequential ID reuse after deletion | Cache key = sellerId:listingId; invalidate on deletion, reset, and subscription change |
SkillAudit scans marketplace and monetization endpoints for all four SA-SKL-PRIVESC37 patterns. See also SA-SKL-PRIVESC36 and SA-SKL-PRIVESC35. Connect your repository at skillaudit.dev.