Claude MCP skill CORS misconfiguration — audit scheduling and recurring scan configuration endpoints
SA-SKL-CORS33 documents four CORS vulnerabilities in MCP skill registry audit scheduling and recurring scan configuration endpoints. Credential-bearing CORS on the schedule-list endpoint leaks all scheduled audit configs cross-origin, wildcard ACAO on the creation endpoint enables unlimited quota-draining schedule creation from any page, Origin reflection on the toggle endpoint acts as a schedule-existence oracle, and credential-bearing CORS on the history endpoint exposes full vulnerability trend data to any origin.
cors({origin:true,credentials:true}); any origin reads all scheduled audit configs including frequency, target repos, and notification emails using victim session
ACAO:*; attacker page creates unlimited scheduled audits on victim account cross-origin, consuming scan quota silently
cors({origin:true,credentials:true}); any origin reads full vulnerability trend history for victim's recurring scans cross-origin
CORS33-001 (Critical): Credential-bearing CORS on schedule-list endpoint leaks full audit configuration
MCP skill registry audit scheduling systems maintain a database of recurring scan configurations: which repositories to audit, at what frequency, which notification email addresses to alert on findings, and which severity thresholds to apply. The schedule-list endpoint GET /api/schedules is intended for the authenticated account owner to retrieve their own configuration. When this endpoint is configured with cors({origin:true,credentials:true}) — which dynamically echoes any supplied Origin value as Access-Control-Allow-Origin while simultaneously setting Access-Control-Allow-Credentials: true — any page on the web can issue a credentialed cross-origin request and read the full response using the victim's browser session.
The practical scope of data exposed per victim includes: a complete inventory of all monitored repositories (including private ones), the notification email addresses registered for security alerts, the scan cadence and frequency for each target, any custom severity filters or exclusion lists, and internal schedule identifiers that enable subsequent targeted attacks against individual schedule entries. This information is valuable for competitive intelligence, targeted phishing (using the notification email addresses), and reconnaissance for follow-on attacks against the scheduling system itself. The attack requires only that the victim visits a single attacker-controlled page while authenticated to the registry.
// VULNERABLE — schedule list endpoint uses cors({origin:true,credentials:true})
// File: routes/schedules.js
const cors = require('cors');
const router = require('express').Router();
// VULNERABILITY: origin:true reflects any Origin header; credentials:true allows cookies
// Combined effect: any attacker page can read this authenticated endpoint cross-origin
router.get('/schedules', cors({ origin: true, credentials: true }), authenticate, async (req, res) => {
const userId = req.user.sub;
const { rows } = await db.query(
`SELECT id, repo_url, scan_frequency, notify_emails, severity_filter, enabled
FROM audit_schedules
WHERE user_id = $1
ORDER BY created_at DESC`,
[userId]
);
res.json({ schedules: rows });
});
Fix: Replace cors({origin:true,credentials:true}) with an explicit allowlist of trusted origins (origin: ['https://skillaudit.dev']). Never pair credentials:true with origin:true or origin:'*' — both configurations cause the browser to send and read cookies across any origin. If cross-origin access to schedules is genuinely needed by a known partner, enumerate those origins explicitly. For endpoints that serve only the first-party frontend, omit the CORS middleware entirely and rely on the same-origin policy as the natural boundary.
// FIXED — explicit origin allowlist; credentials only for trusted origins
// File: routes/schedules.js
const cors = require('cors');
const router = require('express').Router();
const scheduleCors = cors({
origin: ['https://skillaudit.dev'], // explicit allowlist; no wildcard
credentials: true, // safe only because origin is not '*' or dynamic
});
router.get('/schedules', scheduleCors, authenticate, async (req, res) => {
const userId = req.user.sub;
const { rows } = await db.query(
`SELECT id, repo_url, scan_frequency, notify_emails, severity_filter, enabled
FROM audit_schedules
WHERE user_id = $1
ORDER BY created_at DESC`,
[userId]
);
res.json({ schedules: rows });
});
CORS33-002 (High): Wildcard ACAO on schedule-creation endpoint enables cross-origin quota drain
The schedule-creation endpoint POST /api/schedules allows authenticated users to register new recurring audit targets. When this endpoint responds with Access-Control-Allow-Origin: *, simple cross-origin POST requests (using application/x-www-form-urlencoded or text/plain content types) can be issued from any attacker page without triggering a preflight check. While the wildcard header does not permit cookies to accompany simple requests, many MCP registry implementations also accept authentication via a Bearer token stored in localStorage — a credential type that JavaScript on any origin can read and forward in a cross-origin request without restriction.
An attacker who tricks a logged-in victim into visiting a malicious page can silently create hundreds of scheduled audit entries targeting arbitrary repositories, consuming the victim's scan quota entirely. The attacker constructs the schedule with a notification email pointing to their own inbox — receiving security findings for the victim's repositories on an ongoing basis. Because scan quota is a metered resource with per-tier caps, draining it prevents legitimate security monitoring for the account holder and can trigger unexpected overage billing on paid tiers. The attack is silent: no browser security prompt appears and no interaction beyond the page visit is required.
// VULNERABLE — schedule creation endpoint serves ACAO:* allowing cross-origin POST
// File: routes/schedules.js
// VULNERABILITY: wildcard ACAO on write endpoint; combined with Bearer token in
// localStorage enables cross-origin schedule creation without preflight
router.post('/schedules',
(req, res, next) => { res.setHeader('Access-Control-Allow-Origin', '*'); next(); },
authenticate,
async (req, res) => {
const userId = req.user.sub;
const { repoUrl, frequency, notifyEmails, severityFilter } = req.body;
const { rows } = await db.query(
`INSERT INTO audit_schedules (user_id, repo_url, scan_frequency, notify_emails, severity_filter)
VALUES ($1, $2, $3, $4, $5) RETURNING id`,
[userId, repoUrl, frequency, notifyEmails, severityFilter]
);
res.status(201).json({ id: rows[0].id });
}
);
Fix: Remove the Access-Control-Allow-Origin: * header from write endpoints entirely. Write operations that modify account state should require a preflight check — the default same-origin policy enforces this for application/json requests when no permissive CORS header is present. If cross-origin write access is genuinely required, use an explicit origin allowlist with credentials:true (never origin:* with credentials). Additionally, ensure authentication relies on HttpOnly cookies rather than localStorage tokens, which are readable by any script on any origin.
// FIXED — no ACAO on write endpoint; requires same-origin or explicit allowlist
// File: routes/schedules.js
// No cors() middleware: write endpoints default to same-origin policy
// CORS preflight (OPTIONS) is handled globally for the API with strict allowlist
router.post('/schedules', authenticate, validateScheduleInput, async (req, res) => {
const userId = req.user.sub;
const { repoUrl, frequency, notifyEmails, severityFilter } = req.body;
// Rate-limit schedule creation per account to prevent quota drain
const count = await getScheduleCount(userId);
const planLimit = (await getPlanConfig(userId)).maxSchedules;
if (count >= planLimit) {
return res.status(429).json({ error: 'Schedule limit reached for your plan' });
}
const { rows } = await db.query(
`INSERT INTO audit_schedules (user_id, repo_url, scan_frequency, notify_emails, severity_filter)
VALUES ($1, $2, $3, $4, $5) RETURNING id`,
[userId, repoUrl, frequency, notifyEmails, severityFilter]
);
res.status(201).json({ id: rows[0].id });
});
CORS33-003 (Medium): Origin reflection timing oracle on schedule-toggle reveals schedule ID existence
The schedule enable/disable endpoint PATCH /api/schedules/:id/toggle reflects the incoming Origin header as Access-Control-Allow-Origin before performing an ownership check. This ordering means that the CORS reflection — and therefore the browser's decision to allow the cross-origin JavaScript to read the response — occurs unconditionally, regardless of whether the target schedule exists or belongs to the authenticated user. The subsequent ownership check introduces a measurable timing difference: a request targeting an owned schedule reaches the database, performs a read, and returns a 200; a request targeting a non-existent schedule returns a 404 immediately with no database round-trip; a request targeting a schedule owned by another user returns a 403 after a database lookup.
An attacker with knowledge of schedule ID format can enumerate the schedule ID space by measuring these response-time differences from a cross-origin page. Because the Origin is reflected unconditionally, the attacker's JavaScript can read response headers (including timing-sensitive ones) even without reading the response body. The oracle reveals: which schedule IDs are valid in the system, which belong to the attacker's account, and by inference which belong to other accounts — establishing a schedule ID inventory useful for targeting the credential-bearing CORS33-001 and CORS33-004 vulnerabilities against specific victim IDs.
// VULNERABLE — Origin reflected before ownership check; timing oracle
// File: routes/schedules.js
router.patch('/schedules/:id/toggle', (req, res, next) => {
// VULNERABILITY: CORS reflection happens unconditionally before auth/ownership
// Timing difference between 404 (no DB) and 403 (DB lookup) leaks ID existence
res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*');
res.setHeader('Access-Control-Allow-Credentials', 'true');
next();
}, authenticate, async (req, res) => {
const { id } = req.params;
const userId = req.user.sub;
const { rows } = await db.query(
'SELECT user_id, enabled FROM audit_schedules WHERE id = $1',
[id]
);
if (!rows.length) return res.status(404).json({ error: 'Schedule not found' });
if (rows[0].user_id !== userId) return res.status(403).json({ error: 'Forbidden' });
const newEnabled = !rows[0].enabled;
await db.query('UPDATE audit_schedules SET enabled = $1 WHERE id = $2', [newEnabled, id]);
res.json({ id, enabled: newEnabled });
});
Fix: Apply CORS configuration globally via a middleware that runs after authentication and ownership verification, not before. CORS headers should never be emitted for requests that will subsequently be rejected — if the authenticated user does not own the resource, the response should be 403 with no CORS headers. This eliminates the oracle entirely because the browser will not deliver any response (including headers) to cross-origin JavaScript when ACAO is absent. Additionally, normalise error response timing using await db.query(... WHERE id = $1 AND user_id = $2) in a single query to remove the structural timing difference between 404 and 403 paths.
// FIXED — CORS applied only after ownership validated; unified query eliminates timing oracle
// File: routes/schedules.js
const scheduleCors = cors({ origin: ['https://skillaudit.dev'], credentials: true });
router.patch('/schedules/:id/toggle', authenticate, async (req, res) => {
const { id } = req.params;
const userId = req.user.sub;
// Single query: ownership check + data fetch atomically
// Returns no rows for both "not found" and "not owned" — eliminates timing oracle
const { rows } = await db.query(
'SELECT enabled FROM audit_schedules WHERE id = $1 AND user_id = $2',
[id, userId]
);
if (!rows.length) {
// No CORS header emitted for 403/404 — attacker page cannot read response
return res.status(403).json({ error: 'Forbidden' });
}
const newEnabled = !rows[0].enabled;
await db.query('UPDATE audit_schedules SET enabled = $1 WHERE id = $2 AND user_id = $3',
[newEnabled, id, userId]);
// CORS headers emitted only after successful ownership verification
scheduleCors(req, res, () => {});
res.json({ id, enabled: newEnabled });
});
CORS33-004 (Critical): Credential-bearing CORS on scan-history endpoint exposes vulnerability trend data
The recurring scan history endpoint GET /api/schedules/:id/history returns a time-series of vulnerability findings produced by each execution of a scheduled audit: dates of execution, severity breakdowns, newly introduced findings, and regression counts. This endpoint follows the same misconfiguration as CORS33-001 — cors({origin:true,credentials:true}) — meaning any attacker page can issue a credentialed cross-origin GET and read the complete scan history for any schedule ID accessible to the victim's session.
The data exposed through this endpoint is in many cases more sensitive than a single point-in-time audit result, because the trend data reveals the security posture trajectory of private repositories over time: when new vulnerabilities were introduced, which ones were left unpatched across multiple scan cycles, and which repositories showed no security improvement despite receiving repeated audit alerts. For a registry with a business or compliance use case, this trend data constitutes sensitive security intelligence that could be valuable to competitors or attackers targeting the monitored repositories. Combined with the schedule-list data from CORS33-001, an attacker can build a complete picture of a victim organisation's private repository security posture.
// VULNERABLE — scan history endpoint uses cors({origin:true,credentials:true})
// File: routes/schedules.js
// VULNERABILITY: same misconfiguration as CORS33-001 applied to history endpoint
// Any origin reads full vulnerability trend data for victim's scheduled scans
router.get('/schedules/:id/history',
cors({ origin: true, credentials: true }),
authenticate,
async (req, res) => {
const { id } = req.params;
const userId = req.user.sub;
// Note: missing ownership check — any authenticated user can read any schedule history
const { rows } = await db.query(
`SELECT executed_at, findings_count, severity_breakdown, new_findings, regressions
FROM schedule_run_history
WHERE schedule_id = $1
ORDER BY executed_at DESC
LIMIT 100`,
[id]
);
res.json({ scheduleId: id, history: rows });
}
);
Fix: Replace cors({origin:true,credentials:true}) with an explicit origin allowlist. Additionally, add an ownership check to the query — join against audit_schedules to confirm that the schedule belongs to the requesting user. The missing ownership check is a secondary vulnerability (broken object-level authorization) that the CORS misconfiguration exposes to cross-origin exploitation. Without the ownership check, even a correctly configured CORS policy does not prevent authenticated cross-account history reads from same-origin contexts.
// FIXED — explicit CORS allowlist + ownership check on history endpoint
// File: routes/schedules.js
const scheduleCors = cors({ origin: ['https://skillaudit.dev'], credentials: true });
router.get('/schedules/:id/history', scheduleCors, authenticate, async (req, res) => {
const { id } = req.params;
const userId = req.user.sub;
// Ownership check: JOIN ensures history is only readable by the schedule owner
const { rows } = await db.query(
`SELECT h.executed_at, h.findings_count, h.severity_breakdown, h.new_findings, h.regressions
FROM schedule_run_history h
JOIN audit_schedules s ON s.id = h.schedule_id
WHERE h.schedule_id = $1
AND s.user_id = $2 -- ownership enforced at query level
ORDER BY h.executed_at DESC
LIMIT 100`,
[id, userId]
);
if (!rows.length) return res.status(404).json({ error: 'Schedule not found' });
res.json({ scheduleId: id, history: rows });
});
Compound attack chain: schedule enumeration to full audit-posture exfiltration
The four CORS33 vulnerabilities compose into a complete cross-origin reconnaissance chain against a victim's MCP skill registry account, requiring only a single page visit with no additional interaction.
Phase 1 — ID enumeration (CORS33-003). The attacker's malicious page fires PATCH requests to sequentially numbered schedule IDs from a cross-origin context. The timing oracle from the Origin-reflection pattern distinguishes valid IDs from non-existent ones, building a list of active schedule IDs in the system. The attacker identifies IDs likely to belong to the victim's account using session-authenticated 200 responses.
Phase 2 — Configuration theft (CORS33-001). With the victim's session cookies present in the browser, the attacker page issues a credentialed GET to /api/schedules. The cors({origin:true,credentials:true}) configuration delivers the full schedule list including repository URLs, notification emails, frequencies, and severity filters. The attacker now has a complete map of the victim's monitored private repositories.
Phase 3 — Trend data exfiltration (CORS33-004). Using the schedule IDs from Phase 1, the attacker issues credentialed GETs to /api/schedules/:id/history for each identified ID. The same CORS misconfiguration delivers the full vulnerability trend history for each monitored repository — including unpatched findings, regression patterns, and security posture over time.
Phase 4 — Quota drain (CORS33-002). With full knowledge of the victim's monitoring configuration, the attacker creates hundreds of additional scheduled audits on the victim's account using the ACAO:* creation endpoint, draining the victim's scan quota and redirecting findings to attacker-controlled notification addresses for ongoing surveillance of the victim's repositories.
Chain severity: This four-phase chain requires no stored credentials, no account takeover, and no interaction beyond a single page visit. The combined data exposure spans repository inventories, security posture trends, notification email addresses, and ongoing scan results — constituting a near-complete intelligence picture of the victim's private repository security programme. Each individual CORS fix is straightforward; deploy them as a batch since the chain's power comes from their combination.
Detection with tree-sitter queries
The two highest-value patterns in this advisory are the cors({origin:true,credentials:true}) misconfiguration (CORS33-001, CORS33-004) and the Origin-reflection-before-auth ordering pattern (CORS33-003). The following tree-sitter queries identify both in Node.js codebases.
Query 1 — cors({origin:true}) with credentials. Matches cors() call expressions where the options object contains both an origin property with a truthy literal and a credentials property set to true. Every match is a potential credential-bearing CORS misconfiguration.
; tree-sitter query: cors({origin:true,credentials:true}) misconfiguration
; Matches: cors({ origin: true, credentials: true }) and similar patterns
(call_expression
function: (identifier) @fn (#eq? @fn "cors")
arguments: (arguments
(object
(pair
key: (property_identifier) @origin-key (#eq? @origin-key "origin")
value: (true) @origin-val
)
(pair
key: (property_identifier) @creds-key (#eq? @creds-key "credentials")
value: (true) @creds-val
)
)
)
) @finding
; Each @finding is a potential SA-SKL-CORS33-001 / CORS33-004 instance.
; Confirm: is this endpoint authenticated? Does it serve sensitive per-user data?
; Fix: replace origin:true with origin:['https://your-domain.com'] explicit list.
Query 2 — CORS header set before ownership check. Matches functions where a setHeader call with Access-Control-Allow-Origin precedes a database query that performs an ownership or existence check. This is the structural signature of CORS33-003.
; tree-sitter query: CORS header set before DB ownership check (CORS33-003)
; Matches: res.setHeader('Access-Control-Allow-Origin', ...) before db.query(...)
(function_declaration
body: (statement_block
(expression_statement
(call_expression
function: (member_expression
object: (identifier) @res (#match? @res "res")
property: (property_identifier) @method (#eq? @method "setHeader")
)
arguments: (arguments
(string) @header-name (#match? @header-name "Access-Control-Allow-Origin")
)
)
)
(variable_declaration
(variable_declarator
value: (await_expression
(call_expression
function: (member_expression
property: (property_identifier) @db-method (#eq? @db-method "query")
)
)
)
)
)
)
) @ordering-issue
; Each @ordering-issue: CORS header emitted before ownership/auth DB call.
; Fix: move CORS middleware to execute after authentication and ownership verification.
Summary
| ID | Severity | Surface | Root cause | Fix |
|---|---|---|---|---|
| CORS33-001 | Critical | GET /api/schedules — schedule list | cors({origin:true,credentials:true}) reflects any Origin with credential permission |
Explicit origin:['https://skillaudit.dev'] allowlist; never pair credentials:true with dynamic origin |
| CORS33-002 | High | POST /api/schedules — schedule creation | ACAO:* on write endpoint; Bearer token in localStorage crosses origin boundary |
Remove wildcard ACAO from write endpoints; require preflight; use HttpOnly cookie auth |
| CORS33-003 | Medium | PATCH /api/schedules/:id/toggle — toggle enable | Origin reflected unconditionally before ownership check; 404 vs 403 timing delta leaks ID existence | Apply CORS after ownership verification; unified WHERE id=$1 AND user_id=$2 eliminates timing oracle |
| CORS33-004 | Critical | GET /api/schedules/:id/history — scan history | cors({origin:true,credentials:true}) + missing ownership check on history endpoint |
Explicit origin allowlist; add JOIN audit_schedules ... WHERE user_id=$2 ownership filter |
Checklist for MCP skill registry operators: (1) Grep all route files for cors({ and audit every instance — flag any that use origin:true or origin:'*'. (2) Confirm that credentials:true is paired only with explicit string or array origin values. (3) Audit all CORS middleware placement — ensure it runs after authentication and ownership verification, never before. (4) Search for ACAO:* set on write endpoints (POST, PATCH, DELETE, PUT). (5) Review all endpoints that accept a resource ID parameter for missing ownership checks — CORS misconfigurations make missing ownership checks cross-origin exploitable. Use the tree-sitter queries above in CI to prevent regressions across the full SA-SKL-CORS series.