← Security advisories

Claude MCP skill CORS misconfiguration — skill permission and access control delegation endpoints — SA-SKL-CORS47

SA-SKL-CORS47 documents four CORS misconfiguration patterns in MCP skill registry permission and access control delegation endpoints. These endpoints govern which identities may act on a skill: reading the full permission configuration including trust delegation chains, creating new permission delegations that grant third parties elevated access, querying permission change history, and revoking individual permission delegations. Credential-bearing CORS on the permission configuration endpoint exposes delegated role assignments, permission override tokens, and the complete trust delegation chain to any cross-origin attacker. Wildcard ACAO on the delegation creation endpoint allows any page to grant attacker-controlled delegatees elevated access to victim skills while silently consuming delegation quota. A timing oracle on the permission history endpoint enumerates which skills have recently undergone permission changes, identifying the highest-value targets for CORS47-001. And credential-bearing CORS on delegation deletion lets any origin revoke any authorized delegation, disabling authorized CI integrations, service accounts, and enterprise automation that depend on those permissions.

SA-SKL-CORS47 findings at a glance
CRITICALCORS47-001 — cors({origin:true,credentials:true}) on GET /api/skills/:id/permissions; any origin reads full permission configuration including delegated role assignments, permission override tokens, and trust delegation chain using victim session
HIGHCORS47-002 — ACAO: * on POST /api/skills/:id/permissions/delegate; any page creates permission delegations consuming delegation quota and granting attacker-controlled delegatees elevated access to victim skills; fix: remove wildcard; require session; CSRF token; requireRole('admin'); validate delegatee identity against org member list
MEDIUMCORS47-003 — ACAO origin reflection on GET /api/skills/:id/permissions/history emitted before ownership check; timing oracle reveals permission change history existence across all orgs, enumerating recently-modified permission structures as CORS47-001 targets
CRITICALCORS47-004 — cors({origin:true,credentials:true}) on DELETE /api/skills/:id/permissions/:permissionId; any origin revokes any permission delegation using victim admin session, disrupting authorized integrations and service account access

CORS47-001 — Credential-bearing CORS on permission config exposes delegation chains and permission override tokens

The permission configuration endpoint at GET /api/skills/:id/permissions returns the complete access control state for a skill: all principal-to-role assignments, the trust delegation chain showing which higher-level org roles have delegated down to skill-level principals, and permission override tokens — short-lived credentials that bypass normal role checks for specific API operations, issued during incident response or emergency maintenance. When configured with cors({origin:true,credentials:true}), any page can read all of this configuration using the victim administrator's authenticated browser session.

Permission override tokens are the most sensitive component exposed by CORS47-001. These tokens are intentionally designed to bypass normal access control enforcement — they exist for emergency cases where a service account's normal credentials are unavailable and an operator needs to perform a privileged action immediately. An attacker who obtains a valid permission override token can perform any operation that the token was scoped for, without possessing the legitimate credentials. Because override tokens are issued for time-sensitive incident response scenarios, they typically have longer validity windows than normal session tokens, compounding the exposure window.

The trust delegation chain exposure reveals the full organizational permission topology: which higher-level principals originally held the permissions that were delegated down, the intermediate delegation steps, and which principals can re-delegate to others. This chain is a roadmap for a privilege escalation attack — an attacker who can compromise any node in the delegation chain can traverse upward to reach broader permissions than are visible in the terminal grant at the skill level. The delegation chain also reveals organizational structure that most organizations treat as internal: which team members have cross-skill administrative access and which service accounts operate across organizational boundaries.

CORS47-001 fix: Replace cors({origin:true,credentials:true}) with an explicit allowlist. Add requireSession before CORS middleware. For public callers, return only a summary indicating whether the skill has any active delegations — never return specific principal assignments, role names, or override tokens. Treat permission override tokens as write-only: never return them in GET responses, only emit them at creation time to authenticated administrators.

WRONG
router.get('/skills/:id/permissions',
  cors({ origin: true, credentials: true }),
  async (req, res) => {
    const perms = await db.getFullPermissionConfig(req.params.id);
    // includes delegation chain, role assignments, override tokens
    res.json(perms);
  }
);
RIGHT
router.get('/skills/:id/permissions',
  requireSession,
  strictCors,
  async (req, res) => {
    const isOwner = await db.isSkillOwner(req.params.id, req.session.orgId);
    if (!isOwner) {
      // public: existence check only — no principals, roles, or tokens
      const summary = await db.getPermissionSummary(req.params.id);
      return res.json(summary);
    }
    const perms = await db.getFullPermissionConfig(req.params.id);
    // Strip override tokens from GET response — emit only at creation time
    return res.json({ ...perms, overrideTokens: undefined });
  }
);

CORS47-002 — Wildcard ACAO on delegation creation enables delegation quota exhaustion and attacker access grants

The permission delegation endpoint at POST /api/skills/:id/permissions/delegate creates a new permission delegation that grants a specified principal elevated access to the target skill. With ACAO: *, any page holding the victim admin's Bearer token can submit delegation requests without restriction. The delegation quota exhaustion attack floods the monthly delegation allowance — most registries cap the number of active delegations per skill to prevent cross-org permission sprawl — by creating delegations to synthetic or garbage principal identities. Once the quota is exhausted, the legitimate skill owner cannot create new authorized delegations, locking out CI integrations and service account onboarding until the registry administrator manually resets the quota.

