← Security advisories

Claude MCP skill CORS misconfiguration — skill analytics and usage metrics endpoints — SA-SKL-CORS41

SA-SKL-CORS41 documents four CORS misconfiguration patterns in MCP skill registry analytics and usage metrics endpoints. Analytics endpoints contain some of the most competitively sensitive data a skill publisher holds — daily active users, geographic breakdowns, conversion funnels from browse to install, and cohort retention curves. Credential-bearing CORS on these endpoints hands that intelligence to any origin. Wildcard ACAO on export endpoints lets attackers exhaust per-org export quotas. A timing oracle on the funnel endpoint reveals which skills have conversion data system-wide. And credential-bearing CORS on the analytics purge endpoint lets any origin silently erase the usage history that informs billing, SLA compliance, and security forensics.

SA-SKL-CORS41 findings at a glance
CRITICALCORS41-001 — cors({origin:true,credentials:true}) on GET /api/skills/:id/analytics; any origin reads the full analytics dashboard including DAU, geographic breakdown, and conversion funnel using victim session
HIGHCORS41-002 — ACAO: * on POST /api/skills/:id/analytics/export; any page initiates a data export consuming victim org analytics quota; no CSRF or rate-limit protection
MEDIUMCORS41-003 — ACAO origin reflection on GET /api/skills/:id/analytics/funnel emitted before ownership check; timing oracle reveals funnel data existence system-wide across all orgs
CRITICALCORS41-004 — cors({origin:true,credentials:true}) on DELETE /api/skills/:id/analytics/data; any origin purges full analytics history for any skill using victim admin session; destroys billing baseline and forensic evidence

CORS41-001 — Credential-bearing CORS on analytics dashboard exposes usage intelligence

The analytics dashboard endpoint at GET /api/skills/:id/analytics returns aggregated usage intelligence: daily and monthly active users, install-to-use conversion rates, geographic breakdown by region, session duration percentiles, and the full conversion funnel from registry browse to first successful tool call. When this endpoint is configured with cors({origin:true,credentials:true}), any origin can retrieve this data using the victim's session cookie — without the victim ever knowing.

Analytics data is not incidentally sensitive; it is strategically sensitive. A skill publisher's DAU trend reveals growth or decline before any public signal. The geographic breakdown reveals which markets the organization is investing in. The conversion funnel reveals where users drop off — which is often the first thing a competitor wants to know when designing a competing product. For enterprise skill publishers, this data may also feed billing calculations: some registries charge based on active seat counts derived from analytics, meaning a data leak is also a billing exposure.

CORS41-001 fix: Replace cors({origin:true,credentials:true}) with an explicit allowlist. Add requireSession before CORS middleware. For public callers (non-owners), return only the total install count — no DAU, no geographic breakdown, no conversion funnel, no retention data.

// WRONG — full analytics dashboard to any origin via session cookie
router.get('/skills/:id/analytics',
  cors({origin: true, credentials: true}),
  async (req, res) => {
    const data = await analytics.getDashboard(req.params.id);
    res.json(data); // includes DAU, geo, funnel, cohorts
  }
);

// RIGHT — allowlist + session + public-only summary for non-owners
router.get('/skills/:id/analytics',
  requireSession,
  strictCors,
  async (req, res) => {
    const isOwner = await db.isSkillOwner(req.params.id, req.session.userId);
    if (isOwner) {
      const data = await analytics.getDashboard(req.params.id);
      return res.json(data);
    }
    // public callers: install count only
    const installs = await analytics.getPublicInstallCount(req.params.id);
    res.json({ installs });
  }
);

CORS41-002 — Wildcard ACAO on analytics export exhausts export quota

The analytics export endpoint POST /api/skills/:id/analytics/export initiates an asynchronous export job that bundles the full analytics dataset into a CSV or JSON archive and queues it for download. Each export job consumes quota against the requesting organization's monthly export budget — typically capped to prevent abuse of storage and compute resources. With ACAO: *, any page can initiate export jobs on behalf of any user whose Bearer token is accessible via XSS or any page they visit.

Export quota exhaustion has a concrete operational impact: when an organization's export quota is depleted, their legitimate analytics export workflows — scheduled data warehouse syncs, compliance audits, billing reconciliation — fail until the quota resets. For organizations with monthly export budgets, a single quota-exhaustion attack at the start of the month blocks analytics access for the full billing cycle.

CORS41-002 fix: Remove the wildcard. Add requireSession, a CSRF token check, and a per-org rate limit on export initiation. Export jobs requested by CI/CD pipelines should use scoped API keys, not session credentials.

CORS41-003 — Timing oracle on funnel endpoint reveals system-wide conversion state

