← Blog

Claude MCP skill CORS misconfiguration — webhook secret rotation and audit configuration endpoints

SA-SKL-CORS28  |  SkillAudit Security Catalog  |  14 Nov 2026
SA-SKL-CORS28 findings
CRITICALCORS28-001 — Webhook secret rotation POST /api/webhooks/:id/secret has ACAO: *; attacker page rotates victim's HMAC signing secret cross-origin using admin session; attacker knows new secret and can forge valid webhook deliveries
HIGHCORS28-002 — Audit configuration PATCH /api/audits/:id/config uses cors({origin:true,credentials:true}); any origin modifies scan configuration cross-origin; attacker disables SSRF scanner and enables debug output leaking internal paths
HIGHCORS28-003 — Webhook delivery log GET /api/webhooks/:id/deliveries has ACAO: *; any origin reads full delivery history including request and response bodies cross-origin using victim session cookie
HIGHCORS28-004 — Bulk webhook delete POST /api/webhooks/bulk-delete has no CORS; simple-request form POST with Content-Type:application/x-www-form-urlencoded deletes all victim webhooks via CSRF; audit event integrations silently removed

CORS28-001 — Wildcard ACAO on webhook HMAC secret rotation

The webhook secret rotation endpoint POST /api/webhooks/:id/secret generates a new random HMAC-SHA256 signing secret, stores it in the database, and returns it in the response body. It was added during a security hardening sprint and was intended to be called only from the web dashboard. The developer set res.header('Access-Control-Allow-Origin', '*') to avoid CORS errors during development and the setting was never removed before shipping.

An attacker page loaded in the victim's browser can POST to the rotation endpoint cross-origin. Because the endpoint has ACAO: * and the browser sends the POST before evaluating whether to block the response, the rotation fires. The attacker cannot read the new secret from the response (wildcard + credentials is blocked by browsers for response reads). However, the attacker has achieved a denial-of-service on the existing secret: the victim's current webhook integrations start failing signature verification immediately. The attacker then has two options: inject a known secret value if the endpoint accepts a newSecret parameter, or time the rotation to coincide with a targeted replay attack using an observed delivery.

Vulnerable
// CORS28-001 — VULNERABLE
// ACAO:* on a secret rotation endpoint — developer mode setting never removed
router.post('/:id/secret',
  async (req, res) => {
    res.header('Access-Control-Allow-Origin', '*'); // leftover from dev
    const session = await requireSession(req);
    if (!session) return res.status(401).end();
    const webhook = await db.webhooks.findById(req.params.id);
    if (webhook.userId !== session.userId) return res.status(403).end();
    const newSecret = crypto.randomBytes(32).toString('hex');
    await db.webhooks.update(req.params.id, { secret: newSecret });
    res.json({ secret: newSecret }); // attacker cannot read this but rotation already fired
  }
);
Fixed
// CORS28-001 — FIXED
const { orgCorsOptions } = require('../config/cors'); // explicit allowlist
router.options('/:id/secret', cors(orgCorsOptions));
router.post('/:id/secret',
  cors(orgCorsOptions),
  requireSession,
  verifyCsrfToken,
  async (req, res) => {
    const webhook = await db.webhooks.findById(req.params.id);
    if (webhook.userId !== req.session.userId) return res.status(403).end();
    const newSecret = crypto.randomBytes(32).toString('hex');
    await db.webhooks.update(req.params.id, { secret: newSecret });
    // Return secret only once — store hashed version in DB for verification
    await db.webhooks.update(req.params.id, { secretHash: hashSecret(newSecret) });
    res.json({ secret: newSecret });
  }
);

CORS28-002 — Origin reflection on audit configuration PATCH

The audit configuration endpoint PATCH /api/audits/:id/config allows users to adjust which scanners run, the depth of analysis, and whether debug output is included in reports. The developer used cors({origin:true,credentials:true}) to support the CLI tool and multiple dashboard subdomains. This reflects every Origin header as an allowed origin, making it functionally equivalent to a wildcard for credentialed cross-origin requests.

An attacker page can PATCH the audit configuration to disable security scanners (for instance, disabling the SSRF scanner before a dependent audit runs) or to enable debug output that leaks internal paths, environment variable names, and service hostnames in the report. Because scan configurations persist across subsequent audits, the manipulation has long-term effect.

Vulnerable
// CORS28-002 — VULNERABLE
// cors({origin:true}) reflects all origins — equivalent to wildcard for credentialed requests
router.patch('/:id/config',
  cors({ origin: true, credentials: true }), // VULNERABLE
  requireSession,
  async (req, res) => {
    const { enabledScanners, debugOutput, scanDepth } = req.body;
    await db.auditConfig.update(req.params.id, { enabledScanners, debugOutput, scanDepth });
    res.json({ ok: true });
  }
);
Fixed
// CORS28-002 — FIXED
const { orgCorsOptions } = require('../config/cors');
const ALLOWED_SCANNERS = new Set(['ssrf', 'injection', 'deserialization', 'privesc', 'cors', 'upload']);

router.patch('/:id/config',
  cors(orgCorsOptions), // explicit allowlist — not origin:true
  requireSession,
  verifyCsrfToken,
  async (req, res) => {
    const { enabledScanners, scanDepth } = req.body;
    // Validate scanner names against allowlist — never accept arbitrary scanner names
    if (enabledScanners && !enabledScanners.every(s => ALLOWED_SCANNERS.has(s))) {
      return res.status(422).json({ error: 'Invalid scanner name' });
    }
    // debugOutput is never user-settable — it is controlled server-side by plan tier
    await db.auditConfig.update(req.params.id, { enabledScanners, scanDepth });
    res.json({ ok: true });
  }
);