The elevated access grant attack is more directly damaging. If the delegation creation endpoint does not validate that the specified delegatee principal is a member of the requesting org — or if it accepts any identity string as a valid delegatee — an attacker can delegate elevated permissions to an attacker-controlled account. This new delegation appears in the skill's permission record as a legitimate admin-approved grant, with no indication that it was created through CORS exploitation rather than deliberate owner action. The attacker's delegatee now has persistent elevated access to the skill's API operations until a legitimate administrator discovers and revokes the unauthorized delegation.

CORS47-002 fix: Remove wildcard ACAO: *. Require session authentication. Add CSRF token. Require requireRole('admin'). Validate that the specified delegatee identity is a member of the requesting org's member directory before creating the delegation. Enforce a per-skill monthly delegation count limit. Write an audit log entry and emit a notification to the skill owner on every new delegation creation.

CORS47-003 — Timing oracle on permission history endpoint enumerates recently-modified permission structures

The permission history endpoint at GET /api/skills/:id/permissions/history emits the CORS origin reflection header before executing the ownership check that determines whether the requesting session may read the target skill's permission change history. This creates a timing oracle: the response latency for skills that have an active permission history but belong to a different org (ownership check executes after a DB query that finds records — slower) differs measurably from skills that have no permission history at all (early exit before full query — faster). An attacker who can observe these timing differences enumerates which skills have recently had permission changes, identifying high-value targets for CORS47-001's permission configuration exfiltration.

The timing oracle has compounding value when combined with the trust delegation chain exposed by CORS47-001. Skills that have recently undergone permission restructuring — adding new service account delegations, rotating override tokens, or modifying CI integration grants — are the most valuable targets because their permission configs are freshest and most likely to include newly-issued override tokens or expanded delegation grants. The timing oracle identifies these recently-modified skills with minimal API calls, enabling an efficient scanning strategy across the full skill registry catalog without triggering rate limits.

CORS47-003 fix: Move the ownership check before CORS header emission. Use a unified WHERE orgId = req.session.orgId AND skillId = req.params.id clause so the response shape is consistent regardless of ownership. Normalize 403/404 response latency by ensuring both paths complete a database round-trip before returning. Apply the same fix to any other permission metadata endpoints that emit CORS headers before authorization checks.

CORS47-004 — Credential-bearing CORS on delegation deletion disrupts authorized integrations and service account access

The permission delegation deletion endpoint at DELETE /api/skills/:id/permissions/:permissionId configured with cors({origin:true,credentials:true}) allows any origin to revoke any active delegation using the victim admin's authenticated session. Permission delegation revocation is an immediately-effective, potentially irreversible operation: once a service account's delegation is revoked, any CI pipeline or automated process that depends on that delegation begins failing with permission denied errors. Rolling back requires the legitimate admin to manually recreate the delegation, re-enter the trust delegation chain, and potentially re-rotate any downstream credentials that were automatically invalidated by the revocation event.

The most damaging attack targets delegations for critical production integrations. A registry deployment pipeline that depends on a CI service account delegation to publish signed artifacts will immediately fail when that delegation is revoked — blocking the entire release process until the delegation is restored. If the revocation happens during an active incident response, when operators are simultaneously trying to execute emergency deployments, the disruption can delay the security patch publish while the team debugs what appears to be an infrastructure problem rather than an access control attack. The deletion appears as a legitimate admin revocation in the audit log, with no immediate signal that it originated from a cross-origin request.

CORS47-004 fix: Replace cors({origin:true,credentials:true}) with an explicit allowlist. Add requireRole('admin'). Add an ownership check that validates the delegation belongs to the requesting session's org before executing the deletion. Enumerate all services and integrations depending on the targeted delegation and notify their configured alert channels before completing the deletion. Write a detailed audit log entry including actor, timestamp, and the full delegation record being revoked. For delegations used by active CI integrations, require a secondary confirmation step.

WRONG
router.delete('/skills/:id/permissions/:permissionId',
  cors({ origin: true, credentials: true }),
  async (req, res) => {
    await db.deletePermission(req.params.permissionId);  // no ownership check
    res.json({ deleted: true });
  }
);
RIGHT
router.delete('/skills/:id/permissions/:permissionId',
  requireSession,
  strictCors,
  requireRole('admin'),
  async (req, res) => {
    const perm = await db.getPermission(req.params.permissionId);
    if (!perm || perm.orgId !== req.session.orgId) {
      return res.status(403).json({ error: 'forbidden' });
    }
    const dependents = await db.getIntegrationsDependingOn(req.params.permissionId);
    if (dependents.length > 0) {
      await notify.sendRevocationAlert(dependents, req.params.permissionId);
    }
    await db.deletePermission(req.params.permissionId);
    await auditLog.write({
      event: 'delegation_revoked',
      permissionId: req.params.permissionId,
      actor: req.session.userId,
      delegatee: perm.delegateeId,
      dependents: dependents.map(d => d.integrationId)
    });
    res.json({ deleted: true });
  }
);

SkillAudit scans your registry's permission and access control delegation router for all four CORS47 patterns, plus the eleven other CORS families documented in the SA-SKL-CORS series. Get started free — 3 audits/month on public repos, results in 60 seconds.