Claude MCP skill privilege escalation — skill registry operator and platform administration endpoints — SA-SKL-PRIVESC41
SA-SKL-PRIVESC41 documents four privilege escalation vulnerabilities in MCP skill registry operator and platform administration endpoints. Registry operator endpoints govern the highest tier of platform authority — the ability to modify global skill approval policies, adjust rate limits and feature flags for all tenants, and access all user and organization data across the registry. PRIVESC41 identifies four distinct paths to platform_admin escalation: JWT claim forgery exploiting trust in a user-controlled payload field, missing level boundary enforcement on operator assignment allowing self-escalation, missing ownership check on global configuration modification allowing any authenticated user to change platform-wide policies, and cache key design that propagates previously assigned elevated levels to new registry deployments sharing the same integer user ID sequence.
registryOperatorLevel claim — craft JWT with registryOperatorLevel:'platform_admin' grants full registry configuration access, ability to modify global skill approval policies, and access to all user and organization data; fix: DB-backed 60s Map cache keyed on userId; JWT carries only sub; invalidate on level change eventPOST /api/registry/operators missing level boundary check — any registry operator assigns platform_admin level to themselves or others exceeding their own operator level; fix: requireSession; validate assigned level does not exceed assigning user's own level; Zod RegistryOperatorLevelSchema; audit logPATCH /api/registry/config missing ownership check — any authenticated user modifies global registry configuration including skill approval policies, rate limits, and feature flags; fix: require platform_admin level; requireSession; audit logplatform_admin level served to new registry instance with same sequential integer userId; fix: cache key = instanceId:userId; invalidate on instance redeploy; strict 60s TTLPRIVESC41-001 — JWT registryOperatorLevel claim forgery grants platform_admin
Severity: CRITICAL
The registry operator level authorization check reads the registryOperatorLevel field from the decoded JWT payload. JWTs are signed but their payload is not encrypted — any user can craft a JWT containing arbitrary claims if they possess the signing key, or if the server is vulnerable to algorithm confusion (substituting RS256's public key as the HS256 HMAC secret to forge tokens without the private key). An attacker crafts a JWT with registryOperatorLevel: 'platform_admin'. When the middleware reads this claim and trusts it without a database lookup, the attacker gains full registry configuration access — the ability to modify global skill approval policies, change rate limits and feature flag states for all tenants, and access all user and organization data.
Authorization roles must never be read from JWT claims. JWTs are user-controlled inputs. Even properly signed JWTs should not carry authorization levels — the user who holds the JWT may have had their role revoked since it was issued. The JWT should carry only the subject identifier (sub); all role lookups must hit a database or a short-TTL cache keyed on that identifier.
// Registry operator middleware — reads level from JWT claim
function requireRegistryOperator(minLevel) {
return (req, res, next) => {
const token = req.headers.authorization?.split(' ')[1];
const payload = jwt.verify(token, process.env.JWT_SECRET);
// attacker controls registryOperatorLevel in JWT payload
if (!hasLevel(payload.registryOperatorLevel, minLevel)) {
return res.status(403).json({ error: 'Insufficient operator level' });
}
req.operatorLevel = payload.registryOperatorLevel;
next();
};
}
// Registry operator middleware — DB-backed cache keyed on sub only
const operatorCache = new Map(); // key: userId, value: { level, expiresAt }
function requireRegistryOperator(minLevel) {
return async (req, res, next) => {
const token = req.headers.authorization?.split(' ')[1];
const payload = jwt.verify(token, process.env.JWT_SECRET);
const userId = payload.sub; // only sub from JWT
let entry = operatorCache.get(userId);
if (!entry || Date.now() > entry.expiresAt) {
const op = await RegistryOperator.findOne({ userId }).select('level');
entry = { level: op?.level ?? null, expiresAt: Date.now() + 60_000 };
operatorCache.set(userId, entry);
}
if (!entry.level || !hasLevel(entry.level, minLevel)) {
return res.status(403).json({ error: 'Insufficient operator level' });
}
req.operatorLevel = entry.level;
next();
};
}
PRIVESC41-002 — Self-escalation via missing level boundary on operator assignment
Severity: HIGH
The registry operator assignment endpoint creates or updates operator records. It verifies that the caller has a registry operator role but does not check that the assigned level is within the caller's own authority. An operator at content_moderator level can call this endpoint to assign platform_admin level to themselves or any other user. Because the endpoint creates the operator record in the database before the cache TTL expires, the new level takes effect within 60 seconds across all workers. No audit log is written, so the self-escalation leaves no trace in the standard access control review workflow.
// POST /api/registry/operators — no level boundary check
router.post('/operators', requireRegistryOperator('content_moderator'), async (req, res) => {
const { targetUserId, level } = req.body;
// attacker submits level:'platform_admin' — no boundary check
await RegistryOperator.findOneAndUpdate(
{ userId: targetUserId },
{ level },
{ upsert: true }
);
return res.status(200).json({ updated: true });
});
// POST /api/registry/operators — level boundary + Zod + audit log
import { z } from 'zod';
const OPERATOR_LEVELS = ['viewer', 'content_moderator', 'policy_editor', 'platform_admin'];
const RegistryOperatorLevelSchema = z.enum(OPERATOR_LEVELS);
router.post(
'/operators',
requireSession,
requireRegistryOperator('policy_editor'),
async (req, res) => {
const parsed = z.object({
targetUserId: z.string().uuid(),
level: RegistryOperatorLevelSchema,
}).safeParse(req.body);
if (!parsed.success) return res.status(400).json({ error: 'Invalid payload' });
const callerIdx = OPERATOR_LEVELS.indexOf(req.operatorLevel);
const assignIdx = OPERATOR_LEVELS.indexOf(parsed.data.level);
if (assignIdx > callerIdx) {
return res.status(403).json({ error: 'Cannot assign level exceeding your own' });
}
await RegistryOperator.findOneAndUpdate(
{ userId: parsed.data.targetUserId },
{ level: parsed.data.level },
{ upsert: true }
);
// invalidate cache for target user
operatorCache.delete(parsed.data.targetUserId);
await AuditLog.create({
action: 'operator.level_assigned', actorId: req.session.userId,
targetUserId: parsed.data.targetUserId, level: parsed.data.level,
at: new Date(),
});
return res.status(200).json({ updated: true });
}
);
PRIVESC41-003 — Any authenticated user modifies global registry configuration
Severity: HIGH
The global registry configuration endpoint accepts PATCH requests that update skill approval policies, per-tenant rate limits, and feature flag states. The endpoint requires requireSession but not requireRegistryOperator. Any authenticated registry user — including skill publishers, reviewers, and read-only API consumers — can modify global registry settings. Changes take effect immediately and affect all tenants. Downgraded approval policies appear as legitimate configuration updates in the registry settings log because they are performed by a valid authenticated session rather than an anonymous request.
// PATCH /api/registry/config — requireSession only, no operator level check
router.patch('/config', requireSession, async (req, res) => {
const { approvalPolicy, rateLimits, featureFlags } = req.body;
await RegistryConfig.findOneAndUpdate({}, {
approvalPolicy, // any user can disable skill approval
rateLimits,
featureFlags,
});
return res.json({ updated: true });
});
// PATCH /api/registry/config — platform_admin level + Zod + audit log
const ConfigSchema = z.object({
approvalPolicy: z.enum(['auto_approve', 'manual_review', 'strict_review']).optional(),
rateLimits: z.record(z.number().positive()).optional(),
featureFlags: z.record(z.boolean()).optional(),
}).refine(d => Object.keys(d).length > 0, 'At least one field required');
router.patch(
'/config',
requireSession,
requireRegistryOperator('platform_admin'),
async (req, res) => {
const parsed = ConfigSchema.safeParse(req.body);
if (!parsed.success) return res.status(400).json({ error: 'Invalid config payload' });
await RegistryConfig.findOneAndUpdate({}, parsed.data);
await AuditLog.create({
action: 'registry.config_updated', actorId: req.session.userId,
changes: parsed.data, at: new Date(),
});
return res.json({ updated: true });
}
);
PRIVESC41-004 — Operator level cache bleed across instance redeployment
Severity: HIGH
The registry operator level cache is keyed only on userId. When a registry instance is redeployed — during a scheduled update, a failover, or a rollback — the new instance initializes with an empty cache. User IDs are assigned as sequential integers by the database. A new registry instance that creates its first user will assign that user ID 1. If a previous registry instance previously assigned platform_admin level to userId 1, and a cache write from a background job or cross-instance cache synchronization populates the new instance's cache with the old mapping, the new user at userId 1 inherits the previous user's platform_admin level during the 60-second TTL window. This requires no active attack from the new user — the cache bleed occurs passively due to the shared integer sequence across deployments.
Cache keys must include deployment-scoped identifiers. Any cache that stores authorization state must be scoped to both the deployment instance and the user. Without the instance identifier, cache entries from a previous deployment can be served to users of the current deployment if the user ID sequences overlap — which they always will in systems using sequential integer or recycled UUID user IDs.
// Operator level cache — keyed on userId only
const operatorCache = new Map(); // key: userId
// userId:1 from old instance mapped to platform_admin
// new instance creates user with userId:1 — inherits platform_admin from cache bleed
operatorCache.set('1', { level: 'platform_admin', expiresAt: Date.now() + 60_000 });
// Operator level cache — keyed on instanceId:userId
const INSTANCE_ID = process.env.REGISTRY_INSTANCE_ID || crypto.randomUUID();
const operatorCache = new Map(); // key: `${INSTANCE_ID}:${userId}`
function cacheKey(userId) { return `${INSTANCE_ID}:${userId}`; }
// on instance startup, clear any cache entries not matching current INSTANCE_ID
// (handled automatically because Map is in-process and starts empty on restart)
// on level change event, invalidate specific key
eventBus.on('operator.level_changed', ({ userId }) => {
operatorCache.delete(cacheKey(userId));
});
All four SA-SKL-PRIVESC41 vulnerabilities reflect a consistent pattern of trusting user-controlled or insufficiently-scoped authorization signals for registry operator level checks. SkillAudit detects PRIVESC41-001 by flagging JWT payload field reads used in authorization comparisons without a cache-or-database lookup in the same handler; PRIVESC41-002 by detecting role assignment endpoints without caller-level comparison; PRIVESC41-003 by flagging configuration write endpoints without operator-level middleware; and PRIVESC41-004 by detecting cache key expressions that include userId without an instance or deployment identifier. See also SA-SKL-PRIVESC40 on organization admin and billing control endpoints for the companion chain targeting tenant-level escalation paths.