← Security advisories

Claude MCP skill privilege escalation — skill collaboration and co-author management endpoints — SA-SKL-PRIVESC32

SA-SKL-PRIVESC32 documents four privilege escalation vulnerabilities in MCP skill registry collaboration and co-author management endpoints. These endpoints manage the multi-author model for skills that are collaboratively owned: reading co-author role levels from identity tokens, adding new collaborators at specified roles, modifying existing collaborator permissions, and validating invite tokens for collaborator onboarding. All four vulnerabilities allow an attacker to obtain permissions beyond what their legitimate role permits — escalating from reviewer to maintainer, from maintainer to owner, or accessing collaboration features on skills they have no relationship with.

SA-SKL-PRIVESC32 findings at a glance
CRITICALPRIVESC32-001 — co-author role read from JWT coAuthorRole claim; craft JWT with coAuthorRole:'owner' grants owner-level privileges including billing control and co-author revocation for victim skills
CRITICALPRIVESC32-002 — POST /api/skills/:id/collaborators missing role boundary check; any collaborator adds new co-authors with roles exceeding their own collaboration level (e.g., reviewer grants maintainer to external attacker)
CRITICALPRIVESC32-003 — PATCH /api/skills/:id/collaborators/:userId missing ownership check; any authenticated user modifies any other account's collaboration permissions on any skill, escalating reviewer to maintainer
HIGHPRIVESC32-004 — collaboration invite token cache key uses inviteCode without skillId; cache entries bleed across skills; expired invite from one skill served to new skill with same token prefix

PRIVESC32-001 — JWT coAuthorRole claim grants owner-level privileges including billing control and co-author revocation

The collaboration API reads the requesting user's co-author role for a given skill from the coAuthorRole claim in the JWT access token, rather than from the database. The JWT is signed with the registry's private key but the payload is not encrypted, and the claim value is accepted at face value without a database lookup. An attacker with any valid JWT — obtained by registering a free account — can craft a new JWT payload containing {"coAuthorRole": "owner", "skillId": "TARGET_SKILL_ID", ...} and sign it with an HMAC key that the attacker controls. If the registry does not strictly verify the JWT signing algorithm or accepts HS256-signed tokens in contexts where RS256 is expected (the "algorithm confusion" class of JWT vulnerabilities), the crafted token passes signature validation and grants owner-level co-author privileges on the target skill.

Owner-level co-author privileges are the highest collaboration tier in the registry's permission model. Owner co-authors have the same capabilities as the skill's original creator: they can modify the skill's billing configuration, change the subscription pricing, revoke access from other legitimate co-authors, delete the skill entirely, and transfer skill ownership to another account. An attacker who obtains owner co-author access on a victim's commercially successful skill can redirect subscription revenue, lock the legitimate authors out of the skill management interface, and ransom the skill's access back to its rightful owners.

PRIVESC32-001 fix: Never read authorization roles from JWT claims. Store co-author roles in the database with a compound primary key of (userId, skillId). Implement a server-side cache keyed on userId:skillId with a 60-second TTL to avoid a database round-trip on every collaboration API call. JWT carries only the user identity (sub claim); the role lookup always goes to the cache or database. Invalidate the cache entry immediately on any role change event. Verify the JWT signing algorithm explicitly and reject tokens signed with algorithms other than the expected RS256 key pair.

WRONG
router.get('/skills/:id/collaborators/me',
  verifyJwt, // only verifies signature, not algorithm
  async (req, res) => {
    // Role sourced from JWT — attacker-controllable
    const role = req.jwt.coAuthorRole;
    res.json({ role, canEdit: role === 'owner' || role === 'maintainer' });
  }
);
RIGHT
router.get('/skills/:id/collaborators/me',
  requireSession,
  async (req, res) => {
    const cacheKey = `collab:${req.session.userId}:${req.params.id}`;
    let role = roleCache.get(cacheKey);
    if (!role) {
      const collab = await db.getCollaborator(req.session.userId, req.params.id);
      role = collab?.role ?? 'none';
      roleCache.set(cacheKey, role, 60); // 60s TTL
    }
    res.json({ role, canEdit: role === 'owner' || role === 'maintainer' });
  }
);

PRIVESC32-002 — Missing role boundary check on collaborator add allows reviewer to grant maintainer to external attacker

The collaborator addition endpoint at POST /api/skills/:id/collaborators accepts an invitedRole body parameter that specifies the collaboration role to assign to the newly added co-author. The endpoint verifies that the requesting user is an existing collaborator on the skill but does not validate that the invitedRole value falls within the permission ceiling of the inviting user's own role. A reviewer (read-only collaborator) can submit a request assigning the maintainer or owner role to an invited user — granting permissions that the reviewer themselves does not possess and was never authorized to distribute.

Role boundary bypass at collaborator addition is particularly dangerous when combined with social engineering. An attacker who convinces a low-privilege reviewer collaborator to click a phishing link can silently add the attacker as a maintainer on the reviewer's skill, bypassing the need to compromise any high-privilege account. The reviewer's account is a much softer target than the skill owner's account: reviewers may have weaker authentication, less security awareness, and are more likely to be targeted through non-registry channels (email phishing, LinkedIn messages). Once the attacker is added as a maintainer, they can read the full skill source, modify it to include backdoors, and push the modified version to the marketplace under the legitimate skill's identity and reputation.

