Claude MCP skill privilege escalation — organisation ownership transfer and account deletion endpoints — SA-SKL-PRIVESC24
SA-SKL-PRIVESC24 documents four privilege escalation vulnerabilities in MCP skill registry organisation ownership transfer and account deletion endpoints. These are the highest-stakes account lifecycle operations in a multi-tenant registry: they irrevocably change who controls an organization, who can access a user's data, and what records survive. All four vulnerabilities stem from the same root cause — trusting user-controlled input (JWT claims, URL parameters, request body fields) to establish authorization rather than performing server-side verification. The impact ranges from silent org hijacking to unrestricted GDPR data package exfiltration of any user in the registry.
newOwnerRole from JWT claim; craft JWT with newOwnerRole:'owner' and any targetOrgId to become owner of any org without current owner consent or verificationPOST /api/users/:id/delete missing ownership check; any authenticated user deletes any other user's account by supplying the target user's ID in the URL pathPOST /api/orgs/:id/delete missing final admin count check; a member with admin role demotes the last owner then deletes the org, destroying all org skills, audit history, and billing recordsPOST /api/users/:id/export/gdpr missing ownership check; any authenticated user exports any user's full GDPR data package including email, audit history, payment methods, and API keysPRIVESC24-001 — JWT newOwnerRole claim forgery hijacks any organisation
The organization ownership transfer endpoint reads the newOwnerRole field from the requesting user's JWT claims rather than from the database. When a transfer request arrives at POST /api/orgs/:id/transfer, the handler checks whether req.user.newOwnerRole === 'owner' as the authorization gate. An attacker who generates a valid JWT (with a legitimately obtained signing key, or via a JWT algorithm confusion vulnerability) and includes newOwnerRole: 'owner' in the claims payload passes this check for any organization ID they supply.
Org ownership is the master permission: the owner can remove all other members, delete the org, transfer billing, modify the org's published skills, rotate API keys, and read the full audit log. Silently acquiring ownership of a competitor's or customer's org via JWT claim forgery means acquiring all of that org's infrastructure, secrets, and customer relationships — with no notification to the legitimate owner and no audit trail that records the compromise.
PRIVESC24-001 fix: Never read authorization-relevant roles from JWT claims. Perform a database-backed ownership verification: query the org_memberships table to confirm that req.session.userId has the owner role for the target org at request time. Implement a two-step transfer flow: the current owner initiates the transfer, the new owner receives an email confirmation token, and the transfer completes only when the new owner clicks the confirmation link. Write an audit log entry for every transfer attempt, successful or not.
// WRONG — authorization from JWT claim; forgeable
if (req.user.newOwnerRole !== 'owner') return res.status(403).json({ error: 'forbidden' });
await db.transferOwnership(req.params.id, req.body.newOwnerId);
// RIGHT — DB-backed check, two-step confirmation, audit log
const membership = await db.getMembership(req.params.id, req.session.userId);
if (!membership || membership.role !== 'owner') return res.status(403).json({ error: 'forbidden' });
const newOwner = await db.getUser(req.body.newOwnerId);
if (!newOwner) return res.status(404).json({ error: 'user not found' });
// step 1: generate confirmation token, email new owner
const token = await tokens.createTransferToken(req.params.id, req.body.newOwnerId, req.session.userId);
await email.send(newOwner.email, 'org-transfer-confirm', { token, orgId: req.params.id });
await audit.log('ownership_transfer_initiated', { orgId: req.params.id, currentOwner: req.session.userId, newOwner: req.body.newOwnerId });
res.json({ status: 'confirmation_sent' });
PRIVESC24-002 — Account deletion missing ownership check
The account deletion endpoint POST /api/users/:id/delete verifies that the requesting user is authenticated but does not verify that req.session.userId === req.params.id. Any authenticated user can delete any other user's account by supplying the target user's ID in the URL. The deletion is permanent and immediate: the user's account, skill portfolio, API keys, and audit history are removed with no recovery window.
Account deletion is an availability attack with identity theft implications. Deleting a prominent skill publisher's account removes their skills from the registry, breaking all installations, and frees their username for registration by an attacker. If the attacker re-registers the same username and re-publishes modified versions of the deleted skills, all downstream consumers who re-install will receive the attacker's version without any warning.
PRIVESC24-002 fix: Add an ownership check: if (req.session.userId !== req.params.id && !req.session.isAdmin) return 403. Implement a 30-day soft-delete with a recovery window — set deletion_scheduled_at = NOW() + 30 days rather than hard-deleting immediately. Rate-limit deletion requests to 1 per account per 90 days. Send confirmation email to the account's registered address before proceeding. Write an audit log entry.
// WRONG — no ownership check; any authenticated user can delete any account
router.post('/users/:id/delete', requireSession, async (req, res) => {
await db.query('DELETE FROM users WHERE id = ?', [req.params.id]);
res.json({ ok: true });
});
// RIGHT — ownership check, soft-delete, rate limit, audit log
router.post('/users/:id/delete', requireSession, async (req, res) => {
if (req.session.userId !== req.params.id && !req.session.isSuperAdmin) {
return res.status(403).json({ error: 'forbidden' });
}
await rateLimit.check(`account_deletion:${req.session.userId}`, { limit: 1, windowDays: 90 });
const deletionAt = new Date(Date.now() + 30 * 24 * 60 * 60 * 1000);
await db.query('UPDATE users SET deletion_scheduled_at=? WHERE id=?', [deletionAt, req.params.id]);
await email.send(req.session.email, 'account-deletion-scheduled', { deletionAt });
await audit.log('account_deletion_scheduled', { userId: req.params.id, scheduledBy: req.session.userId, deletionAt });
res.json({ ok: true, deletionScheduledAt: deletionAt.toISOString() });
});
PRIVESC24-003 — Org deletion missing final admin count check
The org deletion endpoint POST /api/orgs/:id/delete requires the requesting user to have the admin role in the organization. However, it does not verify that the requesting user is the owner, and it does not check whether there are any remaining owners after the requesting user's admin role was obtained. An attacker who is a member with the admin role can demote the last owner via the member management endpoint (which has a separate missing guard), then immediately call the org deletion endpoint. With no owner remaining to object, the deletion proceeds: all org skills, their install records, audit history, billing subscriptions, and API keys are destroyed.
The two-step attack is feasible because demoting the last owner and deleting the org are separate endpoints that are individually authorized but not checked as a compound operation. The window between demotion and deletion is milliseconds in an automated attack.
PRIVESC24-003 fix: Change the authorization check from requireRole('admin') to requireRole('owner'). Add a minimum-owner-count check: before proceeding, verify that there is at least one owner with SELECT COUNT(*) FROM org_memberships WHERE org_id=$1 AND role='owner' and reject if the requesting user is the only remaining owner. Implement a 30-day soft-delete for org deletion. Send webhook notifications to all skill consumers before the org's skills become unavailable. Write an audit log entry.
PRIVESC24-004 — GDPR export missing ownership check exposes any user's data
The GDPR data export endpoint POST /api/users/:id/export/gdpr verifies that the requesting user is authenticated but does not verify that req.session.userId === req.params.id. Any authenticated user can export any other user's full GDPR data package by supplying the target user's ID in the URL. The GDPR package contains everything the registry holds about a user: registered email address, full audit log of all actions (skill publications, API key uses, billing changes), payment method summaries, all active API keys with their scopes, and account metadata.
This is a comprehensive privacy violation: an attacker who enumerates user IDs can download the complete account history and credentials inventory for every user in the registry. The payment method summaries may include partial card numbers and billing addresses. The API key listing exposes the name and scope of every integration a user has set up, enabling targeted credential theft attacks against those integrations.
PRIVESC24-004 fix: Add an ownership check: if (req.session.userId !== req.params.id) return 403. Rate-limit to 1 GDPR export per user per month. Write an audit log entry for every export request, including the requesting IP address and user agent. Never include raw API key values in the export package — include only key ID, name, scope, and creation date.
// WRONG — no ownership check; any user exports any user's GDPR data
router.post('/users/:id/export/gdpr', requireSession, async (req, res) => {
const data = await gdpr.buildExportPackage(req.params.id);
res.json(data); // includes email, audit log, payment methods, API keys
});
// RIGHT — ownership check, rate limit, audit log, redacted keys
router.post('/users/:id/export/gdpr', requireSession, async (req, res) => {
if (req.session.userId !== req.params.id) {
return res.status(403).json({ error: 'forbidden' });
}
await rateLimit.check(`gdpr_export:${req.session.userId}`, { limit: 1, windowDays: 30 });
await audit.log('gdpr_export_requested', {
userId: req.params.id,
requestedBy: req.session.userId,
ip: req.ip,
userAgent: req.headers['user-agent']
});
const data = await gdpr.buildExportPackage(req.params.id, { redactApiKeyValues: true });
res.json(data);
});
SkillAudit scans for JWT-claim-based authorization on ownership transfer endpoints, missing IDOR ownership checks on account lifecycle endpoints, and absent minimum-owner-count guards on org deletion across your MCP skill registry codebase.
Scan your registry| Finding | Severity | Endpoint | Impact |
|---|---|---|---|
| PRIVESC24-001 | CRITICAL | POST /api/orgs/:id/transfer | JWT claim forgery silently hijacks ownership of any org; no notification to legitimate owner |
| PRIVESC24-002 | CRITICAL | POST /api/users/:id/delete | Any authenticated user permanently deletes any account; enables username hijacking for skill supply-chain attack |
| PRIVESC24-003 | HIGH | POST /api/orgs/:id/delete | Admin member destroys entire org after demoting last owner; all skills, audit history, and billing records lost |
| PRIVESC24-004 | HIGH | POST /api/users/:id/export/gdpr | Any authenticated user exports full GDPR data package for any user; email, audit log, payment methods, API keys |
See also: SA-SKL-PRIVESC23 (admin dashboard system configuration privilege escalation) and SA-SKL-PRIVESC22 (billing and subscription privilege escalation) for the full privilege escalation attack surface across the MCP skill registry account lifecycle.