Claude MCP skill CORS misconfiguration — organization management and member invitation — SA-SKL-CORS27
Organization management endpoints control billing tier, seat allocation, team membership, and org ownership — the highest-privilege operations in a multi-tenant MCP skill registry. SA-SKL-CORS27 covers four CORS misconfiguration patterns in these endpoints: a wildcard ACAO on the org settings GET endpoint that leaks Stripe customer ID and billing email cross-origin using the victim's session cookie; a missing CORS policy on the member invitation POST that allows simple-request forgery inviting the attacker to the victim's org at the victim's billing cost; a wildcard ACAO on the member removal DELETE that lets an attacker remove colleagues from the victim org cross-origin; and a wildcard ACAO on the org transfer POST that enables an attacker page to trigger an org ownership transfer to the attacker's account cross-origin using the victim admin's session.
/api/orgs/:id has ACAO:* — any origin reads org plan tier, seat count, billing email, and Stripe customer ID cross-origin using victim session cookie; attacker harvests billing contact and Stripe cust ID for downstream account takeover or invoice fraud/api/orgs/:id/invitations has no CORS policy — attacker page sends simple-request POST (application/x-www-form-urlencoded) inviting attacker's email to victim's org; victim org billed for new seat at next billing cycle; attacker gains legitimate team-plan access/api/orgs/:id/members/:userId has ACAO:* — attacker page removes victim's colleagues from org cross-origin using victim admin session; targeted removal of key team members achieves denial-of-service on audit workflows/api/orgs/:id/transfer has wildcard ACAO — attacker page triggers org ownership transfer to attacker account cross-origin using victim admin session; attacker gains full org admin: billing control, seat management, audit history accessBackground: CORS in multi-tenant organization management endpoints
Organization management endpoints in a multi-tenant MCP skill registry operate at the highest privilege level: they govern billing relationships, team composition, and ownership of the organization itself. A CORS misconfiguration on any of these endpoints exposes operations that, in a single-origin context, would require authenticated admin access — but through cross-origin request forgery become executable by any malicious web page the admin visits. The severity hierarchy in CORS27 runs from information disclosure (CORS27-001 leaks billing metadata) through persistent unauthorized access (CORS27-002 adds attacker to org) to organizational takeover (CORS27-004 transfers org ownership).
The common root cause across all four findings is treating org management endpoints as equivalent in sensitivity to read-only data APIs. ACAO:* is frequently applied blanket-style to an entire API prefix (e.g., /api/*) during development for convenience, without recognizing that DELETE and POST endpoints under /api/orgs/ carry admin-equivalent impact. CORS27-002 is particularly subtle: a POST with Content-Type: application/x-www-form-urlencoded is a "simple request" under CORS rules — no preflight, so a missing CORS policy does not prevent the browser from sending the request including the victim's session cookie. The fix is an explicit allowlist of permitted origins on every write endpoint, not a wildcard.
Related patterns: SA-SKL-CORS26, SA-SKL-PRIVESC9, SA-SKL-SSRF27
CORS27-001: CRITICAL — Org settings endpoint GET /api/orgs/:id has wildcard ACAO with credentials
The org settings endpoint returns the organization's plan tier, seat count, billing email, Stripe customer ID, invoice history URL, and admin user list. The endpoint is configured with cors({ origin: true, credentials: true }) — Express cors middleware with origin: true reflects the incoming Origin header as the ACAO header value, which combined with credentials: true grants any origin full credentialed cross-origin read access. An attacker page loaded by an org admin calls fetch('https://skillaudit.dev/api/orgs/'+orgId, { credentials: 'include' }) and receives the full settings object including the Stripe customer ID. The orgId is typically sequential or UUID discoverable from the user's profile API.
// VULNERABLE — CORS27-001
// routes/orgs.js
const cors = require('cors');
// BUG: origin:true reflects any Origin header as ACAO
// Combined with credentials:true this is equivalent to ACAO:* but worse —
// it allows credentialed cross-origin reads from any attacker origin
app.get('/api/orgs/:id',
cors({ origin: true, credentials: true }), // ← reflects any origin
authenticate,
async (req, res) => {
const org = await Org.findById(req.params.id);
if (org.id !== req.user.orgId) return res.status(403).json({ error: 'Forbidden' });
// Returns Stripe customer ID, billing email, seat count, plan tier
// All readable cross-origin by any attacker page via credentialed fetch
res.json({
id: org.id,
name: org.name,
plan: org.plan,
seats: org.seats,
billingEmail: org.billingEmail,
stripeCustomerId: org.stripeCustomerId, // ← sensitive
invoiceHistoryUrl: org.invoiceHistoryUrl,
});
}
);
// FIXED — CORS27-001
// routes/orgs.js
const cors = require('cors');
// Explicit allowlist of permitted origins — never use origin:true or origin:'*'
// on endpoints returning sensitive billing or organizational data
const ALLOWED_ORIGINS = [
'https://skillaudit.dev',
'https://app.skillaudit.dev',
];
const orgCors = cors({
origin: (origin, callback) => {
// Allow server-to-server requests (no Origin header)
if (!origin) return callback(null, false);
if (ALLOWED_ORIGINS.includes(origin)) return callback(null, true);
callback(new Error('CORS: origin not allowed'));
},
credentials: true,
methods: ['GET'],
allowedHeaders: ['Authorization', 'Content-Type'],
});
app.get('/api/orgs/:id',
orgCors,
authenticate,
async (req, res) => {
const org = await Org.findById(req.params.id);
if (org.id !== req.user.orgId) return res.status(403).json({ error: 'Forbidden' });
// Strip internal payment fields from API response
// Stripe customer ID and invoice URLs are accessed via Stripe Customer Portal only
res.json({
id: org.id,
name: org.name,
plan: org.plan,
seats: org.seats,
billingEmail: org.billingEmail,
// stripeCustomerId omitted — not needed by the client
});
}
);
CORS27-001 impact: Org billing email and Stripe customer ID readable by any page the admin visits. The Stripe customer ID enables downstream attacks: querying the Stripe Customer Portal link endpoint, triggering invoice-level operations via any leaked Stripe restricted key, or phishing the billing email with forged invoice communications. SkillAudit detects this by identifying cors({ origin: true, credentials: true }) and cors({ origin: '*', credentials: true }) configurations on endpoints that return billing or organizational membership data.
CORS27-002: CRITICAL — Member invitation POST has no CORS policy — simple-request forgery
The member invitation endpoint POST /api/orgs/:id/invitations has no CORS configuration. This means the browser applies the default CORS policy: cross-origin simple requests (GET, POST, HEAD with safe content types) are sent including cookies but the response is blocked from JavaScript. For a POST with Content-Type: application/x-www-form-urlencoded, this is a simple request — no preflight OPTIONS is sent, the browser sends the POST with the victim's session cookie attached, and the server processes the invitation. The attacker constructs a page with a hidden form targeting the endpoint: <form method="POST" action="https://skillaudit.dev/api/orgs/TARGET_ORG/invitations"><input name="email" value="attacker@evil.com"></form> and auto-submits it via JavaScript. The victim's org sends an invitation email to the attacker's address; accepting it grants the attacker a full team-plan seat billed to the victim's org.
// VULNERABLE — CORS27-002
// routes/orgs.js
// BUG: no CORS middleware on this route
// POST with application/x-www-form-urlencoded is a CORS simple request —
// no preflight, browser sends request including session cookie
// Attacker auto-submits hidden form → victim org sends invitation to attacker@evil.com
app.post('/api/orgs/:id/invitations',
authenticate, // ← only protection is auth cookie — present in simple-request
requireRole('admin'),
async (req, res) => {
const { email, role } = req.body;
const org = await Org.findById(req.params.id);
const invitation = await Invitation.create({
orgId: org.id,
email,
role: role || 'member',
invitedBy: req.user.id,
});
await email.send({ to: email, subject: 'You\'ve been invited to join ' + org.name });
res.status(201).json(invitation);
}
);
// FIXED — CORS27-002
// routes/orgs.js
const cors = require('cors');
const ALLOWED_ORIGINS = [
'https://skillaudit.dev',
'https://app.skillaudit.dev',
];
// Reject all browser-origin requests that don't come from the allowlisted origins
// For write endpoints, also enforce CSRF token to defend against simple-request forgery
const writeOrgCors = cors({
origin: (origin, callback) => {
// Reject requests with an Origin header not in the allowlist
// This includes requests from attacker pages (which will have origin: https://attacker.com)
if (origin && !ALLOWED_ORIGINS.includes(origin)) {
return callback(new Error('CORS: origin not allowed'));
}
callback(null, origin ? true : false);
},
credentials: true,
methods: ['POST'],
});
app.post('/api/orgs/:id/invitations',
writeOrgCors,
authenticate,
requireRole('admin'),
csrfProtect, // Double Submit Cookie or Synchronizer Token Pattern
async (req, res) => {
const { email, role } = req.body;
// Validate email format and check invitation rate limit per org
if (!isValidEmail(email)) return res.status(400).json({ error: 'Invalid email' });
const recentInvitations = await Invitation.countRecentByOrg(req.params.id, 60);
if (recentInvitations >= 20) {
return res.status(429).json({ error: 'Invitation rate limit exceeded' });
}
const org = await Org.findById(req.params.id);
if (org.id !== req.user.orgId) return res.status(403).json({ error: 'Forbidden' });
const invitation = await Invitation.create({
orgId: org.id,
email,
role: ['member', 'admin'].includes(role) ? role : 'member',
invitedBy: req.user.id,
});
await emailService.sendInvitation({ to: email, org, invitation });
res.status(201).json({ id: invitation.id, email, role: invitation.role });
}
);
CORS27-002 impact: Attacker gains a legitimate team-plan seat billed to the victim org's subscription, without spending any money or passing any verification beyond clicking an invitation email. The Stripe proration charge fires on the next billing cycle, billed to the victim. If the attacker accepts before the victim notices, they gain full team-plan access to audit history, skill registry, and policy reports. SkillAudit detects this by identifying invitation and membership write endpoints that lack any CORS middleware, flagging them as vulnerable to simple-request forgery via hidden form submission.
CORS27-003: HIGH — Member removal DELETE endpoint has wildcard ACAO
The org member removal endpoint DELETE /api/orgs/:id/members/:userId is configured with cors({ origin: '*' }). Because it has credentials: true omitted, the wildcard appears safe — but the endpoint's delete action is performed when the authenticated admin's browser sends the preflight OPTIONS (which passes) and then the DELETE request including the session cookie. With origin: '*', the preflight succeeds for any attacker origin, allowing the browser to then send the credentialed DELETE. The result: an attacker page visited by an org admin can enumerate and remove any member from the victim's organization. Targeted removal of a lead engineer or compliance officer from an active audit project achieves a denial-of-service on the organization's security workflow.
// VULNERABLE — CORS27-003
// routes/orgs.js
// BUG: origin:'*' on DELETE endpoint
// Preflight from attacker page succeeds → browser sends credentialed DELETE
// Attacker removes victim's colleagues using admin session cookie
app.delete('/api/orgs/:id/members/:userId',
cors({ origin: '*' }), // ← BUG: wildcard ACAO on destructive endpoint
authenticate,
requireRole('admin'),
async (req, res) => {
const { id: orgId, userId } = req.params;
// No check that req.user.orgId === orgId — missing ownership check
await OrgMember.remove({ orgId, userId });
res.status(204).end();
}
);
// FIXED — CORS27-003
// routes/orgs.js
const ALLOWED_ORIGINS = ['https://skillaudit.dev', 'https://app.skillaudit.dev'];
const deleteCors = cors({
origin: (origin, callback) => {
if (origin && !ALLOWED_ORIGINS.includes(origin)) {
return callback(new Error('CORS: origin not allowed'));
}
callback(null, origin ? true : false);
},
credentials: true,
methods: ['DELETE'],
});
app.delete('/api/orgs/:id/members/:userId',
deleteCors,
authenticate,
requireRole('admin'),
csrfProtect,
async (req, res) => {
const { id: orgId, userId } = req.params;
// Ownership check: requester must be an admin of THIS org
if (req.user.orgId !== orgId) {
return res.status(403).json({ error: 'Forbidden' });
}
// Prevent admin from removing themselves — requires ownership transfer first
if (userId === req.user.id) {
return res.status(400).json({ error: 'Cannot remove yourself — transfer org ownership first' });
}
// Audit log before removal
await AuditLog.record({
action: 'member_removed',
orgId,
targetUserId: userId,
actorUserId: req.user.id,
});
await OrgMember.remove({ orgId, userId });
res.status(204).end();
}
);
CORS27-003 impact: Targeted removal of team members from an active audit project. An attacker who knows the userId values of key team members (discoverable from the org members API if CORS27-001 is also present) can remove them silently during a live security audit engagement. The removed members lose access to in-progress audit reports and cannot restore their access without re-invitation from the remaining admin. SkillAudit detects this by identifying DELETE endpoints under organization management routes that use cors({ origin: '*' }) or cors({ origin: true }).
CORS27-004: HIGH — Org transfer POST has wildcard ACAO
The org ownership transfer endpoint POST /api/orgs/:id/transfer transfers org ownership to a different user. It is configured with cors({ origin: '*', credentials: true }) — which the Express cors middleware actually rejects at runtime (CORS spec disallows ACAO:* with ACAC:true), causing an inconsistent behavior: the CORS headers sent are ACAO:* without ACAC:true (the middleware drops the credentials flag when origin is wildcard). However, the endpoint still accepts the credentialed DELETE from an allowed origin because the same-origin case bypasses CORS entirely. The actual vulnerability: the CORS preflight from an attacker origin succeeds because the response includes Access-Control-Allow-Origin: *, and the browser then sends the POST with the victim's session cookie — completing the ownership transfer to the attacker's userId without any additional confirmation. No email verification, no password re-entry, no ownership transfer confirmation token is required.
// VULNERABLE — CORS27-004
// routes/orgs.js
// BUG: wildcard ACAO on org transfer endpoint
// Preflight from attacker page succeeds (ACAO:* allows any origin)
// Browser sends POST with victim admin session cookie
// No transfer confirmation token — transfer completes immediately
app.post('/api/orgs/:id/transfer',
cors({ origin: '*' }), // ← BUG: wildcard ACAO on ownership-transfer endpoint
authenticate,
requireRole('owner'),
async (req, res) => {
const { newOwnerId } = req.body;
const org = await Org.findById(req.params.id);
// No confirmation token — transfers immediately on single POST
await Org.transferOwnership({ orgId: org.id, newOwnerId });
res.json({ success: true, newOwnerId });
}
);
// FIXED — CORS27-004
// routes/orgs.js
const ALLOWED_ORIGINS = ['https://skillaudit.dev', 'https://app.skillaudit.dev'];
const transferCors = cors({
origin: (origin, callback) => {
if (origin && !ALLOWED_ORIGINS.includes(origin)) {
return callback(new Error('CORS: origin not allowed'));
}
callback(null, origin ? true : false);
},
credentials: true,
methods: ['POST'],
});
app.post('/api/orgs/:id/transfer',
transferCors,
authenticate,
requireRole('owner'),
csrfProtect,
async (req, res) => {
const { newOwnerId, confirmationToken } = req.body;
const org = await Org.findById(req.params.id);
if (org.id !== req.user.orgId) {
return res.status(403).json({ error: 'Forbidden' });
}
// Two-step transfer: first POST creates a pending transfer with 24h token;
// second POST (from new owner clicking email link) with token confirms
if (!confirmationToken) {
const pending = await OrgTransfer.createPending({
orgId: org.id,
currentOwnerId: req.user.id,
newOwnerId,
expiresAt: Date.now() + 24 * 60 * 60 * 1000,
});
await emailService.sendTransferConfirmation({
to: await User.getEmail(newOwnerId),
org,
token: pending.token,
});
return res.json({ status: 'pending', message: 'Confirmation email sent to new owner' });
}
// Confirm step: validate token, check expiry, complete transfer
const pending = await OrgTransfer.findByToken(confirmationToken);
if (!pending || pending.orgId !== org.id || pending.expiresAt < Date.now()) {
return res.status(400).json({ error: 'Invalid or expired transfer token' });
}
await Org.transferOwnership({ orgId: org.id, newOwnerId: pending.newOwnerId });
await OrgTransfer.consume(pending.id);
await AuditLog.record({
action: 'ownership_transferred',
orgId: org.id,
fromUserId: pending.currentOwnerId,
toUserId: pending.newOwnerId,
});
res.json({ success: true, newOwnerId: pending.newOwnerId });
}
);
CORS27-004 impact: Complete org takeover — the attacker becomes the owner of the victim's organization, gaining control over billing (can change payment method, cancel subscription, trigger refunds), all team member access (can remove all members), and the full audit and policy report history. Recovery requires contacting SkillAudit support to reverse the transfer, which may require identity verification and takes time — during which the attacker has full admin access. SkillAudit detects this by identifying ownership transfer endpoints that use wildcard ACAO and lack multi-step confirmation token verification.
Detection with SkillAudit
SkillAudit's static analysis scans organization management routes for all four SA-SKL-CORS27 patterns. For CORS27-001 it identifies cors({ origin: true, credentials: true }) and cors({ origin: '*', credentials: true }) on endpoints returning billing or org metadata. For CORS27-002 it identifies invitation write endpoints with no CORS middleware that accept POST bodies with application/x-www-form-urlencoded content type. For CORS27-003 it identifies DELETE endpoints under org management routes using wildcard ACAO configurations. For CORS27-004 it identifies ownership transfer endpoints with wildcard ACAO and single-step (no confirmation token) transfer logic.
| Finding | Severity | Root cause | Fix |
|---|---|---|---|
| CORS27-001 | Critical | cors({ origin: true, credentials: true }) reflects any Origin on org settings — billing email and Stripe customer ID readable cross-origin | Explicit origin allowlist; strip Stripe customer ID from API response; Stripe Customer Portal for billing access |
| CORS27-002 | Critical | No CORS on invitation POST — simple-request forgery via hidden form sends attacker's email without preflight; victim org billed for new seat | Allowlist CORS on all write endpoints; add CSRF token to invitation form; invitation rate limit per org |
| CORS27-003 | High | Wildcard ACAO on member removal DELETE — attacker page removes victim's colleagues using admin session cookie | Allowlist CORS + CSRF token on DELETE endpoints; ownership check org.id === req.user.orgId; audit log on removal |
| CORS27-004 | High | Wildcard ACAO on org transfer POST — attacker page transfers org ownership to attacker account using victim admin session | Allowlist CORS + CSRF token; two-step transfer with email confirmation token; audit log on ownership change |
Related findings: SA-SKL-CORS26, SA-SKL-PRIVESC9, SA-SKL-SSRF27
Scan your MCP skill registry for SA-SKL-CORS27. SkillAudit scans your MCP skill registry for all SA-SKL-CORS27 patterns — org settings ACAO reflection leaking billing metadata, simple-request invitation forgery, wildcard ACAO on member removal, and ownership transfer without confirmation — and delivers a prioritized fix report in minutes. Get started →