← Blog

CORS Misconfigurations in MCP Skill Registry Permission and Access Control Management Endpoints

Permission and access control management endpoints are the highest-privilege surface in any MCP skill registry. The permission map these routes serve contains durable override tokens issued for incident response that authenticate independently of the session store, role-to-permission bindings governing what each team member can do with a skill, and temporary elevated access grants created during on-call escalations. When CORS is misconfigured on these endpoints, an attacker can read all of these credentials in a single cross-origin request using the victim's browser session — capturing tokens that remain valid long after the victim logs out. They can inject attacker-controlled permission grants that the audit log attributes to the victim admin, not the attacker. They can identify which skills are under active permission change using a response-timing oracle before the CORS-credential-read phase. And they can silently revoke CI service account grants that break automated deployment pipelines for every skill the victim administers, with no notification sent to the access control owner. Advisory SA-SKL-CORS57 documents four distinct vulnerabilities across these endpoints that compose naturally into a compound four-stage privilege escalation and pipeline disruption chain, executable from a single malicious web page visited by any registry admin.

By SkillAudit  |  20 Nov 2026  |  25 min read

In this post

  1. Why permission and access control management endpoints are the highest-value CORS targets
  2. CORS57-001 — Credential-bearing CORS on permission map exposes override tokens and role bindings
  3. CORS57-002 — Wildcard ACAO on permission grant creation enables external privilege escalation under victim admin identity
  4. CORS57-003 — Timing oracle on permissions audit endpoint reveals active permission change targets
  5. CORS57-004 — Credential-bearing CORS on grant revocation breaks CI service accounts without notification
  6. Compound permission escalation and pipeline disruption chain
  7. Detection with SkillAudit AST queries
  8. Summary and remediation checklist
Advisory SA-SKL-CORS57 — Findings at a glance
Critical CORS57-001 — GET /api/skills/:id/permissions allows any origin with credentials to read the full permission map including per-user override tokens (durable credentials that bypass session-based auth enforcement), role-to-permission bindings, and temporary elevated access grants created during on-call escalations
Critical CORS57-002 — POST /api/skills/:id/permissions returns Access-Control-Allow-Origin: *, letting any page create attacker-controlled permission grants under victim admin identity — granting external attacker elevated access to private skills and admin-tier capabilities with the audit log attributing the grant to the victim
Medium CORS57-003 — GET /api/skills/:id/permissions/audit reflects Origin before ownership check, creating a timing oracle that reveals permission change velocity tiers — identifying skills undergoing active access control modifications as the highest-value CORS57-001 targets during live admin sessions
Critical CORS57-004 — DELETE /api/skills/:id/permissions/:grantId allows any origin with credentials to revoke any permission grant using a victim admin session — breaking CI service accounts and revoking access for legitimate users without any notification to the access control owner

Why permission and access control management endpoints are the highest-value CORS targets

Permission management endpoints differ from every other endpoint class in a skill registry in one critical way: the credentials they serve are not session-scoped. Session tokens expire when the user logs out. API keys rotate on a schedule. But the permission override tokens documented in SA-SKL-CORS57 are specifically designed to outlive sessions — they are issued during incident response, when an on-call engineer needs to perform administrative operations on a skill without navigating normal auth flows. This means that CORS-based exfiltration of a permission map is not equivalent to reading a session-scoped secret. It is reading a secret that will remain valid across reboots, session rotations, and even password changes.

The permission grant creation endpoint (CORS57-002) introduces a second asymmetry that distinguishes permission endpoints from review or changelog endpoints. When an attacker injects a fraudulent review (documented in SA-SKL-CORS55), the impact is to trust signals. When an attacker creates a permission grant under victim admin identity, the impact is to access control state — the attacker is granting themselves or a controlled account the ability to perform admin-tier operations on private skills. The grant is recorded in the audit log with the victim's user ID as the actor, providing the attacker with plausible attribution to the legitimate admin and covering their tracks during the escalation window.

The timing oracle in CORS57-003 targets a specific operational pattern that makes permission management endpoints particularly exploitable: access control changes tend to cluster around security incidents, on-call escalations, and during the first hour of a new team member's onboarding. These are exactly the moments when an admin is actively working with the permission API and has an authenticated session in their browser — making them available for CORS-based exfiltration or injection without requiring any additional attacker action. The oracle identifies which skills are in an active permission change window before the exfiltration phase begins.