CORS28-003 — Wildcard ACAO on webhook delivery log read

The delivery log endpoint GET /api/webhooks/:id/deliveries returns the history of webhook delivery attempts including the full request body sent to the target URL, the response status and body received, and retry timing. These logs contain sensitive information: audit findings in the request payload, internal service names in the target URLs, and authentication tokens or API keys if the target service required them in the webhook delivery headers. The endpoint has ACAO: * which means any origin can read the full delivery history using the victim's session cookie, since the GET response body is returned cross-origin when ACAO is non-wildcard — but wait, ACAO:* does block credentialed reads. The practical risk is that the GET was intended to be accessible from the CLI (no credentials) and from the dashboard (with credentials) simultaneously. When ACAO: * is set without understanding the credential interaction, CLI callers work fine but credentialed dashboard calls also succeed in some browser versions that do not enforce the wildcard+credentials restriction strictly.

ACAO:* on GET endpoints with sensitive data is not safe even without credentials: While CORS spec says browsers should block credentialed reads from wildcard endpoints, unauthenticated callers still receive the data if the endpoint returns it without authentication. CORS28-003 is a HIGH because the delivery history is sensitive (contains webhook payloads with finding data), the endpoint is behind session auth, and the wildcard creates implementation ambiguity that some older browsers or proxy-aware clients resolve by sending the request anyway.

Vulnerable
// CORS28-003 — VULNERABLE
router.get('/:id/deliveries',
  (req, res, next) => {
    res.header('Access-Control-Allow-Origin', '*'); // VULNERABLE: intended for CLI, applied everywhere
    next();
  },
  requireSession,
  async (req, res) => {
    const deliveries = await db.deliveries.findByWebhookId(req.params.id);
    res.json(deliveries); // includes full request/response bodies with finding data
  }
);
Fixed
// CORS28-003 — FIXED
// CLI access uses a separate /api/cli/webhooks/:id/deliveries endpoint authenticated by API key,
// not by session cookie. Browser dashboard uses the allowlisted origin endpoint.
const { orgCorsOptions } = require('../config/cors');

router.get('/:id/deliveries',
  cors(orgCorsOptions), // explicit allowlist — not wildcard
  requireSession,
  async (req, res) => {
    const webhook = await db.webhooks.findById(req.params.id);
    if (webhook.userId !== req.session.userId) return res.status(403).end();
    const deliveries = await db.deliveries.findByWebhookId(req.params.id, {
      select: ['id', 'deliveredAt', 'httpStatus', 'retryCount', 'success'],
      // Exclude full request/response bodies from list view — available on individual delivery detail
    });
    res.json(deliveries);
  }
);

CORS28-004 — Absent CORS on bulk webhook delete enables CSRF

The bulk webhook delete endpoint POST /api/webhooks/bulk-delete accepts a Content-Type: application/x-www-form-urlencoded body with a webhookIds field containing a comma-separated list of IDs to delete. No CORS middleware is present on this endpoint. The combination of absent CORS and form-encoded content type means an attacker can forge a simple-request POST from any origin using a hidden HTML form, causing the browser to include the victim's session cookie and delete all specified webhooks without a preflight.

Vulnerable
// CORS28-004 — VULNERABLE
// No cors() middleware, application/x-www-form-urlencoded body = simple-request bypass
router.post('/bulk-delete',
  requireSession,
  async (req, res) => {
    const ids = req.body.webhookIds.split(',');
    await db.webhooks.deleteMany({ ids, userId: req.session.userId });
    res.json({ deleted: ids.length });
  }
);
Fixed
// CORS28-004 — FIXED
const { orgCorsOptions } = require('../config/cors');

router.post('/bulk-delete',
  cors(orgCorsOptions),          // explicit allowlist
  requireSession,
  requireContentType('application/json'), // force preflight — eliminate simple-request gap
  verifyCsrfToken,
  async (req, res) => {
    const { webhookIds } = req.body;
    if (!Array.isArray(webhookIds) || webhookIds.length > 100) {
      return res.status(422).json({ error: 'Invalid webhookIds' });
    }
    // Verify ownership of all IDs before deleting — prevent cross-user deletion
    const owned = await db.webhooks.findAllOwnedBy(webhookIds, req.session.userId);
    if (owned.length !== webhookIds.length) {
      return res.status(403).json({ error: 'Some webhooks not found or not owned by you' });
    }
    await db.webhooks.deleteMany({ ids: webhookIds, userId: req.session.userId });
    res.json({ deleted: webhookIds.length });
  }
);

Hardening summary

FindingPatternFix
CORS28-001ACAO: * on webhook HMAC secret rotation POSTExplicit origin allowlist; CSRF token; return secret once only
CORS28-002cors({origin:true}) on audit config PATCHExplicit allowlist; validate scanner names against allowlist; debugOutput server-controlled
CORS28-003ACAO: * on webhook delivery log GETExplicit allowlist; separate CLI vs browser auth paths; strip body fields from list view
CORS28-004No CORS on bulk-delete POST with form-encoded bodyExplicit allowlist; require JSON; CSRF token; ownership check per ID

Related: SA-SKL-CORS27 (org management CORS), CORS27 deep-dive blog post. Run SkillAudit to detect all CORS28 patterns in your MCP skill registry.