CORS Misconfigurations in MCP Skill Registry Team Invitation and Member Onboarding Endpoints
Team invitation endpoints occupy a uniquely dangerous position in the MCP skill registry attack surface: they are the mechanism by which new members join an organization, and compromise of these endpoints lets an attacker join any team, read who is already on it, and suppress legitimate invitations — all without ever being sent an invitation to the attacker’s own account. The SA-SKL-CORS35 vulnerability class arises when invitation and onboarding endpoints are configured with permissive CORS to support multi-origin dashboards, leaving the full membership lifecycle exposed to any cross-origin page that can reach the victim while they are logged in.
In this post
- Why team invitation endpoints are a high-value CORS target
- CORS35-001 — Simple-request form-POST sends team invitation from victim session without preflight
- CORS35-002 — Credential-bearing CORS on pending invitations list leaks invitee emails and raw tokens
- CORS35-003 — Wildcard ACAO on invitation accept lets any page consume any known token
- CORS35-004 — Credential-bearing CORS on member profile exposes audit history permissions
- Compound attack chain: token read → immediate accept → member intel → invite flood
- Detection with tree-sitter AST queries
- Operator checklist: 10 controls for CORS-safe invitation and onboarding endpoints
POST /api/teams/:id/invite accepts 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 a new paid seatGET /api/teams/:id/invitations uses cors({origin:true,credentials:true}); any origin reads all pending invitations including invitee email addresses and raw single-use invitation tokens using the victim admin’s session cookiePOST /api/invitations/:token/accept has ACAO: *; any attacker page that obtains an invitation token (via CORS35-002 or any other channel) can immediately accept it without credentials, joining the target organization without any invitation sent to the attacker’s own accountGET /api/teams/:id/members/:userId uses cors({origin:true,credentials:true}); any origin reads member profiles including email address, role, last-seen timestamp, and granular audit history access permissions using the victim’s session cookieWhy team invitation endpoints are a high-value CORS target
When developers think about sensitive membership APIs, the focus typically lands on role-assignment endpoints — the calls that escalate an existing member from viewer to admin. Invitation endpoints are frequently overlooked in threat models because they are perceived as low-consequence: “the worst an attacker can do is invite themselves, and we can revoke that.” That framing misses the actual threat model in three important ways.
First, in a subscription-based registry like SkillAudit, adding a seat is a billing event. A team invitation that succeeds creates a new paid seat on the victim organization’s plan. At the Team tier ($99/month for 10 seats), adding a fraudulent seat means the victim org is immediately charged for a member they did not intend to add. At enterprise pricing, this impact scales significantly. Second, an attacker who becomes a team member gains legitimate access to all organization-level data: shared audit reports, scheduled scan configurations, webhook destinations, and API keys — the precise data targeted by CORS29, CORS33, and CORS34. The invitation vulnerability is not an end in itself; it is the credential acquisition step for a broader attack. Third, an attacker on the inside can suppress legitimate security findings by manipulating scan schedules, dismissing alerts, and rotating API keys to revoke legitimate team members’ access.
The CORS vulnerability pattern on invitation endpoints arises from the same root cause as CORS33 and CORS34: a team deployed CORS permissively to serve multiple internal dashboards and partner integration pages, chose cors({origin:true}) rather than maintaining an explicit allowlist, and never replaced it. The unique danger in CORS35 is that invitation endpoints accept mutations (sending invitations, accepting tokens) rather than just reads, amplifying the impact beyond information disclosure into unauthorized access and billing fraud.
CORS35-001 — Simple-request form-POST sends team invitation from victim session without preflight
The team invite endpoint POST /api/teams/:id/invite sends an email invitation to a new user and creates a pending invitation record. The endpoint was built to support both the main registry dashboard and an embedded partner portal where enterprise customers onboard team members. The original implementation used JSON request bodies. After an integration request from a partner who preferred form-encoded payloads, a developer added support for application/x-www-form-urlencoded without reconsidering the CORS implications.
The critical difference is that application/x-www-form-urlencoded is one of the three content types that make a cross-origin request a “simple request” in the CORS specification. Simple requests bypass the CORS preflight mechanism entirely — the browser sends them without first asking the server via an OPTIONS request whether the cross-origin call is permitted. The only browser control applied to simple requests is whether the response is accessible to the calling script, which is determined by the Access-Control-Allow-Origin response header. But crucially, the request is sent regardless. If the endpoint performs a state-changing action on receipt of the request — like sending an invitation email and creating a pending membership record — the damage is done before the browser has a chance to evaluate any CORS header.
An attacker who hosts a page on any domain the victim visits can embed a form with action="https://registry.example.com/api/teams/TARGET_ORG_ID/invite", method="POST", and hidden fields for email=attacker@example.com&role=member. When the victim visits the attacker’s page while logged into the registry (session cookie present), a single JavaScript call to form.submit() sends the invitation using the victim’s session credentials. The browser will not read the response (the CORS check blocks the read, not the send), but the invitation has been sent and the new membership seat created on the victim org’s billing plan.
// CORS35-001 — VULNERABLE
// Endpoint accepts application/x-www-form-urlencoded — a simple-request content type.
// No CORS restriction means no preflight — any origin sends the invite via victim's session.
// teams/router.js
const express = require('express');
router.use(express.urlencoded({ extended: false })); // allows form-encoded bodies — triggers simple-request
router.post(
'/:id/invite',
requireSession, // session check: but the request already executed its side-effect
async (req, res) => {
const { email, role } = req.body; // body comes from form submission, no preflight
await db.invitations.create({
teamId: req.params.id,
email,
role: role || 'member',
token: crypto.randomBytes(32).toString('hex'),
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), // 7 days
});
await mailer.sendInvitation({ to: email, teamId: req.params.id });
// Response body is blocked by CORS — attacker cannot read it
// But the invitation email has already been sent and the DB record created
res.status(201).json({ invited: email });
}
);
// Attacker page (any origin):
// <form id="inv" method="POST"
// action="https://registry.example.com/api/teams/VICTIM_ORG_ID/invite">
// <input name="email" value="attacker@evil.com">
// <input name="role" value="member">
// </form>
// <script>document.getElementById('inv').submit();</script>
// — invitation sent using victim's session cookie, no preflight required
Why CSRF tokens don’t fix this alone: Adding a CSRF token to the invite form is necessary but insufficient if the CSRF token is readable cross-origin. If the registry exposes any endpoint with cors({origin:true,credentials:true}) that returns session metadata (including CSRF tokens), the attacker can read a fresh CSRF token before submitting the invite form. CORS35-002 (the pending invitations endpoint) is exactly such a leak point. A complete fix requires both changing the content type to JSON (which triggers a preflight that the server can then control via CORS) and replacing origin:true with an explicit allowlist across all credentialed endpoints.
// CORS35-001 — FIXED
// 1. Remove urlencoded body parser from the invite router (JSON only — triggers preflight).
// 2. Apply explicit allowlist-based CORS to the entire teams router.
// 3. Add requireRole('admin') — only admins can invite team members.
// 4. Add CSRF token verification to block same-site cross-origin attacks.
// config/cors.js
const ALLOWED_ORIGINS = new Set([
'https://app.skillaudit.dev',
'https://skillaudit.dev',
'https://partner.example.com',
]);
const teamsCorsOptions = {
origin: (origin, callback) => {
if (!origin || ALLOWED_ORIGINS.has(origin)) return callback(null, true);
callback(Object.assign(new Error('CORS: origin not allowed'), { status: 403 }));
},
credentials: true,
methods: ['GET', 'POST', 'PATCH', 'DELETE', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization', 'X-CSRF-Token'],
};
module.exports = { teamsCorsOptions };
// teams/router.js — JSON only, no urlencoded parser
const { teamsCorsOptions } = require('../config/cors');
router.use(cors(teamsCorsOptions)); // allowlist-based CORS at router level
router.use(express.json()); // JSON only — always triggers preflight
router.post('/:id/invite',
requireSession,
requireRole('admin'), // only admins can send invitations
verifyCsrfToken, // validates X-CSRF-Token header against session-bound token
async (req, res) => {
const { email, role } = req.body;
// Verify requesting user is a member of the target team
const membership = await db.teamMembers.findByUserAndTeam(req.session.userId, req.params.id);
if (!membership) return res.status(403).json({ error: 'Not a member of this team' });
await db.invitations.create({
teamId: req.params.id,
email,
role: ['viewer', 'member'].includes(role) ? role : 'member', // allowlist roles
token: crypto.randomBytes(32).toString('hex'),
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),
});
await mailer.sendInvitation({ to: email, teamId: req.params.id });
res.status(201).json({ invited: email });
}
);
CVSS 3.1 approximate score for CORS35-001: 9.3 (CRITICAL) — AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:H/A:N. Integrity is High because the attacker gains unauthorized access to the organization, adding a rogue member with read access to all shared resources. Scope is Changed because the attack extends beyond the web application into the billing system, creating fraudulent charges on the victim’s subscription.
CORS35-002 — Credential-bearing CORS on pending invitations list leaks invitee emails and raw tokens
The pending invitations endpoint GET /api/teams/:id/invitations returns the list of outstanding invitations for a team: the invitee email address, the invitation role, the expiry timestamp, and — critically — the raw single-use invitation token that serves as the credential for accepting the invitation. The endpoint was added to allow admins to view and cancel pending invitations from the dashboard. When the same team management API was embedded in a CI/CD partner’s web portal at a different origin, the developer applied cors({origin:true,credentials:true}) to the entire teams router rather than adding just the CI partner’s domain to the allowlist.
With origin:true, the Express cors middleware reflects the incoming Origin header value back as the Access-Control-Allow-Origin response header, combined with Access-Control-Allow-Credentials: true. Any attacker page that the victim admin visits while logged into the registry can execute a credentialed cross-origin fetch to the pending invitations endpoint, receive the full invitation list including the raw token values, and immediately use those tokens to accept outstanding invitations — joining the team as one of the invited users whose invitation was stolen rather than creating a new invitation footprint visible in the admin console.
The token theft variant is especially problematic because it leaves no audit trail of attacker activity. The admin who sent the invitation sees it accepted, attributes it to the legitimate invitee, and does not investigate further. The attacker, now a team member under a different identity, has clean access to all shared resources.
// CORS35-002 — VULNERABLE
// cors({origin:true,credentials:true}) on the pending invitations list — any origin
// reads all invitee emails and raw single-use invitation tokens via victim admin session.
// teams/router.js
router.get(
'/:id/invitations',
cors({ origin: true, credentials: true }), // VULNERABLE: reflects any Origin with credentials
requireSession,
async (req, res) => {
const invitations = await db.invitations.findByTeamId(req.params.id, {
status: 'pending',
});
res.json(invitations.map(inv => ({
id: inv.id,
email: inv.email, // ← invitee email address
role: inv.role,
token: inv.token, // ← raw single-use acceptance token — NEVER return this
expiresAt: inv.expiresAt,
invitedBy: inv.invitedByUserId,
})));
}
);
// Attacker page (any origin, victim admin session present):
// fetch('https://registry.example.com/api/teams/TARGET_ID/invitations', {
// credentials: 'include'
// })
// .then(r => r.json())
// .then(invs => {
// // invs[0].token is the raw acceptance credential
// // attacker accepts it immediately via CORS35-003:
// return fetch(`/api/invitations/${invs[0].token}/accept`, { method: 'POST' });
// });
Why invitation tokens must never be returned in list responses: Single-use invitation tokens are equivalent to passwords for the specific action of joining an organization. Returning them in a list response — even a response intended only for admins — violates the same principle as returning password hashes in a user list: the value should only ever appear in transit to the specific recipient (via the invitation email) and should never be retrievable after issuance. The correct data model is to store tokens as a one-way HMAC or hash and verify by comparison, never returning the original value via any API endpoint. The admin console only needs to know that an invitation is pending and when it expires; it does not need the token value itself.
// CORS35-002 — FIXED
// 1. Never return the raw invitation token in any API response.
// 2. Replace origin:true with explicit Set-based allowlist (applied at router level).
// 3. Add requireRole('admin') — only admins manage invitations.
// 4. Store tokens as SHA-256 hash in DB; original token only exists in the email link.
// teams/router.js — CORS applied at router level (see CORS35-001 fix)
router.get('/:id/invitations', requireSession, requireRole('admin'), async (req, res) => {
const membership = await db.teamMembers.findByUserAndTeam(req.session.userId, req.params.id);
if (!membership) return res.status(403).json({ error: 'Not a member of this team' });
const invitations = await db.invitations.findByTeamId(req.params.id, { status: 'pending' });
// Return only metadata — NEVER return the token value
res.json(invitations.map(inv => ({
id: inv.id,
email: maskEmail(inv.email), // mask email for non-owner admins: a***@example.com
role: inv.role,
// token: OMITTED — hash stored in DB, original value only exists in email
expiresAt: inv.expiresAt,
invitedBy: inv.invitedByUserId,
canRevoke: true,
})));
});
function maskEmail(email) {
const [local, domain] = email.split('@');
if (local.length <= 2) return `${local[0]}***@${domain}`;
return `${local[0]}${'*'.repeat(Math.min(local.length - 2, 4))}${local[local.length - 1]}@${domain}`;
}
CVSS 3.1 approximate score for CORS35-002: 9.1 (CRITICAL) — AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N. Both Confidentiality and Integrity are High: confidentiality because the leaked invitee email addresses and org structure constitute PII, and integrity because the stolen tokens enable unauthorized access to the organization.
CORS35-003 — Wildcard ACAO on invitation accept lets any page consume any known token
The invitation accept endpoint POST /api/invitations/:token/accept validates an invitation token and creates a team membership for the authenticated user. If the user is not yet registered, the endpoint creates a new account and then creates the membership. The endpoint was designed to work from an email link — the invitee clicks a link in their email, lands on the registry, and is walked through account creation and team onboarding in a single flow.
To support the partner portal at a different origin, a developer added ACAO: * to the accept endpoint. The developer reasoned that this endpoint only needs to be called with the token (which the invitee has), not with a session cookie, so a wildcard is safe — “no credentials means no problem.” This reasoning has two flaws. First, as covered in CORS33-002, wildcard ACAO on a write endpoint is not safe when the endpoint also accepts API key authentication via a custom header; the attacker can include the leaked API key in the cross-origin request without needing cookies. More fundamentally here: the token value itself is the authentication credential for this endpoint. Any page that learns an invitation token — via CORS35-002 or any other side channel — can POST it to the accept endpoint from any origin and join the team as the invited user identity. The wildcard ACAO means the browser will execute the cross-origin POST, the token will be consumed, and the membership will be created. The browser’s refusal to let the calling script read the response is irrelevant; the state change has already occurred.
// CORS35-003 — VULNERABLE
// ACAO:* on a token-authenticated write endpoint — token IS the credential.
// Attacker who reads CORS35-002 token can immediately accept invitation from any page.
// invitations/router.js
router.options('/invitations/:token/accept', (req, res) => {
res.header('Access-Control-Allow-Origin', '*'); // VULNERABLE: wildcard on write endpoint
res.header('Access-Control-Allow-Methods', 'POST');
res.header('Access-Control-Allow-Headers', 'Content-Type');
res.sendStatus(204);
});
router.post('/invitations/:token/accept',
(req, res, next) => {
res.header('Access-Control-Allow-Origin', '*'); // VULNERABLE: wildcard
next();
},
async (req, res) => {
const { token } = req.params;
const invitation = await db.invitations.findByToken(token); // token IS the auth credential
if (!invitation) return res.status(404).json({ error: 'Invitation not found or expired' });
if (invitation.expiresAt < new Date()) {
return res.status(410).json({ error: 'Invitation expired' });
}
// Create or fetch the accepting user
const user = req.session?.userId
? await db.users.findById(req.session.userId)
: await db.users.createFromInvitation({ email: invitation.email });
await db.teamMembers.create({
teamId: invitation.teamId,
userId: user.id,
role: invitation.role,
});
await db.invitations.markConsumed(invitation.id); // token "consumed" — but attacker already in
res.json({ joined: invitation.teamId, role: invitation.role });
}
);
// Attacker page (uses CORS35-002 to get token, then accepts):
// const token = await getTokenViaCORS35002();
// await fetch(`https://registry.example.com/api/invitations/${token}/accept`, {
// method: 'POST' // no credentials needed — token is in the URL path
// });
// Attacker is now a team member under the invited user's email identity
Atomic single-use: why “consumed” must mean “consumed before the response”: Some implementations mark the invitation token as consumed after the membership record is created, with both steps in a sequential rather than transactional flow. Under a race condition — two concurrent requests using the same token — both can succeed before either observes the consumed flag. An attacker who obtains a token via CORS35-002 can submit two simultaneous accept requests, both of which read the unconsumed token, both of which create a membership, and the second of which creates a duplicate membership record under the same team ID. Use an atomic database transaction that marks the token consumed as a precondition for creating the membership, with the consumed flag protected by a unique constraint: UPDATE invitations SET consumed_at = now() WHERE id = $1 AND consumed_at IS NULL RETURNING * — if this UPDATE returns zero rows, the token was already consumed.
// CORS35-003 — FIXED
// 1. Remove ACAO:* from the accept endpoint entirely; use allowlist-based CORS.
// 2. Require the accepting user to be authenticated (or complete auth flow first).
// 3. Atomic single-use: UPDATE ... WHERE consumed_at IS NULL in a single transaction.
// 4. Verify invitee email matches accepting user's email.
// invitations/router.js
const { teamsCorsOptions } = require('../config/cors'); // same allowlist as team endpoints
router.use(cors(teamsCorsOptions));
router.post('/invitations/:token/accept',
requireSession, // accepting user MUST be authenticated first
async (req, res) => {
const { token } = req.params;
// Hash the token before lookup — tokens stored as SHA-256(token) in DB
const tokenHash = crypto.createHash('sha256').update(token).digest('hex');
// Atomic consume: marks consumed and returns invitation in a single UPDATE ... RETURNING
const invitation = await db.invitations.atomicConsume(tokenHash);
if (!invitation) {
// Returns null for: not found, expired, already consumed — unified 404 to avoid oracle
return res.status(404).json({ error: 'Invitation not found, expired, or already used' });
}
// Verify accepting user's email matches the invitation's target email
if (req.session.email.toLowerCase() !== invitation.email.toLowerCase()) {
// Undo the consume to avoid permanently invalidating a legitimate invitee's token
await db.invitations.undoConsume(invitation.id);
return res.status(403).json({ error: 'This invitation was sent to a different email address' });
}
await db.teamMembers.create({
teamId: invitation.teamId,
userId: req.session.userId,
role: invitation.role,
});
res.json({ joined: invitation.teamId, role: invitation.role });
}
);
CVSS 3.1 approximate score for CORS35-003: 8.3 (HIGH) — AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:H/A:N. Integrity is High because the attacker gains unauthorized team membership with access to all shared organizational resources. The dependency on CORS35-002 for token acquisition raises Attack Complexity slightly, but the tokens leaked by CORS35-002 are immediately actionable with no additional steps required.
CORS35-004 — Credential-bearing CORS on member profile exposes audit history permissions
The member profile endpoint GET /api/teams/:id/members/:userId returns the profile of a specific team member: their email address, display name, role (viewer, member, admin, owner), account creation date, last-seen timestamp, and a permissions object describing their granular access rights within the organization — including which audit result categories they can view, whether they can export reports, whether they can manage integrations, and whether they have access to the audit history. This profile data was added to support a team management UI that allows admins to review and adjust individual member permissions without navigating to a full settings page.
The endpoint received the same cors({origin:true,credentials:true}) treatment as the pending invitations endpoint. The result is that any attacker page can read the full profile of any team member, including the email address (useful for targeted phishing), the last-seen timestamp (useful for determining which team members are actively monitoring the registry), and the granular permission object (useful for identifying which members have visibility into specific audit findings and which do not — the members without audit-history access are least likely to notice a stealthy intrusion).
When combined with the team member list (a sibling endpoint likely to have the same CORS misconfiguration), this leak gives an attacker a complete org chart: who has what access, who is active, and whose credentials are worth targeting for a more direct account compromise. The lastSeenAt timestamp is particularly operationally useful: a member last seen 90+ days ago has likely forgotten their session and may have rotated their machine; their account is a cold target. A member last seen 2 hours ago is actively monitoring — a constraint the attacker needs to work around.
// CORS35-004 — VULNERABLE
// cors({origin:true,credentials:true}) on member profile endpoint — any origin reads
// member emails, roles, last-seen timestamps, and audit history permissions.
// teams/router.js
router.get(
'/:id/members/:userId',
cors({ origin: true, credentials: true }), // VULNERABLE: reflects any Origin with credentials
requireSession,
async (req, res) => {
const member = await db.teamMembers.findByTeamAndUser(req.params.id, req.params.userId);
if (!member) return res.status(404).json({ error: 'Member not found' });
res.json({
userId: member.userId,
email: member.email, // ← PII: email address
displayName: member.displayName,
role: member.role, // ← role in this team
lastSeenAt: member.lastSeenAt, // ← operational intel: active monitoring indicator
joinedAt: member.joinedAt,
permissions: { // ← granular access control map — reveals security posture
viewAuditResults: member.permissions.viewAuditResults,
exportReports: member.permissions.exportReports,
manageIntegrations: member.permissions.manageIntegrations,
viewAuditHistory: member.permissions.viewAuditHistory, // ← key target: who sees history
manageWebhooks: member.permissions.manageWebhooks,
manageApiKeys: member.permissions.manageApiKeys,
},
});
}
);
// Attacker page (victim session present):
// const members = await fetchMemberList(); // from sibling endpoint with same CORS
// for (const userId of members.map(m => m.userId)) {
// const profile = await fetch(
// `https://registry.example.com/api/teams/TARGET_ID/members/${userId}`,
// { credentials: 'include' }
// ).then(r => r.json());
// // Build org chart: role, email, last-seen, permissions
// }
Why lastSeenAt is more sensitive than it appears: The last-seen timestamp answers the precise question an attacker asks before beginning a stealthy intrusion: “Is anyone watching?” A team member with viewAuditHistory: true last seen 3 minutes ago is a risk the attacker will delay exploiting. The same member last seen 6 days ago is a safe window. The combination of permissions.viewAuditHistory and lastSeenAt across all members gives the attacker a precise schedule of monitoring gaps — equivalent to knowing when the security team is on call and when they are not. For the same reason, lastSeenAt must be treated as privileged data: accessible to the member themselves and to org admins, never accessible to any cross-origin page.
// CORS35-004 — FIXED
// Same allowlist-based CORS as the rest of the teams router (applied at router level).
// Add team-membership check: only members of the team can read other member profiles.
// Restrict sensitive fields: lastSeenAt and full permissions only to admin/owner or own profile.
// teams/router.js — no inline cors() on this route; uses router-level allowlist
router.get('/:id/members/:userId', requireSession, async (req, res) => {
// Verify requesting user is a member of the target team
const requesterMembership = await db.teamMembers.findByUserAndTeam(
req.session.userId,
req.params.id
);
if (!requesterMembership) return res.status(404).json({ error: 'Team not found' });
const member = await db.teamMembers.findByTeamAndUser(req.params.id, req.params.userId);
if (!member) return res.status(404).json({ error: 'Member not found' });
const isAdminOrOwner = ['admin', 'owner'].includes(requesterMembership.role);
const isOwnProfile = req.session.userId === req.params.userId;
const canSeePrivate = isAdminOrOwner || isOwnProfile;
res.json({
userId: member.userId,
displayName: member.displayName,
role: member.role,
joinedAt: member.joinedAt,
// Restrict PII and operational-intel fields to admin/owner or own profile
email: canSeePrivate ? member.email : undefined,
lastSeenAt: canSeePrivate ? member.lastSeenAt : undefined,
permissions: canSeePrivate ? member.permissions : {
// Non-admins only see coarse capability flags, not the full permission map
canViewReports: member.permissions.viewAuditResults,
},
});
});
CVSS 3.1 approximate score for CORS35-004: 7.5 (HIGH) — AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N. Confidentiality is High because the full member profile — email, role, last-seen timestamp, and granular permission map — enables both targeted phishing and operational scheduling of intrusion attempts to avoid active monitors.
Compound attack chain: token read → immediate accept → member intel → invite flood
The four CORS35 findings compose into a four-step attack chain that completes with the attacker as a full team member and the incident response team unable to distinguish the attacker’s activity from that of the original invitee:
GET /api/teams/TARGET_ID/invitations returns the full pending invitation list, including raw single-use acceptance tokens for each outstanding invitation. If the target organization has an outstanding invitation for a legitimate new hire, the attacker takes that token. The legitimate new hire’s invitation is now in the attacker’s hands./api/invitations/{token}/accept from their page (wildcard ACAO means the browser permits the request). The token is consumed, the attacker’s account is added as a team member under the invited user’s identity (or a new account is created matching the invitee’s email). The legitimate new hire receives an error when they click their email link: “Invitation not found or already used.” They assume it expired and ask for a re-send, which creates a new pending invitation that CORS35-002 can steal again.GET /api/teams/TARGET_ID/members/:userId for each team member (using the allowlisted origin, not cross-origin, since they are now inside). They map the full org chart: who has viewAuditHistory, who is an admin, whose lastSeenAt shows they are inactive. This tells the attacker which audit findings the team is watching, which members would notice anomalous changes, and when the monitoring coverage has gaps.Detection with tree-sitter AST queries
The three queries below target JavaScript/TypeScript Express route handlers. Apply them to your invitation and team management router files to surface CORS35-class issues before they reach production.
Query 1: Detect endpoints that accept application/x-www-form-urlencoded (simple-request bypass)
; tree-sitter query — detect express.urlencoded() parser on routers that also define invitation endpoints
; Matches: router.use(express.urlencoded(...)) near router.post('/...invite...')
(program
(expression_statement
(call_expression
function: (member_expression
object: (identifier) @router
property: (property_identifier) @use (#eq? @use "use"))
arguments: (arguments
(call_expression
function: (member_expression
object: (identifier) @express (#eq? @express "express")
property: (property_identifier) @urlencoded (#eq? @urlencoded "urlencoded")))))) @urlencoded_use
(expression_statement
(call_expression
function: (member_expression
object: (identifier) @router2
property: (property_identifier) @method (#match? @method "^(post|put|patch)$"))
arguments: (arguments
(string) @path (#match? @path "invite|onboard|accept")))) @write_route
(#eq? @router @router2)) @router_with_urlencoded_and_invite
Query 2: Detect raw invitation tokens returned in API responses
; tree-sitter query — detect invitation token values included in res.json() response objects
; Matches: res.json({ ... token: inv.token ... }) or similar field assignments
(call_expression
function: (member_expression
object: (identifier) @res (#eq? @res "res")
property: (property_identifier) @method (#match? @method "^(json|send)$"))
arguments: (arguments
(object
(pair
key: [(property_identifier) (string)] @key
(#match? @key "token|inviteToken|acceptToken|invitationToken")
value: _) @token_field))) @response_with_token
Query 3: Detect ACAO:* on routes matching invitation-related path patterns
; tree-sitter query — detect wildcard ACAO emitted in handlers for invitation/accept routes
(call_expression
function: (member_expression
object: (identifier) @router
property: (property_identifier) @method (#match? @method "^(post|put|patch|options)$"))
arguments: (arguments
(string) @path (#match? @path "accept|invite|onboard|join")
.
(arrow_function
body: (statement_block
(expression_statement
(call_expression
function: (member_expression
object: (identifier) @res (#eq? @res "res")
property: (property_identifier) @set_method
(#match? @set_method "^(header|setHeader|set)$"))
arguments: (arguments
(string) @header_name (#match? @header_name "Access-Control-Allow-Origin")
(string) @header_val (#eq? @header_val "'*'")))) @wildcard_cors)))) @invite_handler_with_wildcard
Operator checklist: 10 controls for CORS-safe invitation and onboarding endpoints
- Accept only
application/jsonon all mutation endpoints (invite send, invitation accept, role change); removeexpress.urlencoded()from all routers that handle invitation or membership actions to prevent simple-request bypasses. - Apply an explicit
Set-basedallowedOriginsto all team and invitation endpoints; document each allowed origin, its owner, and the last date it was reviewed; remove origins that are no longer in service. - Never return raw invitation token values in any API response; store tokens as
SHA-256(token)in the database, compare by hash on accept, and treat the token value itself as a one-way credential that only exists in the invitation email. - Remove
ACAO: *from all invitation accept and consume endpoints; use the same explicit allowlist as the team read endpoints, and require the accepting user to be authenticated before the token is validated. - Implement atomic token consumption using an
UPDATE ... WHERE consumed_at IS NULL RETURNING *pattern protected by a unique index; if the UPDATE returns zero rows, the token is already consumed — return a unified 404 to avoid oracle timing differences. - Verify the accepting user’s authenticated email matches the invitation’s target email; if they differ, undo the consume and return a 403 without revealing whose invitation was targeted.
- Restrict
lastSeenAtand granular permission fields in member profile responses to admin/owner roles and the member’s own profile; non-admin team members should see only coarse capability flags, not operational-intel-level activity timestamps. - Gate invitation send and accept on
requireRole('admin')checked server-side against the team membership record, not against a JWT claim; JWT role claims are attacker-controlled if the token is not validated against the database on each request. - Add per-org rate limits on invitation creation (e.g., max 20 invitations per 24 hours per org) to prevent invite-flood attacks that exhaust the team seat plan or overwhelm notification inboxes.
- Include invitation send and accept events in the organization audit log with the requesting
userId, the target email, the invitation ID, and the source IP; alert on >3 invitation-accept events within a 60-second window for a single team — a strong signal of automated token-consumption attacks.
Related advisories: CORS35 is part of a family of CORS vulnerabilities specific to MCP skill registries. For CORS misconfigurations in webhook subscription and event delivery endpoints (which expose internal CI/CD pipeline trigger URLs), see SA-SKL-CORS34. For CORS misconfigurations in audit scheduling and recurring scan configuration endpoints (which expose target repo lists and notification addresses), see SA-SKL-CORS33. For privilege escalation vulnerabilities in admin console and system configuration endpoints (the escalation that often follows unauthorized team entry), see SA-SKL-PRIVESC18.
SkillAudit checks for CORS35, CORS33, SSRF, command injection, prototype pollution, and 50+ more vulnerability patterns — in 60 seconds, with a shareable grade badge.
Get early access