CORS57-004 completes the picture by providing a disruption capability that is durable beyond the attacker's access window. CI service account grants are not re-created automatically when revoked — a CI pipeline that loses its permission grant will fail until a human administrator notices the error, diagnoses the cause, and re-issues the grant. The attacker can revoke all CI grants for all skills administered by the victim in a single session, creating an operational incident that absorbs the security team's attention while the escalated permission grants from CORS57-002 remain active.

Permission override tokens survive session expiry. Unlike session cookies that expire on logout or rotation, override tokens issued for incident response are stored independently and are designed to persist. Reading the permission map via CORS57-001 gives the attacker credentials that remain valid after the victim logs out, closes their browser, or rotates their password — these tokens require explicit revocation, which CORS57-004 also compromises.

CORS57-001 — Credential-bearing CORS on permission map exposes override tokens and role bindings

Severity: CRITICAL  |  Endpoint: GET /api/skills/:id/permissions

The permission map endpoint is configured with cors({origin:true,credentials:true}) applied at the router level. This policy reflects any Origin header as an allowed origin while simultaneously setting Access-Control-Allow-Credentials: true. Any web page can therefore issue a credentialed cross-origin request to this endpoint and receive the complete permission map document in the response.

The permission map document contains three tiers of sensitive data. The first tier is per-user override tokens. These are credential strings — typically UUIDs or JWT-format tokens issued outside the normal session flow — that allow any bearer to perform admin-tier operations on the skill. They are stored in the permission document because they are logically associated with a specific permission grant: an on-call engineer requests an override for a specific permission scope, and the token is recorded alongside the grant that authorized it. When the CORS misconfiguration exposes the full document to any origin, it exposes every override token for every active incident response session associated with the skill.

The second tier is role-to-permission bindings. The binding document records which team roles are authorized to perform which actions on the skill: who can publish versions, who can modify the skill's access tier, who can delete the skill, and who can issue new override tokens. This information enables an attacker to understand exactly which actions are available to the victim's role before proceeding with CORS57-002 — allowing them to inject permission grants for capabilities that the victim's role actually controls, maximizing the probability that the granted permission is exercisable.

The third tier is temporary elevated access grants. When an on-call engineer escalates their privileges to handle a production incident, the escalation is recorded as a temporary grant with an expiry timestamp. Reading this record reveals not just that an escalation is active, but which user holds elevated access, what scope they were granted, and when it expires — information that an attacker can use to time the CORS57-002 injection to occur while the legitimate admin's session is active.

Vulnerable
// GET /api/skills/:id/permissions — cors({origin:true,credentials:true}) at router level
const router = express.Router();
router.use(cors({ origin: true, credentials: true }));  // reflects any origin

router.get('/:id/permissions', requireSession, async (req, res) => {
  const perms = await Permission.find({ skillId: req.params.id })
    .select('+overrideToken +roleBindings +elevatedGrants');  // exposes credentials
  return res.json(perms);
});
Fixed
// GET /api/skills/:id/permissions — per-route allowlist cors + role-scoped fields
const ALLOWED = process.env.ALLOWED_ORIGINS.split(',');
const permCors = cors({ origin: ALLOWED, credentials: true });

router.get('/:id/permissions', permCors, requireSession, async (req, res) => {
  const isAdmin = req.session?.role === 'admin';

  const perms = await Permission.find({ skillId: req.params.id })
    .select(isAdmin
      ? '+roleBindings +elevatedGrants -overrideToken'  // admin: bindings visible, override token never returned
      : '-roleBindings -elevatedGrants -overrideToken'  // non-admin: own permissions only
    );

  // non-admin callers see only grants targeting their own userId
  const result = isAdmin
    ? perms
    : perms.filter(p => String(p.userId) === req.session.userId);

  return res.json(result);
});

The fix applies CORS on a per-route basis using an explicit allowlist rather than the router-level reflect-all policy. Override tokens are never returned in GET responses — they are single-use credentials that should be transmitted only once at issuance. Role bindings and elevated grant details are gated behind requireRole('admin'). Non-admin callers receive only grants targeting their own user ID, containing no credential fields. Override token issuance is handled via a separate POST /api/skills/:id/permissions/override endpoint that returns the token only in the creation response body.

