← Blog

Claude MCP skill CORS misconfiguration — skill webhook and callback endpoint management (SA-SKL-CORS66)

SA-SKL-CORS66 identifies four CORS misconfiguration vulnerabilities in MCP skill registry webhook and callback endpoint management. Credential-bearing CORS on the webhook list endpoint exposes endpoint URLs and signing secrets that authenticate every future delivery; wildcard ACAO on the webhook creation endpoint lets any origin register attacker-controlled delivery addresses; a timing oracle on the webhook delivery history endpoint reveals high-event-volume skills; and credential-bearing CORS on the webhook deletion endpoint silently removes active integrations.

SA-SKL-CORS66 findings at a glance
CRITICALCORS66-001 — GET /api/skills/:id/webhooks has cors({origin:true,credentials:true}); any origin reads full webhook list including endpoint URLs, signing secrets, and delivery history; signing secrets enable forging webhook signatures for all downstream integrations
CRITICALCORS66-002 — POST /api/skills/:id/webhooks has ACAO:*; any page creates attacker-controlled webhook entries under victim admin identity; attacker endpoint receives all future skill event notifications including private audit findings
MEDIUMCORS66-003 — GET /api/skills/:id/webhooks/deliveries reflects Origin before ownership check; timing oracle reveals webhook delivery velocity identifying high-event-volume skills as CORS66-001 targets
HIGHCORS66-004 — DELETE /api/skills/:id/webhooks/:webhookId has cors({origin:true,credentials:true}); any origin removes active webhooks using victim admin session, disrupting CI/CD, Slack, and PagerDuty integrations

CORS66-001 — Credential-bearing CORS exposes webhook signing secrets

The GET /api/skills/:id/webhooks endpoint returns the complete webhook list for a skill, including each webhook's target URL, the event types it subscribes to, the delivery history, and critically, the signing secret used to generate the X-SkillAudit-Signature HMAC header on each delivery. The endpoint uses cors({origin:true,credentials:true}), enabling any origin to read the full response using the victim's session cookie.

The signing secret is the highest-value credential in the webhook configuration. It is an HMAC-SHA256 key that the registry uses to sign every event payload delivered to the webhook URL. The receiving service (a GitHub Actions workflow trigger, a Slack webhook relay, a PagerDuty integration) validates the signature to verify the payload came from the registry. An attacker who exfiltrates the signing secret can generate valid signatures for any forged payload, allowing them to trigger arbitrary CI builds, post attacker-controlled Slack messages, or create PagerDuty incidents — all appearing to originate from the legitimate registry.

Vulnerable
// CORS66-001 — VULNERABLE
router.get(
  '/',
  cors({ origin: true, credentials: true }), // any origin reads signing secrets
  requireSession,
  requireOwnership('skillId'),
  async (req, res) => {
    const webhooks = await db.webhooks.findAll({
      where: { skillId: req.params.id },
      // VULNERABLE: signingSecret included — enables forging webhook signatures
      attributes: ['id', 'url', 'events', 'signingSecret', 'lastDeliveredAt', 'createdAt'],
    });
    res.json(webhooks);
  }
);
Fixed
// CORS66-001 — FIXED
router.get(
  '/',
  cors(corsOptions),         // allowlist CORS
  requireSession,
  requireOwnership('skillId'),
  async (req, res) => {
    const webhooks = await db.webhooks.findAll({
      where: { skillId: req.params.id },
      // FIXED: never return signingSecret — return masked prefix only
      attributes: ['id', 'url', 'events', 'signingSecretPrefix', 'lastDeliveredAt', 'createdAt'],
    });
    res.json(webhooks);
  }
);

Signing secret exfiltration impact: The attacker now holds the HMAC signing key for every webhook registered to the skill. They can generate valid X-SkillAudit-Signature headers for arbitrary payloads. Any downstream service that validates webhook signatures will accept attacker-forged deliveries as authentic registry events, enabling unauthorized CI triggering, messaging, and alerting.

CORS66-002 — Wildcard ACAO enables attacker webhook registration

The POST /api/skills/:id/webhooks endpoint creates a new webhook subscription with an attacker-controlled delivery URL. With ACAO:* set, any origin can issue a cross-origin POST using the victim's session cookie (since the endpoint also authenticates via session and the POST body is JSON, triggering a preflighted request that the wildcard ACAO approves). The attacker registers their own endpoint (https://attacker.com/receive) subscribed to all event types, including audit.complete, skill.published, and vulnerability.found.