The funnel endpoint GET /api/skills/:id/analytics/funnel reflects the Origin header before the ownership check executes. When a skill has funnel data, the server queries the funnel_events table (a potentially large time-series join), discovers ownership mismatch, and returns 403. When no funnel data exists or the skill ID is unknown, it returns 404 faster. The latency difference is measurable cross-origin because the browser's performance.now() API measures time to first response header, which arrives after the CORS header is emitted but before the response body.

An attacker uses this oracle to enumerate which skills across the entire registry have active conversion funnels — a signal that those skills have live users. Combined with public install count data from CORS41-001, this gives a cross-org picture of which skills are actively growing versus stagnant. For a competitor performing market reconnaissance, this oracle alone provides meaningful intelligence about the competitive landscape.

CORS41-003 fix: Move CORS middleware after auth and ownership checks. Unify the WHERE clause to include both skillId and orgId. Add a minimum-latency padding strategy to normalize 403 and 404 response times. Never emit the ACAO header for requests that fail authorization.

CORS41-004 — Credential-bearing CORS on analytics purge destroys usage history

The analytics data purge endpoint DELETE /api/skills/:id/analytics/data uses cors({origin:true,credentials:true}). An attacker who tricks an admin into visiting a malicious page can silently delete the entire analytics history for any skill in the organization. The impact is not just loss of business intelligence — it is loss of the billing baseline (some usage-based billing tiers depend on historical analytics), loss of forensic evidence for security investigations, and violation of data retention obligations under contracts that require audit logs of skill usage.

Analytics purge is particularly dangerous because it is often irreversible: unlike soft-deleteable application records, time-series analytics data is typically stored in append-only time-series databases or data warehouses where a delete permanently removes rows. A single cross-origin DELETE using a victim admin session can wipe months of data with no recovery path.

CORS41-004 fix: Replace credential-bearing CORS with an allowlist. Add requireRole('admin') and ownership verification. Implement soft-delete with a 90-day retention window before physical deletion. Emit an audit log entry. Require a secondary confirmation token sent via email before the purge executes. Never hard-delete analytics data in response to a single HTTP request.

// WRONG — hard analytics purge with credential-bearing CORS
router.delete('/skills/:id/analytics/data',
  cors({origin: true, credentials: true}),
  async (req, res) => {
    await db.query('DELETE FROM analytics_events WHERE skill_id = ?', [req.params.id]);
    res.json({ ok: true });
  }
);

// RIGHT — allowlist, role check, soft-delete with retention window, audit log
router.delete('/skills/:id/analytics/data',
  requireSession,
  requireRole('admin'),
  strictCors,
  async (req, res) => {
    const skill = await db.getSkill(req.params.id);
    if (!skill || skill.orgId !== req.session.orgId) return res.status(403).json({ error: 'forbidden' });

    const { confirmToken } = req.body;
    const valid = await tokens.verifyPurgeToken(req.session.userId, req.params.id, confirmToken);
    if (!valid) return res.status(403).json({ error: 'invalid confirmation token' });

    // soft-delete: mark for deletion, physically removed after 90-day retention window
    await db.query(
      'UPDATE analytics_events SET deletion_scheduled_at=NOW(), scheduled_by=? WHERE skill_id=? AND deletion_scheduled_at IS NULL',
      [req.session.userId, req.params.id]
    );
    await audit.log('analytics_purge_scheduled', { skillId: req.params.id, adminId: req.session.userId, retentionWindowDays: 90 });
    res.json({ ok: true, deletionScheduledAt: new Date().toISOString(), purgedAfter: '90 days' });
  }
);
Detect SA-SKL-CORS41 in your registry

SkillAudit scans for credential-bearing CORS reflection, wildcard ACAO on analytics export endpoints, and middleware-ordering timing oracles across all sub-routers in your MCP skill registry codebase.

Scan your registry
FindingSeverityEndpointImpact
CORS41-001CRITICALGET /api/skills/:id/analyticsFull analytics dashboard exfiltration including DAU and conversion funnels
CORS41-002HIGHPOST /api/skills/:id/analytics/exportAnalytics export quota exhaustion; blocks scheduled data warehouse syncs
CORS41-003MEDIUMGET /api/skills/:id/analytics/funnelTiming oracle reveals funnel data existence system-wide across all orgs
CORS41-004CRITICALDELETE /api/skills/:id/analytics/dataIrreversible analytics history purge destroys billing baseline and forensic evidence

See also: SA-SKL-CORS40 (dependency and compatibility check endpoint CORS patterns) and SA-SKL-CORS39 deep dive blog post for the compound pre-disclosure attack chain that credential-bearing CORS enables across version, dependency, and analytics endpoints.