CORS57-002 — Wildcard ACAO on permission grant creation enables external privilege escalation under victim admin identity

Severity: CRITICAL  |  Endpoint: POST /api/skills/:id/permissions

The permission grant creation endpoint returns Access-Control-Allow-Origin: * regardless of the requesting origin. The endpoint requires a valid session via requireSession middleware. The wildcard ACAO means that any web page can submit a permission grant creation request using the victim's browser session, with the attacker controlling the full grant payload: the target user ID, the permission scope, the grant expiry, and the access tier level.

The practical consequence of wildcard ACAO on grant creation is not limited to a single unauthorized grant. The attacker can issue multiple grants in sequence during a single visit: one grant for a low-privilege attacker-controlled account that elevates it to publisher access on private skills, another grant for a backdoor admin account that gains full registry-level capabilities, and a third grant that extends the first two grants' expiry dates to persist beyond the current incident window. All three grants appear in the audit log under the victim admin's user ID.

The audit log attribution problem is specifically damaging during incident response. When a security team investigates an unauthorized permission change, the first query they run is against the audit log filtered by the acting user's ID. Because CORS57-002 causes the grant to be attributed to the legitimate admin, the security team will initially conclude that the grant was an authorized action — the legitimate admin's account shows the creation event at the precise time when that admin had an active authenticated session. This delays detection of the compromise by directing investigation toward the victim rather than the attacker.

Permission grants are recorded under victim identity. Unlike direct session hijacking, CORS-based permission grant injection does not require stealing or forging credentials — it uses the victim's real session to create grants that appear legitimate in every audit trail, permission enforcement system, and monitoring dashboard that checks for unauthorized access.

Vulnerable
// POST /api/skills/:id/permissions — ACAO:* set by upstream cors() middleware
// No CSRF check, no role boundary, no Zod schema
router.post('/:id/permissions', requireSession, async (req, res) => {
  const { targetUserId, scope, expiresAt, level } = req.body;
  const grant = await Permission.create({
    skillId:      req.params.id,
    grantedBy:    req.session.userId,  // attributed to victim
    targetUserId,                       // attacker-controlled
    scope,                              // attacker-controlled
    expiresAt,                          // attacker-controlled
    level,                              // attacker-controlled
  });
  return res.status(201).json(grant);
});
Fixed
// POST /api/skills/:id/permissions — allowlist cors + requireRole + CSRF + Zod + rate limit
import { z } from 'zod';

const PermissionGrantSchema = z.object({
  targetUserId: z.string().uuid(),
  scope: z.enum(['read', 'publish', 'admin', 'override']),
  expiresAt: z.string().datetime().optional(),
});

router.post(
  '/:id/permissions',
  permCors,          // per-route allowlist (from CORS57-001 fix)
  requireSession,
  requireRole('admin'),
  verifyCsrf,
  rateLimit({
    windowMs: 60_000,
    max: 10,
    keyGenerator: r => `permgrant:${r.session.userId}:${r.params.id}`,
    message: { error: 'Permission grant rate limit exceeded' },
  }),
  async (req, res) => {
    const parsed = PermissionGrantSchema.safeParse(req.body);
    if (!parsed.success) return res.status(400).json({ error: 'Invalid grant payload' });

    const { scope } = parsed.data;
    if (scope === 'override' && req.session.role !== 'registry_admin') {
      return res.status(403).json({ error: 'Override scope requires registry_admin' });
    }

    const grant = await Permission.create({
      skillId:      req.params.id,
      grantedBy:    req.session.userId,
      targetUserId: parsed.data.targetUserId,
      scope,
      expiresAt:    parsed.data.expiresAt ?? null,
    });

    await AuditLog.create({
      action:       'permission.granted',
      actorId:      req.session.userId,
      targetUserId: parsed.data.targetUserId,
      skillId:      req.params.id,
      scope,
      origin:       req.headers.origin,
      at:           new Date(),
    });

    return res.status(201).json({ id: grant.id });
  }
);

The fix applies five controls. Per-route allowlist CORS removes the wildcard ACAO. requireRole('admin') ensures only admins can create permission grants. CSRF token verification prevents cross-site form injection. Zod schema validation restricts scope to known values and validates targetUserId format. Override scope requires an additional registry_admin role check that stops permission escalation beyond the caller's own authority level. The audit log records the origin header alongside the acting user ID, enabling detection of grants created from unexpected origins even when they carry a valid session.

