CORS Misconfigurations in MCP Skill Registry Organization Management and Member Invitation Endpoints
Organization management endpoints carry the highest-stakes data in a multi-tenant MCP skill registry: billing contacts, subscription tiers, Stripe customer identifiers, seat counts, and org ownership. The four SA-SKL-CORS27 patterns demonstrate how CORS misconfigurations on these endpoints transform cross-origin requests from a read-only information-disclosure concern into a full organizational takeover chain — ending with an attacker transferring ownership of a victim's entire org, including all published skills and audit history, without ever logging in themselves.
In this post
- Why org management endpoints are CORS high-risk zones
- CORS27-001 — Origin reflection on org settings GET leaks billing data
- CORS27-002 — Absent CORS on invitation POST enables simple-request seat fraud
- CORS27-003 — Wildcard ACAO on member removal DELETE
- CORS27-004 — Wildcard ACAO on org transfer POST
- Compound attack chain: billing recon → org join → ownership transfer
- Detection with AST queries
- Summary and checklist
GET /api/orgs/:id uses cors({origin:true,credentials:true}) which reflects every Origin as ACAO; attacker page reads billing email, Stripe customer ID, and subscription tier cross-origin using victim admin sessionPOST /api/orgs/:id/invitations has no CORS middleware and accepts application/x-www-form-urlencoded; simple-request form POST invites attacker's email to victim org with victim admin cookie; victim billed for new seatDELETE /api/orgs/:id/members/:userId has ACAO: *; any origin removes the victim admin's colleagues cross-origin using their admin session cookie, disrupting team accessPOST /api/orgs/:id/transfer has ACAO: *; attacker page transfers org ownership to their own account cross-origin, locking the victim admin out of their own organizationWhy org management endpoints are CORS high-risk zones
CORS misconfigurations broadly fall into two impact categories. The first category — wildcard ACAO: * on a public, unauthenticated API — is low severity because the attacker gains nothing they could not already access anonymously. The second category — any CORS misconfiguration on authenticated, state-changing endpoints — is high to critical severity because the attacker leverages the victim's existing credentials to perform actions the victim has not authorized.
Organization management endpoints sit at the extreme end of the second category. They are authenticated by definition, they perform high-consequence state mutations (invitation, removal, transfer), and they typically carry financially sensitive data (billing contacts, Stripe identifiers, seat counts). In a multi-tenant MCP skill registry, an org is not just a collaboration namespace — it is the billing unit, the access control boundary for all published skills, and the audit history container. Losing control of an org means losing control of everything published under it.
Three CORS implementation patterns recur across MCP registry codebases and produce exactly the vulnerabilities described here. The first is using cors({origin:true}) — which is shorthand for reflect every Origin header as an allowed origin — instead of an explicit allowlist. Developers choose this because it appears to be a "lenient" mode that works with any frontend domain, but combined with credentials:true it is functionally equivalent to allowing every origin to make credentialed cross-origin requests. The second pattern is adding CORS to the main router but forgetting it on sub-routers added for specific feature areas, leaving gaps through which simple-request mutations slip. The third is adding ACAO: * as a blanket fix for CORS errors without recognising that wildcard + credentialed cookies is a contradiction that most browsers handle by silently sending the credentialed request anyway on DELETE and POST endpoints that do not check preflight results.
CORS27-001 — Origin reflection on org settings GET leaks billing data
The org settings endpoint GET /api/orgs/:id was written to serve both the web dashboard and the CLI tool. To avoid hardcoding the web dashboard origin, the developer configured CORS using the Express cors package's origin:true shorthand, which causes the middleware to reflect whatever value arrives in the request's Origin header as the value of Access-Control-Allow-Origin. Combined with credentials:true, this produces a response that explicitly tells the browser: any origin is allowed to make credentialed cross-origin requests to this endpoint.
The API response includes fields that belong in a server-side-only context: the billing contact email address (which may differ from the account owner's login email), the Stripe customer ID, the subscription tier slug, the renewal date, and the per-seat charge. An attacker who can get a victim admin to visit a page on any domain can extract this data via a credentialed fetch from that page.
// CORS27-001 — VULNERABLE
// cors({origin:true,credentials:true}) reflects any Origin as ACAO.
// Combined with credentials:true the browser sends the victim's session cookie
// and returns the full response body to the attacker page.
// orgs/router.js
const cors = require('cors');
router.get(
'/:id',
cors({ origin: true, credentials: true }), // VULNERABLE: origin:true reflects all origins
requireSession,
async (req, res) => {
const org = await db.orgs.findById(req.params.id);
if (org.ownerId !== req.session.userId && !org.members.includes(req.session.userId)) {
return res.status(403).json({ error: 'forbidden' });
}
res.json({
id: org.id,
name: org.name,
ownerId: org.ownerId,
billingEmail: org.billingEmail, // attacker reads this
stripeCustomerId: org.stripeCustomerId, // attacker reads this
planSlug: org.planSlug, // attacker reads this
seatCount: org.seatCount,
renewalDate: org.renewalDate,
members: org.members,
});
}
);
// Attacker page (any origin):
// fetch('https://registry.example.com/api/orgs/known-org-id', {credentials:'include'})
// .then(r => r.json())
// .then(d => sendToAttacker(d.stripeCustomerId, d.billingEmail));
Why origin:true is as dangerous as origin:'*' for authenticated endpoints: When ACAO is set to *, browsers refuse to send cookies even if credentials:include is set in the fetch call — the credentialed-request + wildcard combination is explicitly forbidden by the CORS spec. But cors({origin:true}) does not set ACAO: *; it sets ACAO: <the actual Origin header value>. This is a valid non-wildcard origin that satisfies the browser's requirements for credentialed requests. The practical result is that every origin in the world can make credentialed requests and read the response — the same effective outcome as wildcard, but bypassing the browser-side protection that blocks wildcard + credentials.
// CORS27-001 — FIXED
// Replace origin:true with an explicit Set-based allowlist.
// Strip billing fields from the API response; serve them only via a separate
// /api/billing/:id endpoint with stricter access controls and no CORS at all.
// config/cors.js — shared allowlist used by all org-management routes
const ALLOWED_ORIGINS = new Set([
'https://skillaudit.dev',
'https://app.skillaudit.dev',
]);
const orgCorsOptions = {
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 = { orgCorsOptions };
// orgs/router.js
const { orgCorsOptions } = require('../config/cors');
router.get(
'/:id',
cors(orgCorsOptions), // explicit allowlist — not origin:true
requireSession,
async (req, res) => {
const org = await db.orgs.findById(req.params.id);
if (org.ownerId !== req.session.userId && !org.members.includes(req.session.userId)) {
return res.status(403).json({ error: 'forbidden' });
}
// Never return billing fields in the cross-origin-accessible response
res.json({
id: org.id,
name: org.name,
ownerId: org.ownerId,
planSlug: org.planSlug,
seatCount: org.seatCount,
members: org.members,
// billingEmail and stripeCustomerId are NOT included here
});
}
);
// Billing data served from a server-side-only route — no CORS, no browser access
app.get('/api/billing/:orgId', requireSession, requireOrgOwner, async (req, res) => {
const billing = await db.billing.findByOrgId(req.params.orgId);
res.json({ billingEmail: billing.email, planSlug: billing.planSlug, renewalDate: billing.renewalDate });
// stripeCustomerId is NEVER returned to any client — Stripe operations use server-to-server calls
});
Stripe customer IDs are not secret tokens, but they are sensitive: A Stripe customer ID like cus_Pq8mXkR3Wd1 can be used to enumerate a customer's invoices via the Stripe API if the caller has a valid Stripe secret key. While the attacker gaining just the customer ID cannot directly charge the victim, the customer ID combined with a compromised Stripe key enables targeted fraud. Beyond Stripe, billing contact emails are valuable for targeted phishing — "your SkillAudit subscription is expiring" sent to the billing email rather than the owner email is significantly more convincing.
CVSS 3.1 approximate score for CORS27-001: 8.5 (HIGH) — AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N. The scope is Changed because the billing data exposure affects the organization's financial relationship with Stripe, not just the registry itself. User interaction is required (victim admin must visit the attacker page).
CORS27-002 — Absent CORS on invitation POST enables simple-request seat fraud
The member invitation endpoint POST /api/orgs/:id/invitations sends an email invitation to a specified address and immediately increments the org's billable seat count in anticipation of the invited user accepting. The endpoint was added during a sprint that focused entirely on the product feature — the form sends application/x-www-form-urlencoded because the initial implementation pre-dated the team's migration to JSON APIs — and no CORS middleware was added to the invitations router.
The absence of CORS middleware combined with the application/x-www-form-urlencoded content type produces a simple-request gap: an HTML form POST with this content type does not require a preflight. The browser sends the request directly, including the victim admin's session cookie, before any CORS check can block it. The attacker's email address is added to the invitation queue, the seat count increments, and the victim receives a billing charge for a seat they did not intentionally allocate.
// CORS27-002 — VULNERABLE
// No cors() middleware on the invitations router.
// application/x-www-form-urlencoded qualifies as a CORS simple request —
// no preflight, no CORS block, state mutation using victim's cookie.
// invitations/router.js
const router = express.Router({ mergeParams: true });
// No cors() middleware anywhere in this file — the gap was missed during sprint review.
router.post(
'/',
requireSession,
requireOrgAdmin, // checks req.session.userId is an admin of req.params.id
async (req, res) => {
// req.body comes from application/x-www-form-urlencoded body parser
const { email, role } = req.body;
await db.invitations.create({
orgId: req.params.id,
invitedEmail: email,
role: role || 'member',
invitedBy: req.session.userId,
});
await billing.incrementSeats(req.params.id); // seat count billed immediately on invitation
await email.sendInvitation({ to: email, orgId: req.params.id });
res.json({ ok: true });
}
);
// Attacker HTML page (any origin):
// <form method="POST"
// action="https://registry.example.com/api/orgs/victim-org-id/invitations"
// enctype="application/x-www-form-urlencoded">
// <input name="email" value="attacker@evil.com">
// <input name="role" value="admin">
// </form>
// <script>document.forms[0].submit()</script>
Seat fraud as a denial-of-service vector: Beyond the obvious impact of the attacker gaining org membership, repeated exploitation of CORS27-002 enables seat fraud at scale: an attacker scripts a page that fires hundreds of invitations to throwaway addresses, bloating the victim org's billable seat count without the attacker needing to accept any invitations. Because billing increments on invitation (not acceptance), the victim organization accumulates charges for seats that were never legitimately requested. Depending on the billing tier, this can quickly exceed the organization's credit limit, triggering service suspension.
// CORS27-002 — FIXED
// 1. Apply cors() with explicit allowlist to the invitations router.
// 2. Require application/json (forces preflight, eliminating simple-request gap).
// 3. CSRF token as defence-in-depth.
// 4. Move seat increment to invitation acceptance, not invitation creation.
// 5. Per-org rate limit on invitations.
const cors = require('cors');
const { orgCorsOptions } = require('../config/cors');
const rateLimit = require('express-rate-limit');
const invitationRateLimit = rateLimit({
windowMs: 60 * 60 * 1000, // 1 hour
max: 10, // max 10 invitations per org per hour
keyGenerator: (req) => `inv:${req.params.id}`, // per-org limit
message: { error: 'Too many invitations, try again later' },
});
router.post(
'/',
cors(orgCorsOptions), // explicit origin allowlist
invitationRateLimit,
requireSession,
requireOrgAdmin,
requireContentType('application/json'), // force preflight — no simple-request bypass
verifyCsrfToken, // defence-in-depth
async (req, res) => {
const { email, role } = req.body;
// Validate role against allowlist — do not allow arbitrary role strings
if (!['member', 'admin'].includes(role)) {
return res.status(422).json({ error: 'Invalid role' });
}
await db.invitations.create({
orgId: req.params.id,
invitedEmail: email,
role,
invitedBy: req.session.userId,
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), // 7-day expiry
});
// Seat count incremented only on acceptance, not invitation
await email.sendInvitation({ to: email, orgId: req.params.id });
res.json({ ok: true });
}
);
CVSS 3.1 approximate score for CORS27-002: 8.1 (HIGH) — AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H. The integrity impact is high due to unauthorized org membership modification; the availability impact is high due to the seat fraud billing disruption vector.
CORS27-003 — Wildcard ACAO on member removal DELETE
The member removal endpoint DELETE /api/orgs/:id/members/:userId was added to support a "remove member" button in the org settings panel. During a previous incident where CORS errors appeared in the browser console for some admin users on non-canonical subdomains, a developer added res.header('Access-Control-Allow-Origin', '*') as a quick fix. This resolved the console errors but introduced a wildcard ACAO on a deletion endpoint.
The wildcard on a DELETE endpoint creates an asymmetric CORS situation. For requests with Content-Type: application/json or for methods other than GET/POST, the browser requires a preflight. The ACAO: * in the preflight response approves any origin to make the credentialed request — but wait, wildcard + credentials is blocked by browsers, right? Only partially: browsers block reading the response from a credentialed request to a wildcard endpoint. They do not block sending the credentialed request. For state-changing operations like DELETE, the server processes the deletion before the browser has the opportunity to block the response read. The attacker does not need to read the response — they just need the deletion to execute.
// CORS27-003 — VULNERABLE
// res.header('ACAO', '*') added as a quick fix — works for reads,
// but on a DELETE endpoint the state mutation occurs before browser blocks the response.
// Note: not all browsers block the deletion even with wildcard — behaviour is implementation-defined
// for simple-method DELETE variants. The safe assumption is that the deletion fires.
// members/router.js
router.delete(
'/:userId',
requireSession,
requireOrgAdmin,
async (req, res) => {
res.header('Access-Control-Allow-Origin', '*'); // VULNERABLE: added after the fact
res.header('Access-Control-Allow-Methods', 'DELETE, OPTIONS');
const { id: orgId, userId } = req.params;
const org = await db.orgs.findById(orgId);
if (org.ownerId === userId) {
return res.status(422).json({ error: 'Cannot remove org owner' });
}
await db.orgMembers.remove({ orgId, userId });
res.json({ ok: true });
}
);
The browser's wildcard + credentials partial protection is not a defence: Browsers block reading responses from credentialed requests to wildcard ACAO endpoints, but the request is sent before this check runs. For GET requests this is meaningful protection — the attacker cannot read the response body. For DELETE (and POST) requests the state change happens on the server before the browser evaluates the response. The only reliable fix is to restrict ACAO to an explicit origin allowlist — never rely on the browser's partial wildcard protection for mutation endpoints.
// CORS27-003 — FIXED
// Replace wildcard ACAO with explicit allowlist.
// Add preflight (OPTIONS) handler with correct allowed-methods.
// Add CSRF token verification.
// Log all member removals to org audit trail.
const cors = require('cors');
const { orgCorsOptions } = require('../config/cors');
router.options('/:userId', cors(orgCorsOptions)); // explicit preflight response
router.delete(
'/:userId',
cors(orgCorsOptions), // explicit allowlist — not wildcard
requireSession,
requireOrgAdmin,
verifyCsrfToken,
async (req, res) => {
const { id: orgId, userId } = req.params;
const org = await db.orgs.findById(orgId);
if (org.ownerId === userId) {
return res.status(422).json({ error: 'Cannot remove org owner' });
}
if (!org.members.includes(userId)) {
return res.status(404).json({ error: 'Member not found' });
}
await db.orgMembers.remove({ orgId, userId });
// Audit log: who removed whom, from which IP, at what time
await db.orgAudit.create({
orgId,
action: 'member_removed',
targetUserId: userId,
actorId: req.session.userId,
ip: req.ip,
at: new Date(),
});
res.json({ ok: true });
}
);
CVSS 3.1 approximate score for CORS27-003: 7.1 (HIGH) — AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L. An attacker who removes all members except themselves (after CORS27-002 gains them membership) achieves full org isolation of legitimate users. The availability impact is low-to-medium depending on how many sessions the removed members had active.
CORS27-004 — Wildcard ACAO on org transfer POST
The org transfer endpoint POST /api/orgs/:id/transfer was implemented as a low-usage administrative action, run infrequently and typically by org owners migrating billing accounts. The endpoint sends an email confirmation to the current owner and immediately transfers ownership in the database. The CORS configuration was copied from a public, read-only analytics endpoint and was never reviewed for the transfer endpoint specifically — leaving ACAO: * on a one-step ownership transfer that has no confirmation token or out-of-band verification.
An attacker page that loads while a victim org owner is logged in can silently POST to the transfer endpoint with newOwnerId set to the attacker's user ID. Because the endpoint uses ACAO: *, the browser's preflight approval covers any origin — and because transfer is a state-changing POST, the new owner is recorded in the database before the browser evaluates whether to surface the response. The original owner receives a "you have transferred your org" email after the fact. The attacker now controls the org, all published skills, the billing relationship, and all audit history.
// CORS27-004 — VULNERABLE
// ACAO:* copied from a public analytics endpoint, never reviewed for transfer.
// One-step transfer with no email confirmation token — attacker POST fires immediately.
// No CSRF token required.
// orgs/transfer.js
router.post(
'/:id/transfer',
async (req, res) => {
res.header('Access-Control-Allow-Origin', '*'); // VULNERABLE: copied from public endpoint
res.header('Vary', 'Origin');
const session = await requireSession(req);
if (!session) return res.status(401).json({ error: 'Unauthorized' });
const org = await db.orgs.findById(req.params.id);
if (org.ownerId !== session.userId) {
return res.status(403).json({ error: 'Only org owner can transfer' });
}
const { newOwnerId } = req.body;
await db.orgs.update(org.id, { ownerId: newOwnerId });
await email.sendTransferConfirmation({ to: org.billingEmail, newOwnerId });
res.json({ ok: true, newOwnerId });
}
);
Org transfer is irreversible by the original owner: Once ownership is transferred, the victim loses the ability to transfer back — they are no longer the org owner and no longer have transfer permissions. Recovery requires contacting support, verifying identity out-of-band, and manual database intervention. For organizations with active Stripe subscriptions, the billing relationship also transfers, meaning the attacker can drain the payment method on file before the victim completes the recovery process.
// CORS27-004 — FIXED
// 1. Replace ACAO:* with explicit allowlist.
// 2. Two-step transfer: initial POST creates a pending transfer token (emailed to owner).
// 3. Final confirmation requires the owner to click the email link with the token.
// 4. CSRF token on both steps.
// 5. Transfer token expires after 1 hour.
const cors = require('cors');
const { orgCorsOptions } = require('../config/cors');
const crypto = require('crypto');
// Step 1: initiate transfer (creates pending transfer, emails token)
router.post(
'/:id/transfer',
cors(orgCorsOptions), // explicit allowlist
requireSession,
requireOrgOwner,
verifyCsrfToken,
async (req, res) => {
const { newOwnerId } = req.body;
// Verify new owner exists and is a current org member
const org = await db.orgs.findById(req.params.id);
if (!org.members.includes(newOwnerId)) {
return res.status(422).json({ error: 'New owner must be an existing org member' });
}
const confirmToken = crypto.randomBytes(32).toString('hex');
await db.pendingTransfers.create({
orgId: org.id,
fromOwnerId: req.session.userId,
newOwnerId,
token: confirmToken,
expiresAt: new Date(Date.now() + 60 * 60 * 1000), // 1 hour
});
await email.sendTransferConfirmation({
to: org.billingEmail,
orgName: org.name,
newOwnerId,
confirmUrl: `https://skillaudit.dev/orgs/${org.id}/transfer/confirm?token=${confirmToken}`,
});
res.json({ ok: true, message: 'Transfer confirmation email sent' });
}
);
// Step 2: confirm transfer (requires clicking email link — not cross-origin accessible)
// This endpoint deliberately has NO CORS — it must only be called from a full page navigation
// (the email link), not from a cross-origin fetch().
router.get(
'/:id/transfer/confirm',
requireSession,
async (req, res) => {
const { token } = req.query;
const pending = await db.pendingTransfers.findByToken(token);
if (!pending || pending.expiresAt < new Date() || pending.orgId !== req.params.id) {
return res.status(400).send('Invalid or expired transfer token');
}
if (pending.fromOwnerId !== req.session.userId) {
return res.status(403).send('Token does not match current session');
}
await db.orgs.update(pending.orgId, { ownerId: pending.newOwnerId });
await db.pendingTransfers.delete(pending.id);
await db.orgAudit.create({ orgId: pending.orgId, action: 'ownership_transferred', actorId: req.session.userId });
res.redirect(`/orgs/${pending.orgId}?transferred=1`);
}
);
Why the confirmation endpoint has no CORS: The confirmation step is deliberately not cross-origin accessible. By omitting all CORS headers from the GET /transfer/confirm endpoint, the browser will block any cross-origin fetch() attempt to read the confirmation response — and because the endpoint only commits the transfer on a full page navigation from the emailed link, an attacker cannot trigger it without the confirmation token that was sent to the original owner's email address. The two-step design means that even if an attacker somehow predicts the pending transfer token, they would need to navigate the victim's browser to the confirmation URL while the victim is logged in — a significantly higher bar than a simple CSRF.
CVSS 3.1 approximate score for CORS27-004: 8.8 (HIGH) — AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H. All three impact dimensions are high: the attacker gains full access to the org's skills and audit history (confidentiality), can modify or delete all org content (integrity), and locks the legitimate owner out of their own org (availability).
Compound attack chain: billing recon → org join → ownership transfer
The three state-changing misconfigurations in CORS27 compose into a fully automated organizational takeover chain that requires the victim admin to visit a single attacker-controlled page. The chain exploits each finding in sequence, using data gathered in earlier steps to satisfy the authorization checks in later ones.
GET /api/orgs/TARGET_ORG_ID with victim admin cookies. Response returns billing email and Stripe customer ID. Attacker records stripeCustomerId for later use and uses billingEmail to construct convincing phishing as a fallback channel./api/orgs/TARGET_ORG_ID/invitations with email=attacker@evil.com&role=admin. Simple-request fires with victim's session cookie. Attacker receives an org invitation email and accepts it — gaining org admin membership./api/orgs/TARGET_ORG_ID/transfer with newOwnerId=ATTACKER_USER_ID. The wildcard ACAO means the browser approves the preflight from any origin. Org ownership transfers to attacker account.The elegance of this chain from the attacker's perspective is that steps 1 and 2 require only a single page visit by the victim admin, and step 3 can be executed later from the attacker's own session after accepting the invitation. The victim admin does not need to stay on the attacker page for step 3 to succeed — the state from step 2 persists until the attacker acts on it.
Detection with AST queries
SkillAudit detects all four CORS27 patterns using static analysis across the Node.js and Express codebase. The queries target the specific implementation patterns that produce each vulnerability class.
; CORS27-001 — Detect cors({origin:true}) — reflects all origins
; tree-sitter query for JavaScript
(call_expression
function: (identifier) @fn (#eq? @fn "cors")
arguments: (arguments
(object
(pair
key: (property_identifier) @key (#eq? @key "origin")
value: (true) @val))))
; CORS27-002 — Detect routes missing cors() middleware entirely
; SkillAudit performs a cross-router analysis: for each POST route that modifies
; org membership, it checks whether any ancestor middleware includes a cors() call.
; Routes that reach requireSession without passing through cors() are flagged.
(call_expression
function: (member_expression
object: (identifier) @router
property: (property_identifier) @method (#match? @method "^(post|put|patch|delete)$"))
arguments: (arguments
(string) @path (#match? @path "/invitations|/members|/transfer")
.
(identifier) @first_mw (#not-eq? @first_mw "cors")))
; CORS27-003 and CORS27-004 — Detect wildcard ACAO on non-GET routes
(call_expression
function: (member_expression
object: (identifier) @res (#eq? @res "res")
property: (property_identifier) @method
(#match? @method "^(header|setHeader|set)$"))
arguments: (arguments
(string) @header_name
(#match? @header_name "(?i)access-control-allow-origin")
(string) @header_value
(#eq? @header_value "*")))
; Supplementary: detect res.header/res.setHeader ACAO:* inside DELETE/POST route handlers
; SkillAudit walks up the AST to verify the enclosing route method is not GET/HEAD/OPTIONS
; before flagging — avoiding false positives on static asset routes.
Beyond AST queries, SkillAudit's dynamic CORS probe fires four test requests against each org-management endpoint: a cross-origin preflight from an unlisted origin, a cross-origin simple-request POST with application/x-www-form-urlencoded, a credentialed fetch with credentials:include from a sandboxed origin, and a DELETE with a spoofed Origin header. Any response that includes an ACAO header permitting the probe origin on a credentialed or mutation request is immediately flagged for human review. See SA-SKL-CORS26 and SA-SKL-CORS25 for related CORS patterns in audit delivery and webhook endpoints.
Summary and checklist
| Finding | Pattern | Impact | Fix |
|---|---|---|---|
| CORS27-001 | cors({origin:true,credentials:true}) on org settings GET | Billing email + Stripe ID read cross-origin | Explicit Set-based allowlist; strip billing fields from CORS-accessible response |
| CORS27-002 | No CORS on invitation POST; form-encoded body | Attacker joins org, seat fraud billing | Explicit allowlist; require JSON (force preflight); CSRF token; rate limit |
| CORS27-003 | ACAO: * on member removal DELETE | Cross-origin mass member removal | Explicit allowlist; OPTIONS preflight handler; CSRF token; audit log |
| CORS27-004 | ACAO: * on org transfer POST | Cross-origin org ownership theft | Explicit allowlist; two-step transfer with email confirmation token; no CORS on confirmation step |
- Never use
cors({origin:true})— it reflects all origins and is equivalent to wildcard for credentialed requests. - Maintain a single
ALLOWED_ORIGINSSet imported by all routers; do not duplicate the allowlist. - Apply
cors()explicitly in every sub-router; do not rely on parentapp.use()middleware for sub-router coverage. - Require
application/jsonon all mutation endpoints; rejectapplication/x-www-form-urlencodedto eliminate simple-request gaps. - Add
router.options('*', cors(options))to handle preflights explicitly; do not rely on the cors middleware's implicit preflight handling. - Never set
ACAO: *on mutation endpoints (POST, PUT, PATCH, DELETE) — wildcard on mutations sends the request before the browser can block the response. - Add CSRF token verification to all state-changing org endpoints as defence-in-depth behind CORS.
- Implement two-step confirmation (email token) for irreversible high-impact actions (ownership transfer, org deletion).
- Strip financially sensitive fields (Stripe IDs, billing emails) from CORS-accessible API responses; serve them from server-side-only routes with no CORS headers.
- Log all org membership changes (invitations, removals, transfers) to an org audit trail with actor ID, target ID, IP address, and timestamp.
Related findings: SA-SKL-CORS26 (audit submission and result delivery CORS), SA-SKL-CORS25 (webhook registration and event subscription CORS), SA-SKL-PRIVESC10 (API key management and service account privilege escalation). Run SkillAudit on your MCP skill registry to surface all four CORS27 patterns alongside the full SA-SKL catalog of injection, deserialization, SSRF, and privilege escalation findings.