Claude MCP skill CORS misconfiguration — team invitation and member onboarding endpoints
SA-SKL-CORS35 documents four CORS vulnerabilities in MCP skill registry team invitation and member onboarding endpoints. A missing CORS restriction combined with simple-request-compatible form encoding lets an attacker page send team invitations from the victim's account, granting themselves membership billed as a new paid seat; credential-bearing CORS on the pending invitation list exposes invitee email addresses and raw invitation tokens; wildcard ACAO on the invitation accept endpoint lets any page consume a known token without credentials; and credential-bearing CORS on the member profile endpoint leaks email, role, last-seen timestamp, and audit history permissions for every team member.
application/x-www-form-urlencoded with no CORS restriction; simple-request form POST sends team invitation from victim session to attacker email without triggering a preflight; attacker gains team membership billed as new seat
cors({origin:true,credentials:true}); any origin reads all pending invitations including invitee email addresses and raw invitation tokens using victim admin session
ACAO:*; any origin accepts any invitation token without credentials; attacker who learns any token can join the target org from any attacker-controlled page
cors({origin:true,credentials:true}); any origin reads member profile including email, role, last-seen timestamp, and granular audit history access permissions using victim session
CORS35-001 (Critical): Simple-request invite hijack sends team invitation via form POST from victim session
MCP skill registry team invitation endpoints frequently accept application/x-www-form-urlencoded or text/plain content types to support simple HTML form submissions. The same-origin policy's "simple request" carve-out means that cross-origin POST requests using these content types do not trigger a preflight OPTIONS check. When the invitation endpoint processes the POST body and sends an invitation email using the authenticated session's team context — without requiring a JSON content type or CSRF token — an attacker page can send a team invitation from the victim's account to any email address without any user interaction beyond visiting the page.
The practical impact of this attack is that the attacker receives a valid team invitation email delivered to their own address, originating from the victim's organization. Accepting this invitation grants the attacker team membership in the victim's MCP skill registry organization. Depending on the billing model, this may create a new paid seat charged to the victim's account. Even if the attacker does not accept the invitation, the attack creates a pending invitation that may cause confusion, trigger billing alerts, or reveal that the team uses a specific registry provider. CVSS 8.1 (AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N).
// VULNERABLE — invitation endpoint accepts form-encoded body; no preflight triggered
// File: routes/teams.js
const router = require('express').Router();
// VULNERABILITY: accepts application/x-www-form-urlencoded — simple request type
// No CSRF token check; no JSON content type requirement
// Cross-origin form POST sends invitation from victim session without preflight
router.post('/teams/:id/invite', authenticate, async (req, res) => {
const teamId = req.params.id;
const { email, role } = req.body; // body-parser urlencoded reads form fields
const inviterId = req.user.sub;
// Check inviter has team membership (but doesn't stop cross-origin form POST)
const { rows: team } = await db.query(
'SELECT id FROM teams WHERE id = $1 AND owner_id = $2',
[teamId, inviterId]
);
if (!team.length) return res.status(403).json({ error: 'Forbidden' });
const token = crypto.randomBytes(32).toString('hex');
await db.query(
'INSERT INTO invitations (team_id, email, role, token) VALUES ($1, $2, $3, $4)',
[teamId, email, role || 'member', token]
);
await sendInvitationEmail({ to: email, teamId, token });
res.json({ invited: true });
});
Fix: Require Content-Type: application/json for the invitation endpoint. This makes the request non-simple and forces a preflight OPTIONS check that the same-origin policy will block from cross-origin pages not explicitly allowed. Add a CSRF token check as defense-in-depth. Add an explicit CORS allowlist so that the preflight can succeed only from your own domain. Never accept application/x-www-form-urlencoded or text/plain for state-modifying endpoints that use cookie-based authentication.
// FIXED — JSON required (triggers preflight); CSRF token; explicit CORS allowlist
// File: routes/teams.js
const cors = require('cors');
const teamInviteCors = cors({
origin: ['https://skillaudit.dev'],
credentials: true,
methods: ['POST'],
});
router.options('/teams/:id/invite', teamInviteCors); // handle preflight
router.post('/teams/:id/invite',
teamInviteCors,
authenticate,
requireRole('admin'),
validateCsrfToken, // CSRF token from X-CSRF-Token header
requireJsonContentType, // reject non-JSON content type
async (req, res) => {
const teamId = req.params.id;
const { email, role } = req.body;
const inviterId = req.user.sub;
// Verify inviter owns this team
const { rows: team } = await db.query(
'SELECT id FROM teams WHERE id = $1 AND owner_id = $2',
[teamId, inviterId]
);
if (!team.length) return res.status(403).json({ error: 'Forbidden' });
const token = crypto.randomBytes(32).toString('hex');
await db.query(
'INSERT INTO invitations (team_id, email, role, token) VALUES ($1, $2, $3, $4)',
[teamId, email, role || 'member', token]
);
await sendInvitationEmail({ to: email, teamId, token });
res.json({ invited: true });
}
);
CORS35-002 (Critical): Credential-bearing CORS on pending invitation list exposes raw invitation tokens
The pending invitation list endpoint GET /api/teams/:id/invitations allows team administrators to review and revoke pending invitations. When this endpoint is configured with cors({origin:true,credentials:true}), any origin can issue a credentialed cross-origin GET using the victim's admin session and read the complete list of pending invitations. The critical exposure here goes beyond email addresses: invitation records typically include the raw invitation token used in the acceptance URL.
An attacker who reads raw invitation tokens for pending invitations can synthesize the acceptance URL (https://registry.example/invitations/{token}/accept) and distribute it to collaborators, allowing them to join the target organization before the legitimate invitee acts. If the registry allows multiple acceptances of the same token before expiry, the attacker can add multiple unauthorized members using a single stolen token. Combined with CORS35-003 (which allows accepting any token from any page), this creates a two-step cross-origin org takeover: read tokens, then immediately accept them. CVSS 9.1 (AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N).
// VULNERABLE — invitation list endpoint uses cors({origin:true,credentials:true})
// File: routes/teams.js
// VULNERABILITY: origin:true reflects any Origin with credentials — token theft
router.get('/teams/:id/invitations',
cors({ origin: true, credentials: true }),
authenticate,
async (req, res) => {
const teamId = req.params.id;
const userId = req.user.sub;
// Note: missing admin role check — any team member reads all invitations
const { rows } = await db.query(
`SELECT id, email, role, token, created_at, expires_at
FROM invitations
WHERE team_id = $1
AND accepted = false
AND expires_at > NOW()`,
[teamId]
);
// token field is the raw invitation token — full acceptance URL derivable by attacker
res.json({ invitations: rows });
}
);
Fix: Replace cors({origin:true,credentials:true}) with an explicit allowlist. Add a requireRole('admin') middleware — only team admins and owners should view pending invitations. Never return raw invitation tokens in the list response: return only a masked identifier (e.g., first 8 characters + "...") sufficient for display but not for synthesizing an acceptance URL. If revocation requires the token, expose it only on a separate single-invitation GET endpoint with rate limiting and audit logging.
// FIXED — explicit CORS allowlist; admin role required; tokens masked in list response
// File: routes/teams.js
const teamCors = cors({ origin: ['https://skillaudit.dev'], credentials: true });
function maskToken(token) {
// Show first 8 chars — enough to identify in audit log, not enough to use
return token.slice(0, 8) + '...';
}
router.get('/teams/:id/invitations',
teamCors,
authenticate,
requireRole('admin'), // only team admins may view invitation list
async (req, res) => {
const teamId = req.params.id;
const userId = req.user.sub;
// Verify admin is a member of this team
const { rows: member } = await db.query(
`SELECT role FROM team_members
WHERE team_id = $1 AND user_id = $2 AND role IN ('admin','owner')`,
[teamId, userId]
);
if (!member.length) return res.status(403).json({ error: 'Forbidden' });
const { rows } = await db.query(
`SELECT id, email, role, token, created_at, expires_at
FROM invitations
WHERE team_id = $1
AND accepted = false
AND expires_at > NOW()`,
[teamId]
);
// Mask raw tokens — never return full token in list response
const sanitized = rows.map(inv => ({ ...inv, token: maskToken(inv.token) }));
res.json({ invitations: sanitized });
}
);
CORS35-003 (High): Wildcard ACAO on invitation accept endpoint allows any page to consume tokens
The invitation acceptance endpoint POST /api/invitations/:token/accept completes the team onboarding process by marking the invitation as used, creating a team membership record, and logging the new member into the organization. When this endpoint responds with Access-Control-Allow-Origin: *, any page on the web can submit an acceptance request. The design intent is that the invitation token serves as the credential — the user clicks a link in their email, navigates to the acceptance URL, and the token in the URL path authenticates the action.
The ACAO:* misconfiguration means that an attacker who obtains an invitation token (via CORS35-002, via email interception, or by receiving a forwarded invitation link) can accept it programmatically from a malicious page without navigating to the registry. More critically, if the token is accessible via other CORS-vulnerable endpoints, the attacker can read the token and immediately accept it in the same page load — joining the organization with the role specified in the invitation record. The attack requires no victim session interaction at the acceptance step: the token is the sole credential. CVSS 7.3 (AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N).
// VULNERABLE — invitation accept endpoint serves ACAO:* allowing cross-origin acceptance
// File: routes/invitations.js
const express = require('express');
const router = express.Router();
// VULNERABILITY: wildcard ACAO on accept endpoint
// Token is the only credential; any origin can accept any token without user session
router.post('/invitations/:token/accept',
(req, res, next) => {
res.setHeader('Access-Control-Allow-Origin', '*');
next();
},
async (req, res) => {
const { token } = req.params;
const { acceptingUserId } = req.body; // user ID provided by client — no session auth
const { rows } = await db.query(
`SELECT id, team_id, email, role
FROM invitations
WHERE token = $1
AND accepted = false
AND expires_at > NOW()`,
[token]
);
if (!rows.length) return res.status(404).json({ error: 'Invitation not found or expired' });
const inv = rows[0];
await db.query('UPDATE invitations SET accepted = true WHERE id = $1', [inv.id]);
await db.query(
'INSERT INTO team_members (team_id, user_id, role) VALUES ($1, $2, $3)',
[inv.team_id, acceptingUserId, inv.role]
);
res.json({ joined: true, teamId: inv.team_id, role: inv.role });
}
);
Fix: Remove the wildcard ACAO header from the invitation accept endpoint. Apply an explicit CORS allowlist so that only your own domain's pages can process acceptance. Require an authenticated session at the acceptance step — the token verifies the invitation, but the session identifies which user is joining; this prevents token replay by third parties. Mark tokens as single-use atomically in the database using a WHERE accepted = false condition in the UPDATE to prevent concurrent acceptance race conditions. Store accepted-at timestamp and accepting-user-id for audit logging.
// FIXED — no wildcard ACAO; session required at acceptance; atomic single-use
// File: routes/invitations.js
const cors = require('cors');
const invitationCors = cors({
origin: ['https://skillaudit.dev'],
credentials: true,
});
router.options('/invitations/:token/accept', invitationCors);
router.post('/invitations/:token/accept',
invitationCors,
authenticate, // session required — confirms who is accepting
async (req, res) => {
const { token } = req.params;
const acceptingUserId = req.user.sub; // from verified session, not client body
// Atomic accept — WHERE accepted = false prevents concurrent double-acceptance
const { rows } = await db.query(
`UPDATE invitations
SET accepted = true,
accepted_at = NOW(),
accepted_by = $2
WHERE token = $1
AND accepted = false
AND expires_at > NOW()
RETURNING id, team_id, email, role`,
[token, acceptingUserId]
);
if (!rows.length) return res.status(404).json({ error: 'Invitation not found, expired, or already used' });
const inv = rows[0];
// Optionally verify the authenticated user's email matches the invitation
if (req.user.email && req.user.email.toLowerCase() !== inv.email.toLowerCase()) {
return res.status(403).json({ error: 'This invitation was sent to a different email address' });
}
await db.query(
'INSERT INTO team_members (team_id, user_id, role) VALUES ($1, $2, $3) ON CONFLICT DO NOTHING',
[inv.team_id, acceptingUserId, inv.role]
);
res.json({ joined: true, teamId: inv.team_id, role: inv.role });
}
);
CORS35-004 (High): Credential-bearing CORS on member profile exposes audit history permissions
The team member profile endpoint GET /api/teams/:id/members/:userId returns detailed information about an individual team member: their email address, display name, role in the team, the timestamp of their last activity in the registry, their account creation date, and — critically for MCP skill registries — their granular audit history access permissions. These permissions specify which scan results, vulnerability findings, and historical audit reports the member can view, which may differ from their nominal team role.
When this endpoint is configured with cors({origin:true,credentials:true}), any attacker page can issue a credentialed cross-origin GET using the victim's session and read this profile data for any team member. The last-seen timestamp reveals which team members are active targets for phishing (recently active members are more likely to be deceived by timely-looking security alerts). The audit history permissions map reveals which members have access to sensitive vulnerability data — useful for targeting follow-on CORS attacks against those members' sessions. If the endpoint is missing a team-membership check on the requesting user, it also acts as a cross-team user enumeration oracle. CVSS 7.1 (AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N).
// VULNERABLE — member profile endpoint uses cors({origin:true,credentials:true})
// File: routes/teams.js
// VULNERABILITY: origin:true + credentials:true exposes detailed member profiles
router.get('/teams/:teamId/members/:userId',
cors({ origin: true, credentials: true }),
authenticate,
async (req, res) => {
const { teamId, userId } = req.params;
// Note: missing check that requesting user is a member of teamId
const { rows } = await db.query(
`SELECT u.id, u.email, u.display_name, u.created_at,
tm.role, tm.last_seen_at,
tmp.audit_history_access, tmp.can_export_reports, tmp.can_view_private_scans
FROM users u
JOIN team_members tm ON tm.user_id = u.id AND tm.team_id = $1
LEFT JOIN team_member_permissions tmp ON tmp.user_id = u.id AND tmp.team_id = $1
WHERE u.id = $2`,
[teamId, userId]
);
if (!rows.length) return res.status(404).json({ error: 'Member not found' });
res.json({ member: rows[0] });
}
);
Fix: Replace cors({origin:true,credentials:true}) with an explicit allowlist. Add a check that the requesting user is a member of teamId before returning any profile data — this prevents cross-team member enumeration. Restrict granular permission fields (audit_history_access, can_view_private_scans) to admin and owner roles only; ordinary members should see only their own permissions, not those of other members. Consider whether last_seen_at should be exposed in member profiles at all, or only in admin-facing activity logs.
// FIXED — explicit CORS allowlist; team membership required; permission fields restricted
// File: routes/teams.js
const teamCors = cors({ origin: ['https://skillaudit.dev'], credentials: true });
router.get('/teams/:teamId/members/:userId',
teamCors,
authenticate,
async (req, res) => {
const { teamId, userId } = req.params;
const requestingUserId = req.user.sub;
// Verify requesting user is a member of this team
const { rows: requester } = await db.query(
`SELECT role FROM team_members
WHERE team_id = $1 AND user_id = $2`,
[teamId, requestingUserId]
);
if (!requester.length) return res.status(403).json({ error: 'Forbidden' });
const isAdmin = ['admin', 'owner'].includes(requester[0].role);
const { rows } = await db.query(
`SELECT u.id, u.display_name,
tm.role, tm.last_seen_at,
tmp.audit_history_access, tmp.can_export_reports, tmp.can_view_private_scans,
CASE WHEN $3 OR u.id = $4 THEN u.email ELSE NULL END AS email
FROM users u
JOIN team_members tm ON tm.user_id = u.id AND tm.team_id = $1
LEFT JOIN team_member_permissions tmp ON tmp.user_id = u.id AND tmp.team_id = $1
WHERE u.id = $2`,
[teamId, userId, isAdmin, requestingUserId]
);
if (!rows.length) return res.status(404).json({ error: 'Member not found' });
const member = rows[0];
// Strip granular permission fields for non-admin viewers (unless own profile)
if (!isAdmin && userId !== requestingUserId) {
delete member.audit_history_access;
delete member.can_export_reports;
delete member.can_view_private_scans;
delete member.last_seen_at;
}
res.json({ member });
}
);
Compound attack chain: team enumeration to unauthorized org membership
The four CORS35 vulnerabilities combine into a cross-origin org membership attack that requires a single page visit from a team admin or owner.
Phase 1 — Invitation enumeration (CORS35-002). The attacker's malicious page issues a credentialed GET to /api/teams/:id/invitations using the victim admin's session. The cors({origin:true,credentials:true}) configuration delivers the full pending invitation list including (in the vulnerable form) raw invitation tokens.
Phase 2 — Token acceptance (CORS35-003). With raw invitation tokens in hand, the attacker page immediately issues POST requests to /api/invitations/:token/accept. The wildcard ACAO header allows this cross-origin request to succeed. The attacker gains team membership using the role specified in the stolen invitation — potentially admin-level access if the original invitation was for an admin onboarding flow.
Phase 3 — Member intelligence (CORS35-004). As a newly minted team member, the attacker uses CORS35-004 to read profiles of other members, mapping their email addresses, roles, and permission levels. This information targets future phishing campaigns against high-permission members.
Phase 4 — Invite escalation (CORS35-001). With admin membership established, the attacker uses CORS35-001 to send new invitations to additional attacker-controlled accounts, expanding access without further victim interaction.
Chain severity: This chain achieves persistent team membership by an unauthorized attacker, billed as a legitimate seat on the victim's subscription. The membership survives password rotation unless the team admin explicitly reviews and removes all members. CORS35-001 and CORS35-003 together create a self-replicating access pattern: each compromised admin session can add new attacker members.
Detection with tree-sitter queries
The highest-value patterns are the cors({origin:true,credentials:true}) misconfiguration on invitation and member endpoints (CORS35-002, CORS35-004), the wildcard ACAO on write endpoints (CORS35-003), and the absence of a JSON content-type requirement on state-modifying endpoints (CORS35-001).
Query 1 — Invitation or member routes accepting form-encoded bodies. Matches router.post handlers on paths matching invite or member that use express.urlencoded() or bodyParser.urlencoded() as middleware — the structural pattern of CORS35-001.
; tree-sitter query: invite/member POST endpoints accepting urlencoded body (CORS35-001)
(call_expression
function: (member_expression
object: (identifier) @router
property: (property_identifier) @verb (#eq? @verb "post")
)
arguments: (arguments
(string) @path (#match? @path "(invite|member|onboard)")
(call_expression
function: (member_expression
property: (property_identifier) @parser (#match? @parser "urlencoded")
)
)
)
) @simple-request-risk
; Each @simple-request-risk: invite/member POST accepting form encoding.
; Fix: replace with express.json(); add Content-Type check middleware.
Query 2 — CORS origin:true on invitation or member endpoints. Matches cors({origin:true}) applied to route handlers whose path strings contain invitation, member, or team — the CORS35-002 and CORS35-004 patterns.
; tree-sitter query: cors({origin:true}) on invitation/member routes (CORS35-002, CORS35-004)
(call_expression
function: (member_expression
property: (property_identifier) @verb (#match? @verb "^(get|post|put|patch|delete)$")
)
arguments: (arguments
(string) @path (#match? @path "(invitation|member|team)")
(call_expression
function: (identifier) @fn (#eq? @fn "cors")
arguments: (arguments
(object
(pair
key: (property_identifier) @key (#eq? @key "origin")
value: (true)
)
)
)
)
)
) @cred-cors-on-team-route
; Each @cred-cors-on-team-route: credential-bearing CORS on team-related endpoint.
; Fix: explicit origin allowlist.
Query 3 — Wildcard ACAO set via setHeader on invitation accept route. Matches router.post handlers on paths containing accept or join where middleware calls setHeader('Access-Control-Allow-Origin', '*') — the CORS35-003 pattern.
; tree-sitter query: ACAO:* on invitation accept endpoints (CORS35-003)
(call_expression
function: (member_expression
property: (property_identifier) @verb (#eq? @verb "post")
)
arguments: (arguments
(string) @path (#match? @path "(accept|join)")
(arrow_function
body: (statement_block
(expression_statement
(call_expression
function: (member_expression
property: (property_identifier) @method (#eq? @method "setHeader")
)
arguments: (arguments
(string) @hdr (#match? @hdr "Access-Control-Allow-Origin")
(string) @val (#eq? @val "*")
)
)
)
)
)
)
) @wildcard-accept-cors
; Each @wildcard-accept-cors: wildcard ACAO on invitation acceptance endpoint.
; Fix: explicit allowlist; require authenticated session at acceptance step.
Summary
| ID | Severity | Surface | Root cause | Fix |
|---|---|---|---|---|
| CORS35-001 | Critical | POST /api/teams/:id/invite | Form-encoded content type enables simple-request cross-origin POST; invitation sent from victim session without preflight | Require JSON content type; CSRF token; explicit CORS allowlist; requireRole('admin') |
| CORS35-002 | Critical | GET /api/teams/:id/invitations | cors({origin:true,credentials:true}) exposes raw invitation tokens; missing admin role check |
Explicit origin allowlist; requireRole('admin'); mask tokens in list response |
| CORS35-003 | High | POST /api/invitations/:token/accept | ACAO:* allows cross-origin token acceptance; no session authentication at acceptance step |
Remove wildcard ACAO; require authenticated session; atomic single-use token; email-match validation |
| CORS35-004 | High | GET /api/teams/:id/members/:userId | cors({origin:true,credentials:true}) exposes email, role, last-seen, and audit history permissions; missing team-membership check |
Explicit origin allowlist; verify requesting user is team member; restrict permissions to admin role or own profile |
Checklist for MCP skill registry operators: (1) Audit all invitation and onboarding endpoints — flag any that accept application/x-www-form-urlencoded or text/plain without a CSRF token. (2) Verify all cors({ usages on /invite, /invitations, and /members routes — replace any origin:true with explicit allowlists. (3) Confirm invitation accept endpoints require an authenticated session at the point of acceptance, not just a token. (4) Check that raw invitation tokens are never returned in bulk list responses. (5) Verify pending invitation list endpoints require admin or owner role. (6) Confirm member profile endpoints check that the requesting user is a member of the target team before returning data. (7) Run the three tree-sitter queries above in CI to prevent regressions. See also: SA-SKL-CORS34 for CORS patterns on webhook configuration endpoints.
Related advisories: SA-SKL-PRIVESC18 — privilege escalation via admin console; SA-SKL-CORS34 — CORS on webhook configuration; SA-SKL-PRIVESC17 — billing privilege escalation including unauthorized seat additions.
Scan your MCP skills for CORS35 and 2400+ other patterns
SkillAudit continuously audits MCP server and Claude skill codebases for CORS misconfigurations, injection vulnerabilities, deserialization flaws, SSRF, and privilege escalation. Get findings in minutes.
Get started at skillaudit.dev