CORS57-003 — Timing oracle on permissions audit endpoint reveals active permission change targets

Severity: MEDIUM  |  Endpoint: GET /api/skills/:id/permissions/audit

The permissions audit endpoint reflects the Origin header as the value of Access-Control-Allow-Origin before the ownership check executes. This creates a timing oracle: the audit endpoint serves cached results for skills with high permission change activity in under 5 ms (from an in-memory LRU cache maintained by the audit aggregation pipeline), while skills with low change activity require a full database query that takes 20–50 ms. The latency difference is cross-origin-detectable even without reading the response body — the browser measures the round-trip time of the OPTIONS preflight followed by the GET and derives whether the skill has recent permission activity from the response time alone.

The timing oracle serves a specific role in the compound attack chain: it identifies which skills are currently in an active permission change window before the CORS57-001 credential-read phase begins. Skills that show high permission change velocity in the audit cache are those whose administrators are actively working in the permissions UI, meaning their session is live, their browser is open to the registry domain, and they will visit attacker-controlled pages during the same browsing session that holds the authenticated session. These are the highest-value CORS57-001 targets — the exfiltrated override tokens are more likely to be associated with active incident response contexts, and the CORS57-002 injection is more likely to succeed during a window when the legitimate admin is actively reviewing permission state.

The oracle is not exploitable without the CORS misconfiguration. Without origin reflection, the browser will not deliver cross-origin response metadata including RTT to the requesting page. The remediation performs ownership verification and rate limiting before emitting any CORS header, enforces a constant-time response floor of 60 ms, and unifies the 403/404 path latency to prevent status-code-based enumeration as a secondary oracle.

Vulnerable
// GET /api/skills/:id/permissions/audit — Origin reflected before auth
router.get('/:id/permissions/audit', async (req, res) => {
  res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*');
  res.setHeader('Access-Control-Allow-Credentials', 'true');

  // ownership check runs AFTER CORS header emission
  const skill = await Skill.findById(req.params.id);
  if (!skill || skill.ownerId !== req.session?.userId) {
    return res.status(403).json({ error: 'Forbidden' });
  }

  // cache hit: <5ms; cache miss: 20-50ms — detectable via RTT
  const audit = auditCache.get(req.params.id)
    || await computePermissionAudit(req.params.id);
  return res.json(audit);
});
Fixed
// GET /api/skills/:id/permissions/audit — auth before CORS + constant-time floor
router.get('/:id/permissions/audit', requireSession, async (req, res) => {
  const start = Date.now();

  // ownership check BEFORE any CORS header
  const skill = await Skill.findOne({
    _id:     req.params.id,
    ownerId: req.session.userId,  // unified WHERE — no 403 vs 404 timing leak
  });
  if (!skill) {
    await sleep(60 - (Date.now() - start));
    return res.status(404).json({ error: 'Not found' });
  }

  // apply allowlist CORS only after auth succeeds
  permCors(req, res, async () => {
    const audit = auditCache.get(req.params.id)
      || await computePermissionAudit(req.params.id);
    await sleep(Math.max(0, 60 - (Date.now() - start)));  // 60ms floor
    return res.json(audit);
  });
});

CORS57-004 — Credential-bearing CORS on grant revocation breaks CI service accounts without notification

Severity: CRITICAL  |  Endpoint: DELETE /api/skills/:id/permissions/:grantId

The permission grant revocation endpoint shares the same router-level cors({origin:true,credentials:true}) policy as CORS57-001. Any web page can issue a credentialed DELETE request to this endpoint using the victim admin's browser session. The endpoint performs no ownership check — it revokes any grant by ID without verifying that the caller administered the grant or that they have authority over the skill in question.

CI service account grants are the highest-impact revocation target. CI pipelines authenticate to the skill registry using permission grants rather than user sessions — there is no interactive login that could regenerate a session token. When a CI service account grant is revoked, the pipeline fails at the next execution. The failure manifests as an authentication error in the CI runner logs, not as a security alert — the operations team initially investigates it as a configuration drift or credential rotation issue, not a security incident.

