CORS Misconfigurations in MCP Skill Registry Skill Permission and Access Control Delegation Endpoints
Permission delegation endpoints are among the most sensitive surfaces in any MCP skill registry — they govern which principals can act on a skill, what override tokens exist, and which service accounts hold elevated access. When CORS is misconfigured on these routes, an attacker can exfiltrate the full delegation chain and permission override tokens, create rogue delegatees with elevated access, probe the permission history of arbitrary organisations via a timing oracle, and revoke authorised integrations entirely — all from a single malicious web page visited by a victim admin. Advisory SA-SKL-CORS47 details four distinct vulnerabilities that together form a compound four-stage attack chain capable of achieving persistent, covert privilege escalation across the registry.
In this post
- Why permission delegation endpoints are a CORS blind spot
- CORS47-001 — Credential-bearing CORS on permission config exposes delegation chains and permission override tokens
- CORS47-002 — Wildcard ACAO on delegation creation enables delegation quota exhaustion and elevated access grants
- CORS47-003 — Timing oracle on permission history endpoint enumerates recently-modified permission structures
- CORS47-004 — Credential-bearing CORS on delegation deletion disrupts authorized integrations and service account access
- Compound permission control attack chain
- Detection with SkillAudit AST queries
- Summary and remediation checklist
GET /api/skills/:id/permissions allows any origin with credentials to read the full permission configuration, including delegated role assignments, permission override tokens, and trust delegation chains
POST /api/skills/:id/permissions/delegate returns Access-Control-Allow-Origin: *, letting any page create permission delegations and grant attacker-controlled delegatees elevated access to victim skills
GET /api/skills/:id/permissions/history reflects Origin before ownership check, creating a timing oracle that reveals permission change history existence across all organisations
DELETE /api/skills/:id/permissions/:permissionId allows any origin with credentials to revoke any permission delegation using a victim admin session, disrupting authorised integrations and service account access
Why permission delegation endpoints are a CORS blind spot
When teams audit their MCP skill registry for CORS misconfigurations, they typically focus on the most visible surfaces — the skill listing endpoint, the metadata API, the deployment webhook. Permission delegation routes sit deeper in the product hierarchy and often receive less scrutiny. This is partly an organisational problem: the engineers who built the CORS middleware for public-facing endpoints may not be the same engineers who added delegation support several sprints later, and policy enforcement tends to drift between ownership boundaries.
Permission delegation endpoints are architecturally different from most registry routes. They are almost universally authenticated, almost universally admin-scoped, and they carry a category of sensitive data that most teams do not think of as exfiltration targets: permission override tokens. These tokens exist so that automated pipelines and service accounts can bypass the standard role-enforcement stack in controlled circumstances. They are, by design, powerful. When they leak they can be replayed directly, without any browser credential — the CORS vulnerability that exposes them becomes a stepping stone to fully automated exploitation far beyond the web origin model.
The four findings in SA-SKL-CORS47 follow a pattern we have observed repeatedly in audit engagements: a team applies a broad cors({origin:true,credentials:true}) helper at the router level, then adds new sub-routes incrementally without evaluating whether each one deserves that policy. The result is that the most sensitive routes in the registry inherit the most permissive CORS configuration.
CORS47-001 — Credential-bearing CORS on permission config exposes delegation chains and permission override tokens
Severity: CRITICAL
The GET /api/skills/:id/permissions endpoint is configured with cors({origin:true,credentials:true}). The origin:true option in the popular cors npm package is shorthand for reflecting whatever Origin header the browser sends back as Access-Control-Allow-Origin, and pairing this with credentials:true means Access-Control-Allow-Credentials: true is also returned. The browser then permits cross-origin JavaScript to read the full response body using the victim's session cookie.
The response body for this endpoint includes the complete permission configuration object: role assignments, delegated access entries keyed to external principals, and critically, permission override tokens. These tokens are issued for CI/CD pipelines and service accounts and are intended to be treated with the same confidentiality as API keys. The endpoint returns them in plaintext with no redaction for callers that do not need them.
An attacker who can induce a victim admin to visit a malicious web page can silently fetch this endpoint, extract the override tokens, and exfiltrate the full trust delegation chain — all without any visible browser prompt or user interaction beyond page load.
// routes/skills/permissions.js
const cors = require('cors');
const router = require('express').Router();
// Broad cors helper applied at the router level — all sub-routes inherit it
router.use(cors({ origin: true, credentials: true }));
// GET /api/skills/:id/permissions
// Returns full permission config including override tokens and delegation chain
router.get('/:id/permissions', requireSession, async (req, res) => {
const skill = await Skill.findById(req.params.id);
if (!skill) return res.status(404).json({ error: 'Not found' });
const perms = await PermissionConfig.findOne({ skillId: skill.id })
.populate('delegations')
.populate('roleAssignments');
// Entire document returned — override tokens included
return res.json(perms);
});
// routes/skills/permissions.js
const cors = require('cors');
const router = require('express').Router();
// Allowlist enforced per-route — no catch-all cors() at router level
const permissionsCors = cors({
origin: (origin, cb) => {
const allowed = process.env.CORS_ALLOWLIST?.split(',') ?? [];
if (!origin || allowed.includes(origin)) return cb(null, true);
cb(new Error('Origin not permitted'));
},
credentials: true,
});
// GET /api/skills/:id/permissions
router.get('/:id/permissions', permissionsCors, requireSession, requireOwnership, async (req, res) => {
const skill = await Skill.findById(req.params.id);
if (!skill) return res.status(404).json({ error: 'Not found' });
const perms = await PermissionConfig.findOne({ skillId: skill.id })
.populate('delegations')
.populate('roleAssignments');
// Override tokens are write-only — never returned in GET responses
const publicView = {
skillId: perms.skillId,
roleAssignments: perms.roleAssignments.map(r => ({
principal: r.principal,
role: r.role,
grantedAt: r.grantedAt,
})),
delegations: perms.delegations.map(d => ({
delegateeId: d.delegateeId,
scope: d.scope,
expiresAt: d.expiresAt,
})),
// overrideTokens intentionally omitted — treat as write-only
overrideTokenCount: perms.overrideTokens?.length ?? 0,
};
return res.json(publicView);
});
Override tokens are not passwords. Unlike passwords, override tokens are not hashed — they are raw bearer credentials used directly in Authorization headers by CI/CD pipelines. Returning them in a GET response means any CORS misconfiguration, logging middleware, or response cache that is ever introduced will immediately expose them. Treat override tokens as write-only: allow creation and rotation, never return them after initial issuance.
CORS47-002 — Wildcard ACAO on delegation creation enables delegation quota exhaustion and elevated access grants
Severity: HIGH
The POST /api/skills/:id/permissions/delegate endpoint returns Access-Control-Allow-Origin: * — a wildcard. At first glance this appears safe: the browser will not send cookies with a wildcard ACAO response, so the victim session cannot be attached. However, this endpoint makes two critical mistakes that override this assumption.
First, the endpoint does not enforce a session requirement. Any request — authenticated or not — that specifies a delegateeId and a scope will be processed. This means an attacker can create delegations for attacker-controlled principals without needing the victim's session at all, as long as they can supply a valid skill ID. Second, there is no CSRF token check and no role gate. Any origin can fire a cross-origin POST with a JSON body and receive a successful delegation response.
The practical impact is two-pronged. An attacker can exhaust the delegation quota for a target skill, rendering it unable to accept legitimate delegations. More seriously, they can grant their own principal elevated access to the victim's skill — read, write, or execute scope depending on what the endpoint accepts.
The fix removes the wildcard, requires a valid session, adds a CSRF token requirement, gates the route behind requireRole('admin'), and validates the requested delegatee against the organisation's member list to prevent delegation to arbitrary external principals.
Wildcard ACAO is not a session guard. The assumption that ACAO: * is safe because cookies are blocked is undermined whenever: (a) the endpoint does not require authentication, (b) the attacker already holds a valid token obtained through another vulnerability, or (c) the endpoint accepts non-credential request patterns. Always require session authentication independently of the CORS policy.
CORS47-003 — Timing oracle on permission history endpoint enumerates recently-modified permission structures
Severity: MEDIUM
The GET /api/skills/:id/permissions/history endpoint reflects the Origin header back in Access-Control-Allow-Origin before it performs any ownership or authentication check. This sequencing creates a timing oracle.
When a cross-origin request arrives for a skill ID that exists and has recent permission history, the server queries the permission history table, finds rows, and then evaluates ownership. The query itself takes measurable time — typically 15–40 ms longer than for a skill with no history. When a request arrives for a skill that does not exist or has no history, the ownership check short-circuits after a fast index lookup. The difference in response latency is detectable cross-origin because the browser does not block timing information for cross-origin requests, only response body reads.
This means an attacker can iterate over skill IDs, measuring response latency for each, and compile a list of skills that have recently had their permissions modified. These skills are the most valuable targets for CORS47-001: they are more likely to have active delegations, freshly issued override tokens, and updated trust chains. The timing oracle turns CORS47-003 from a medium-severity standalone finding into a force multiplier for the compound chain.
The correct fix is threefold: perform authentication and ownership checks before any CORS header emission; use a single WHERE skillId = ? AND ownerId = ? clause so that ownership and existence checks hit the same query path; and normalise 403 and 404 response latencies with a constant-time response function so that the distinction between "skill not found", "not your skill", and "no history" is indistinguishable from the caller's perspective.
CORS47-004 — Credential-bearing CORS on delegation deletion disrupts authorized integrations and service account access
Severity: CRITICAL
The DELETE /api/skills/:id/permissions/:permissionId endpoint shares the same cors({origin:true,credentials:true}) policy as the GET endpoint described in CORS47-001. Any web page can instruct the victim admin's browser to issue an authenticated DELETE request against any permission ID in the registry, not just those belonging to the victim's skills. There is no ownership check: if you know the permission ID UUID, you can delete it.
The practical impact of a successful exploit is service disruption. Authorised integrations lose their access instantly. Service accounts that depend on specific delegations begin failing silently. CI/CD pipelines that use override tokens tied to the deleted permission records start returning 403s on deployments. In an incident-response scenario, this is particularly damaging: an attacker who has already used CORS47-001 and CORS47-002 to establish rogue access can then use CORS47-004 to revoke the legitimate delegations that security teams would otherwise use to audit and roll back the intrusion.
// DELETE /api/skills/:id/permissions/:permissionId
// No ownership check — any permission ID can be deleted
router.delete(
'/:id/permissions/:permissionId',
// cors({origin:true,credentials:true}) inherited from router.use() above
requireSession,
async (req, res) => {
const perm = await Permission.findById(req.params.permissionId);
if (!perm) return res.status(404).json({ error: 'Not found' });
await perm.deleteOne();
return res.status(204).end();
}
);
// DELETE /api/skills/:id/permissions/:permissionId
router.delete(
'/:id/permissions/:permissionId',
permissionsCors, // allowlist-based cors, not origin:true
requireSession,
requireRole('admin'),
async (req, res) => {
// Ownership check: skill must belong to the requesting org
const skill = await Skill.findOne({
_id: req.params.id,
orgId: req.session.orgId,
});
if (!skill) return res.status(404).json({ error: 'Not found' });
const perm = await Permission.findOne({
_id: req.params.permissionId,
skillId: skill._id, // permission must belong to this skill
});
if (!perm) return res.status(404).json({ error: 'Not found' });
// Identify affected services before deletion for notification
const affectedServices = perm.delegateeId
? await ServiceAccount.findOne({ principalId: perm.delegateeId })
: null;
await perm.deleteOne();
// Audit log entry
await AuditLog.create({
action: 'permission.deleted',
permissionId: perm._id,
skillId: skill._id,
actorId: req.session.userId,
timestamp: new Date(),
});
// Notify affected service account so it can alert its operators
if (affectedServices) {
await notifyServiceAccount(affectedServices, {
event: 'delegation.revoked',
skillId: skill._id,
permissionId: perm._id,
revokedAt: new Date(),
});
}
return res.status(204).end();
}
);
Deletion without notification is an availability vulnerability. When a permission delegation is revoked, every downstream service account or CI/CD pipeline that depended on it begins failing immediately. Without an explicit notification path, the impacted services have no way to distinguish an intentional revocation from an infrastructure fault, and operators may waste hours debugging a permissions issue that looks like a network outage. Build delegation revocation notifications into the data model, not as an afterthought.
Compound permission control attack chain
The four findings in SA-SKL-CORS47 are individually serious, but their real danger lies in how naturally they chain together. An attacker who understands the registry's permission model can execute all four stages from a single malicious page visit, with each stage feeding intelligence or capability into the next.
| Stage | Finding | What the attacker gains |
|---|---|---|
| 1. Reconnaissance | CORS47-003 | Timing oracle identifies skill IDs with recently-modified permission structures — the richest targets for stages 2 and 4 |
| 2. Credential exfiltration | CORS47-001 | Full permission config fetched for each identified target, including delegated role assignments, trust delegation chains, and permission override tokens in plaintext |
| 3. Privilege escalation | CORS47-002 | Attacker-controlled principal granted elevated access to target skills — either directly (no session required due to missing auth gate) or by replaying exfiltrated override tokens |
| 4. Incident response disruption | CORS47-004 | Legitimate delegations revoked using victim admin session, dismantling authorised integration access and destroying the permission state security teams would use to audit the intrusion |
The reconnaissance stage deserves extra attention. CORS47-003 on its own is rated Medium because it only reveals the existence of permission history, not its contents. But in the context of a compound attack its value is outsized: without it, an attacker targeting a large registry would need to probe hundreds of skill IDs blindly via CORS47-001, generating significant noise in access logs. With the timing oracle the attacker can pre-filter to the dozen or so skills that have had permissions modified in the last 48 hours — the exact window in which new service account delegations and override tokens are most likely to be active and not yet rotated.
The final stage — using CORS47-004 to revoke legitimate delegations after establishing rogue access — mirrors a tactic common to ransomware operations: locking out legitimate administrators at the moment of maximum leverage. In an MCP skill registry, this means the security team's first response to an alert is to discover that every tool they would normally use to roll back permissions has itself been invalidated.
Detection with SkillAudit AST queries
All four vulnerabilities in SA-SKL-CORS47 are detectable at the static analysis level using SkillAudit's AST query engine. The queries below target Express.js router patterns, but equivalent queries exist for Fastify, Hono, and Koa in the SkillAudit rule library.
Detecting credential-bearing reflected-origin CORS on sensitive routes (CORS47-001, CORS47-004):
// SkillAudit AST query — detects cors({origin:true,credentials:true}) on router.use() or
// any sub-route where the router handles permission or delegation paths
skill.query.cors.reflectCredentials({
routePattern: /\/permissions(\/|$)/,
corsOptions: { origin: true, credentials: true },
flag: 'CORS47-REFLECT-CRED-PERMISSIONS'
})
Detecting wildcard ACAO on mutation routes under permission namespaces (CORS47-002):
// SkillAudit AST query — detects explicit ACAO:* header on POST/PUT/PATCH/DELETE routes
// under /permissions/* paths
skill.query.cors.wildcardOnMutation({
routePattern: /\/permissions\//,
methods: ['POST', 'PUT', 'PATCH', 'DELETE'],
flag: 'CORS47-WILDCARD-MUTATION-PERMISSIONS'
})
Detecting CORS emission before auth/ownership check (CORS47-003):
// SkillAudit AST query — detects handler middleware order where cors() precedes
// requireSession, requireOwnership, or any ownership WHERE clause construction
skill.query.cors.headerBeforeAuth({
routePattern: /\/permissions\/history/,
authMiddleware: ['requireSession', 'requireOwnership', 'requireRole'],
flag: 'CORS47-CORS-BEFORE-AUTH-HISTORY'
})
These queries run as part of every SkillAudit pull-request scan. When a match is found, the finding is surfaced inline in the PR diff with a severity label, a link to the relevant advisory, and a suggested fix. Teams integrating SkillAudit typically catch regressions of this type within minutes of the offending commit landing, rather than discovering them through a manual penetration test months later.
Summary and remediation checklist
CORS misconfigurations on permission delegation endpoints are some of the highest-impact findings in the MCP registry threat model. Unlike misconfigurations on read-only public endpoints, they enable write operations (delegation creation, delegation revocation), expose bearer credentials (override tokens), and can be chained into multi-stage attacks that persist long after the initial exploit. The remediation steps are well-defined but require discipline across the entire permission route namespace.
| Finding | Severity | Primary remediation | Secondary hardening |
|---|---|---|---|
| CORS47-001 | Critical | Replace origin:true with an explicit allowlist; add requireSession and requireOwnership |
Remove override tokens from GET responses entirely; return only overrideTokenCount |
| CORS47-002 | High | Remove ACAO: *; require session, CSRF token, and requireRole('admin') |
Validate delegatee against org member list; enforce per-skill delegation quota |
| CORS47-003 | Medium | Authenticate and check ownership before emitting any CORS header | Unified WHERE clause; constant-time 403/404 latency normalisation |
| CORS47-004 | Critical | Replace origin:true with allowlist; add requireRole('admin') and ownership check |
Audit log every deletion; notify affected service accounts synchronously |
Across all four findings, the same underlying principle applies: CORS policy must be evaluated per-route and per-sensitivity, not applied wholesale at the router level and inherited downward. Permission endpoints operate under fundamentally different trust requirements than the public skill discovery endpoints that sit beside them in the same codebase. Treat the permission namespace as a separate security boundary, enforce authentication independently of the CORS configuration, and never assume that a wildcard or reflected-origin policy is safe because the endpoint is "admin-only" in the team's mental model but not in the actual middleware stack.
Find CORS misconfigurations like these before attackers do. SkillAudit's free tier scans your MCP skill registry for all four patterns described in SA-SKL-CORS47 — plus the broader CORS47 advisory series covering version release management, CI/CD pipeline integration, and access control delegation. Connect your repository at skillaudit.dev and get your first scan in under five minutes. For the full technical disclosure, see the SA-SKL-CORS47 advisory. For related findings in adjacent endpoint groups, see the SA-SKL-CORS46 version release advisory and the SA-SKL-CORS45 CI/CD pipeline blog post.