PRIVESC32-002 fix: After verifying that the requesting user is a collaborator, look up their current role from the database (not the JWT). Validate that the invitedRole value from the request does not exceed the inviting user's current role in the collaboration hierarchy: reviewer < contributor < maintainer < owner. Validate invitedRole against a strict Zod CollaborationRoleSchema enum before the boundary check. Write an audit log entry for every collaborator addition including the inviting user's role, the invited user's ID, the assigned role, and the timestamp.

PRIVESC32-003 — Missing ownership check on PATCH allows any user to escalate any collaborator's role on any skill

The collaborator role modification endpoint at PATCH /api/skills/:id/collaborators/:userId accepts a role body parameter and updates the target user's collaboration role on the specified skill. The endpoint verifies that the requesting session is authenticated but does not verify that the requesting user has any relationship to the skill or the target collaborator. Any authenticated user can submit a PATCH request to escalate any other user's collaboration role on any skill in the registry — for example, escalating themselves from no relationship to owner on another organization's skill, or escalating an external ally from reviewer to maintainer on a competitor's skill.

The absence of an ownership check on the PATCH endpoint means that every skill in the entire registry is vulnerable to unauthorized role modification by any registered user. An attacker with a free account can enumerate skill IDs through the public registry API, then submit a PATCH request assigning themselves the owner role on every skill in the registry. This is a horizontal privilege escalation at registry scale — not limited to skills where the attacker has an existing relationship. The attack is particularly effective against high-value skills with many marketplace installations, where owner-level access enables subscription revenue redirection, as described in PRIVESC32-001.

PRIVESC32-003 fix: Add an ownership and role check before accepting the PATCH operation. The requesting user must satisfy at least one of: skill.ownerId === req.session.userId (skill owner can modify any collaborator's role), or req.params.userId === req.session.userId (collaborators can reduce their own role to voluntarily downgrade). For the skill owner path, additionally verify that the new role does not create a second owner without explicit confirmation. Write an audit log entry for every collaboration role change. Reject any attempt to assign a role higher than maintainer through the PATCH endpoint; owner transfers must go through a separate dedicated transfer endpoint with additional confirmation.

WRONG
router.patch('/skills/:id/collaborators/:userId',
  requireSession, // Only checks that *some* session exists
  async (req, res) => {
    // No ownership check — any user can modify any collaborator on any skill
    await db.updateCollaboratorRole(
      req.params.id,
      req.params.userId,
      req.body.role
    );
    res.json({ updated: true });
  }
);
RIGHT
router.patch('/skills/:id/collaborators/:userId',
  requireSession,
  async (req, res) => {
    const skill = await db.getSkill(req.params.id);
    if (!skill) return res.status(404).json({ error: 'not_found' });
    const isOwner = skill.ownerId === req.session.userId;
    const isSelf = req.params.userId === req.session.userId;
    if (!isOwner && !isSelf) {
      return res.status(403).json({ error: 'forbidden' });
    }
    const newRole = CollaborationRoleSchema.parse(req.body.role);
    if (!isOwner && newRole !== 'none') {
      // Collaborators can only remove themselves, not change to another role
      return res.status(403).json({ error: 'forbidden' });
    }
    await db.updateCollaboratorRole(req.params.id, req.params.userId, newRole);
    await auditLog.write({ event: 'collaborator_role_changed',
      skillId: req.params.id, targetUserId: req.params.userId,
      newRole, actor: req.session.userId });
    res.json({ updated: true });
  }
);

PRIVESC32-004 — Invite token cache key without skillId enables expired invite reuse across skills

The collaboration invite validation logic caches validated invite tokens using only the inviteCode as the cache key, without including the skillId. When an invite token expires on one skill and the publisher creates a new skill that generates an invite code with the same prefix through sequential integer generation or similar deterministic logic, the cache returns the previously validated entry for the expired token from the first skill. The cache hit satisfies the invite validation check for the second skill, allowing the holder of the expired invite token from the first skill to join the second skill as a collaborator — with the role that the expired token specified from the first skill's invite configuration.

Cache key bleed via invite tokens enables a subtle but durable attack. An attacker who was previously invited to collaborate on a low-value skill (perhaps through social engineering a reviewer into inviting them) retains their expired invite token indefinitely. If the registry generates invite codes from a small namespace — sequential integers, short random strings, or codes derived from a predictable seed — the attacker can test their expired token against newly created skills and periodically find that the cache serves a hit, granting them collaboration access on the new skill without any authorization from that skill's owner. This attack requires no active exploitation of a request path: it is triggered automatically whenever the cache serves a stale cross-skill hit, which the legitimate skill owner has no visibility into.

PRIVESC32-004 fix: Include skillId in the cache key: use skillId:inviteCode as the compound key rather than inviteCode alone. Invalidate cache entries immediately when an invite expires rather than relying on TTL expiry. Apply a strict 60-second TTL as a defense-in-depth measure. Before serving any cached invite entry, verify that the skillId in the entry matches the skillId in the current request — reject the cache entry if they differ, forcing a fresh database lookup. Use cryptographically random invite codes of sufficient length (at least 128 bits of entropy) to make cross-skill token prefix collisions computationally infeasible regardless of cache key structure.

SkillAudit scans your registry's collaboration and co-author management endpoints for all four PRIVESC32 patterns — JWT role claim escalation, role boundary bypass, missing ownership checks, and invite token cache bleed — plus the full SA-SKL-PRIVESC series covering privilege escalation across MCP skill registry management endpoints. Get started free — 3 audits/month on public repos, results in 60 seconds.