The attacker's operational objective is to chain CORS57-002 and CORS57-004 in the same session: first create escalated grants for attacker-controlled accounts, then revoke CI service account grants to consume security team attention during the incident window. The two actions are complementary because the CI grant revocations trigger a detectable operational incident (pipeline failures), which provides cover for the more subtle permission escalation. Security teams that are simultaneously handling pipeline failures and investigating the cause have reduced capacity to audit new permission grant creation during the same window.

The absence of a notification mechanism on the deletion endpoint extends the attacker's access window. The legitimate access control owner has no automated signal that their CI grants have been revoked. They discover the revocation only when they notice pipeline failures, manually check the permission log, and then connect the grant deletion to the operational outage — a process that typically takes hours during an active incident.

Vulnerable
// DELETE /api/skills/:id/permissions/:grantId
// cors({origin:true,credentials:true}) from router.use()
// No ownership check, no audit log, no notification
router.delete('/:id/permissions/:grantId', requireSession, async (req, res) => {
  await Permission.deleteOne({ _id: req.params.grantId });
  return res.status(204).end();
});
Fixed
// DELETE /api/skills/:id/permissions/:grantId
// Per-route allowlist CORS + ownership check + audit log + notification
router.delete('/:id/permissions/:grantId', permCors, requireSession, async (req, res) => {
  const grant = await Permission.findOne({
    _id:     req.params.grantId,
    skillId: req.params.id,
  });
  if (!grant) return res.status(404).json({ error: 'Grant not found' });

  const isAdmin    = req.session.role === 'admin' || req.session.role === 'registry_admin';
  const isGrantor  = String(grant.grantedBy) === req.session.userId;
  if (!isAdmin && !isGrantor) {
    return res.status(403).json({ error: 'Forbidden' });
  }

  await grant.deleteOne();

  await AuditLog.create({
    action:   'permission.revoked',
    actorId:  req.session.userId,
    grantId:  req.params.grantId,
    skillId:  req.params.id,
    scope:    grant.scope,
    origin:   req.headers.origin,
    at:       new Date(),
  });

  // notify the access control owner if revocation was performed by a third party
  if (!isGrantor) {
    await notify(grant.grantedBy, {
      type:    'permission.revoked',
      grantId: req.params.grantId,
      skillId: req.params.id,
      by:      req.session.userId,
    });
  }

  return res.status(204).end();
});

The fix applies per-route allowlist CORS, verifies that the caller is either the original grantor or an admin before proceeding, writes an audit log record capturing the origin and acting user ID, and sends a notification to the original grantor when deletion is performed by a third party. This notification is the mechanism that surfaces CORS-based revocation to the legitimate access control owner: even if the attacker uses a valid admin session to perform the deletion, the grantor receives a signal that their grant was revoked from an unexpected origin, enabling detection during or immediately after the attack rather than hours later during pipeline failure investigation.

Compound permission escalation and pipeline disruption chain

The four vulnerabilities in SA-SKL-CORS57 compose naturally into a four-stage attack chain executed entirely from a single malicious web page visited by any registry admin:

StageFindingActionOutput used by
1 — Target identification CORS57-003 Iterate skill IDs, measure permissions audit response latency, rank skills by permission change velocity — identifying those whose admins are live in the permissions UI Stage 2 target list of live-session admins
2 — Credential exfiltration CORS57-001 Read full permission map for high-velocity skills; extract override tokens (durable auth credentials), role bindings (available permission scopes for CORS57-002), and elevated grant expiry timestamps Override tokens for persistent access; scope map for CORS57-002 grant construction
3 — Privilege escalation CORS57-002 Create permission grants for attacker-controlled accounts at the highest available scope level; set extended expiry; audit log attributes to victim admin identity Persistent elevated access for attacker-controlled accounts; audit trail framing victim as grantor
4 — Disruption and cover CORS57-004 Revoke CI service account grants for all skills administered by the victim; pipeline failures absorb security team attention during the escalation window Operational incident that reduces security team capacity to audit new grant creation from CORS57-002

The chain is self-reinforcing: each stage provides information or capability that makes the next stage more effective. Stage 1 improves the probability that Stage 2 captures credentials for active incident response contexts. Stage 2 provides the scope map that Stage 3 uses to construct grants at the maximum achievable privilege level. Stage 3 creates the escalated grants before Stage 4 triggers the operational incident that distracts the security team from detecting them. An attacker who gains a victim admin's browser for the duration of a single page visit can complete all four stages.