Vulnerable
// CORS66-002 — VULNERABLE
router.post(
  '/',
  (req, res, next) => {
    res.setHeader('Access-Control-Allow-Origin', '*'); // VULNERABLE: wildcard ACAO
    res.setHeader('Access-Control-Allow-Methods', 'POST, OPTIONS');
    res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
    if (req.method === 'OPTIONS') return res.sendStatus(204);
    next();
  },
  requireSession,
  requireOwnership('skillId'),
  async (req, res) => {
    const { url, events } = req.body;
    const signingSecret = crypto.randomBytes(32).toString('hex');
    await db.webhooks.create({ skillId: req.params.id, url, events, signingSecret });
    res.json({ ok: true, signingSecret });
  }
);
Fixed
// CORS66-002 — FIXED
router.post(
  '/',
  cors(corsOptions),     // allowlist CORS
  requireSession,
  verifyCsrfToken,
  requireOwnership('skillId'),
  async (req, res) => {
    const { url, events } = req.body;
    // Validate webhook URL to prevent SSRF via webhook registration
    if (!isAllowedWebhookUrl(url)) {
      return res.status(422).json({ error: 'Webhook URL not in permitted range' });
    }
    const signingSecret = crypto.randomBytes(32).toString('hex');
    await db.webhooks.create({ skillId: req.params.id, url, events, signingSecret });
    res.json({ ok: true, signingSecret }); // returned once at creation only
  }
);

CORS66-003 — Timing oracle on webhook delivery history endpoint

The GET /api/skills/:id/webhooks/deliveries endpoint reflects the Origin header as ACAO before performing the ownership check. Because the ownership check is cached, skills with an active admin session have a cache-hit response (<5ms) while uncached skills return in 20–40ms. This latency differential enables the attacker to enumerate which skills have high webhook delivery velocity — identifying active Slack and CI integrations as the highest-impact CORS66-004 removal targets.

Vulnerable
// CORS66-003 — VULNERABLE
router.get('/deliveries',
  (req, res, next) => {
    res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*');
    res.setHeader('Vary', 'Origin');
    next();
  },
  requireSession,
  requireOwnershipCached('skillId', { ttl: 60 }), // timing oracle via cache
  async (req, res) => {
    const deliveries = await db.webhookDeliveries.findAll({ skillId: req.params.id });
    res.json(deliveries);
  }
);
Fixed
// CORS66-003 — FIXED
router.get('/deliveries',
  cors(corsOptions),
  requireSession,
  async (req, res) => {
    const startMs = Date.now();
    // Unified query — ownership check inside the query, no separate cached step
    const deliveries = await db.webhookDeliveries.findAllForOwner({
      skillId: req.params.id,
      userId: req.session.userId,
    });
    if (!deliveries) {
      const elapsed = Date.now() - startMs;
      if (elapsed < 60) await delay(60 - elapsed); // constant-time floor
      return res.status(403).json({ error: 'Not found' });
    }
    res.json(deliveries);
  }
);

CORS66-004 — Credential-bearing CORS removes active webhook integrations

The DELETE /api/skills/:id/webhooks/:webhookId endpoint removes a webhook subscription permanently. Using cors({origin:true,credentials:true}), any origin can issue a credentialed DELETE request to silently remove any webhook the victim admin has registered. An attacker who removes the CI/CD build notification webhook disrupts automated deployment triggers. Removing the Slack notification webhook silences the team's awareness of new audit findings. Removing the PagerDuty integration webhook prevents on-call alerts for critical vulnerabilities.

Vulnerable
// CORS66-004 — VULNERABLE
router.delete('/:webhookId',
  cors({ origin: true, credentials: true }), // any origin removes webhooks
  requireSession,
  requireOwnership('skillId'),
  async (req, res) => {
    await db.webhooks.destroy({ where: { id: req.params.webhookId } });
    res.json({ ok: true });
  }
);
Fixed
// CORS66-004 — FIXED
router.delete('/:webhookId',
  cors(corsOptions),
  requireSession,
  verifyCsrfToken,
  requireOwnership('skillId'),
  async (req, res) => {
    const webhook = await db.webhooks.findOne({
      where: { id: req.params.webhookId, skillId: req.params.id },
    });
    if (!webhook) return res.status(404).json({ error: 'Not found' });
    // Soft-delete with audit trail
    await webhook.update({
      deletedAt: new Date(),
      deletedByUserId: req.session.userId,
    });
    await db.auditLog.create({
      type: 'webhook.deleted',
      skillId: req.params.id,
      webhookId: webhook.id,
      webhookUrl: webhook.url,
      actorId: req.session.userId,
    });
    res.json({ ok: true });
  }
);

SkillAudit detection: The scanner identifies CORS66 patterns using three AST query classes: cors({origin:true,credentials:true}) on route handlers containing /webhooks; res.setHeader('Access-Control-Allow-Origin', req.headers.origin) before the ownership check; and webhook.destroy() or webhooks.destroy() without a soft-delete .update({deletedAt:...}) pattern in the same handler. Submit your MCP skill registry codebase to SkillAudit for a full audit report.

Related: SA-SKL-CORS65 blog post: CORS in API key management endpoints • All advisories