The audit log is not a sufficient defense. CORS57-002 and CORS57-004 both create audit log entries, but those entries attribute actions to the legitimate admin's user ID. An audit log review will show the admin creating grants and revoking CI access — which appears consistent with normal incident response behavior. Only the origin field in the audit record reveals that the action originated from an unexpected page. Organizations that do not alert on origin anomalies in permission change events will not detect this attack from their audit logs alone.

Detection with SkillAudit AST queries

SkillAudit's static analysis engine detects the three CORS patterns that compose this advisory using AST-level queries against your skill registry source code. The queries identify vulnerable code at the declaration site — where cors() is configured and where CORS headers are emitted relative to auth middleware — rather than at the call site, which is where runtime security scanners typically look. This matters because the vulnerability is in the CORS configuration, not in the downstream handler logic.

Three query classes cover SA-SKL-CORS57:

Query class 1 — Wildcard or origin-reflecting CORS on permission or access control routes. Detects cors({origin:true}), cors({origin:'*'}), and res.setHeader('Access-Control-Allow-Origin', req.headers.origin) applied to routes whose path segments match permission, access, grants, or override patterns. Flags both router-level application (which propagates to all child routes) and per-route application on sensitive endpoints.

Query class 2 — CORS header emission before auth middleware in route chain. Detects handler chains where a CORS header write (res.setHeader, res.set, or cors() middleware) precedes any auth check (requireSession, verifyToken, passport.authenticate) in the Express middleware stack for a given route. This is the pattern underlying the timing oracle in CORS57-003 — the fix requires auth to execute before any CORS header is emitted.

Query class 3 — DELETE permission grant route without AuditLog write in handler body. Detects DELETE route handlers matching /permissions/:grantId patterns that do not contain a AuditLog.create(), db.insert(), or equivalent audit write call in the handler body. Missing audit log on grant revocation prevents detection of CORS57-004-pattern attacks even when the attacker uses a valid session.

These queries are available in SkillAudit's CORS rule pack alongside the full SA-SKL-CORS57 advisory. For teams scanning the broader CORS surface of their MCP skill registries, the same pack includes rules for review and feedback collection endpoints (SA-SKL-CORS55) and changelog management endpoints, covering the full content and access control surface with consistent query semantics.

Summary and remediation checklist

SA-SKL-CORS57 documents four CORS misconfigurations in MCP skill registry permission and access control management endpoints that together enable a compound privilege escalation and pipeline disruption attack chain. All four vulnerabilities stem from the same root cause: CORS policy is applied at the router level using a reflect-all configuration rather than on individual routes using an explicit origin allowlist.

FindingSeverityRoot causeFix summary
CORS57-001 Critical cors({origin:true,credentials:true}) at router level on permission map endpoint Per-route allowlist CORS; role-gate sensitive fields; never return override tokens in GET responses
CORS57-002 Critical ACAO: * on grant creation endpoint; no CSRF check; no scope boundary Allowlist CORS; requireRole('admin'); verifyCsrf; Zod PermissionGrantSchema; scope boundary check; audit log with origin
CORS57-003 Medium Origin reflected before ownership check on audit endpoint Auth before CORS emission; unified WHERE clause; 60 ms constant-time floor
CORS57-004 Critical cors({origin:true,credentials:true}) on grant revocation; no ownership check; no audit log Per-route allowlist CORS; grantor-or-admin check; audit log with origin; notify grantor on third-party revocation

Remediation checklist. (1) Audit all Express routers that handle /permissions routes — remove any router.use(cors({origin:true})) calls and replace with per-route cors({origin: ALLOWLIST}). (2) Verify that permission grant creation routes have CSRF verification middleware before the async handler. (3) Confirm that audit log writes exist on all grant creation and revocation handlers and that the origin header is recorded. (4) Add alerting on permission grant creation events where the origin field does not match the registry's known frontend origins. (5) Ensure override token issuance is a separate endpoint that returns the token only in the creation response — never in subsequent GET requests that serialize permission documents. (6) Run SkillAudit's CORS rule pack against your codebase to surface any remaining instances of these patterns in routes not covered by this advisory.