← Security advisories

Claude MCP skill CORS misconfiguration — skill search and discovery indexing endpoints — SA-SKL-CORS60

SA-SKL-CORS60 documents four CORS misconfiguration vulnerabilities in MCP skill registry search and discovery indexing endpoints. Search indexing endpoints govern how skills appear in marketplace search results, controlling ranking weights, boosting rules, and which skills are suppressed from public visibility. CORS60 identifies four distinct cross-origin attack paths: credential-bearing CORS on the search index configuration endpoint exposes internal ranking weights and the full suppressed skill list; wildcard ACAO on the reindex trigger allows any page to manipulate boost rules mid-reindex and suppress legitimate skills; a timing oracle via Origin reflection before ownership check identifies active admin reindex sessions as exfiltration targets; and credential-bearing CORS on the index entry deletion endpoint allows any cross-origin page to silently remove skills from search results without deleting them from the registry.

SA-SKL-CORS60 findings at a glance
CRITICALCORS60-001 — GET /api/search/index has cors({origin:true,credentials:true}) — any origin reads full search index configuration including internal ranking weights, boosting rules, and suppressed skill list using victim admin session; exposes commercial ranking decisions and identifies suppressed competitors
CRITICALCORS60-002 — POST /api/search/index/reindex has ACAO:* — any page triggers full search index rebuild under victim admin identity; can suppress legitimate skills by modifying boost rules mid-reindex; fix: remove wildcard; require session; requireRole('admin'); CSRF token; Zod ReindexSchema; audit log
MEDIUMCORS60-003 — GET /api/search/index/stats reflects Origin before ownership check — timing oracle reveals index modification velocity identifying live admin reindex sessions as CORS60-001 targets; fix: auth before CORS; unified WHERE; 60ms constant-time floor
CRITICALCORS60-004 — DELETE /api/search/index/entries/:skillId has cors({origin:true,credentials:true}) — any origin removes any skill from the search index using victim admin session, making skills undiscoverable without deletion from the registry; fix: allowlist + requireSession + ownership check + notify skill owner + audit log

CORS60-001 — Credential-bearing CORS on search index config exposes ranking weights and suppressed skill list

Severity: CRITICAL

The search index configuration endpoint uses cors({origin: true, credentials: true}), which mirrors any Origin header back as Access-Control-Allow-Origin and also sets Access-Control-Allow-Credentials: true. This combination allows any website to make a cross-origin fetch that includes the victim's session cookie. When an admin visits an attacker-controlled page, that page silently reads the full search index configuration — including internal ranking weights that determine how skills are promoted in marketplace search results, boosting rules that prioritize certain publishers or categories, and the full list of suppressed skills that have been removed from search visibility without being deleted from the registry.

The suppressed skill list is especially sensitive: it may contain competitor skills that were administratively de-ranked, flagged skills pending review, or skills suppressed due to unreported security issues. This data constitutes competitive intelligence and reveals the registry's internal moderation strategy. The ranking weights expose which signals the marketplace uses to surface skills, enabling an attacker to game the algorithm for skills they control.

An attacker who exfiltrates this configuration via CORS60-001 can use the suppressed skill list as a targeting map for CORS60-002, triggering reindex operations that modify boost rules to suppress additional legitimate skills or restore previously suppressed malicious ones.

Mirroring the Origin header is equivalent to a wildcard with credentials. cors({origin: true}) does not restrict cross-origin access — it reflects every caller's origin back, granting unrestricted cross-origin read access to any authenticated session. CORS origin configuration must be an explicit allowlist of trusted domains, never a reflection of the caller-supplied value.

Vulnerable
// GET /api/search/index — mirrors origin, allows credentials
router.get('/search/index', cors({ origin: true, credentials: true }), requireSession, async (req, res) => {
  const config = await SearchIndex.findOne({ registry: 'default' });
  // returns rankingWeights, boostRules, suppressedSkillIds, internalScoringParams
  return res.json({ config });
});
Fixed
// GET /api/search/index — explicit allowlist, session + role required, suppressed list redacted
const CORS_ALLOWLIST = (process.env.CORS_ORIGINS || '').split(',').map(s => s.trim());

router.get(
  '/search/index',
  cors({ origin: (o, cb) => cb(null, CORS_ALLOWLIST.includes(o)), credentials: true }),
  requireSession,
  requireRole('admin'),
  async (req, res) => {
    const config = await SearchIndex.findOne({ registry: 'default' })
      .select('boostRules updatedAt -suppressedSkillIds -rankingWeights -internalScoringParams');
    return res.json({ config });
  }
);

CORS60-002 — Wildcard ACAO on reindex trigger enables suppression of legitimate skills

Severity: CRITICAL

The reindex trigger endpoint sets Access-Control-Allow-Origin: *. Even though the wildcard prevents standard session cookie forwarding, the endpoint processes session tokens supplied via a custom header or URL parameter — a pattern common in older registry APIs. An attacker page lures an admin and uses JavaScript's fetch() to POST a crafted reindex request that includes modified boost rules designed to suppress competitors or elevate attacker-controlled skills. The reindex operation runs synchronously under the victim admin's identity, with the full audit trail attributed to the victim.

The attack is particularly difficult to detect because the reindex operation appears legitimate in monitoring dashboards — it is indistinguishable from an authorized administrative action. Skills suppressed via boost rule manipulation during the reindex remain undiscoverable through normal search, but their registry entries are intact, so the suppression is not reflected in deletion logs. Recovery requires identifying the specific boost rules that changed during the attacker-controlled reindex window and reverting them manually.

Wildcard ACAO on write endpoints that accept custom-header session tokens is never safe. Even when session cookies cannot be forwarded by the browser in CORS requests with wildcard ACAO, write endpoints that accept session tokens in custom headers or query parameters remain fully exploitable from any origin. Reindex endpoints must enforce session authentication, CSRF token validation, and role-based access control regardless of CORS configuration.

Vulnerable
// POST /api/search/index/reindex — wildcard ACAO, no CSRF, no ownership check
router.post('/search/index/reindex', cors({ origin: '*' }), async (req, res) => {
  const { boostRules, suppressedSkillIds } = req.body;
  // no session check, no CSRF, no Zod validation
  await SearchIndex.updateOne({ registry: 'default' }, { boostRules, suppressedSkillIds });
  await triggerReindex();
  return res.json({ reindexing: true });
});
Fixed
// POST /api/search/index/reindex — allowlist CORS + session + CSRF + Zod + audit log
import { z } from 'zod';
const ReindexSchema = z.object({
  reason: z.string().max(500),
  dryRun: z.boolean().default(false),
});

router.post(
  '/search/index/reindex',
  cors({ origin: (o, cb) => cb(null, CORS_ALLOWLIST.includes(o)), credentials: true }),
  requireSession,
  requireRole('admin'),
  verifyCsrf,
  async (req, res) => {
    const parsed = ReindexSchema.safeParse(req.body);
    if (!parsed.success) return res.status(400).json({ error: parsed.error });

    const jobId = await scheduleReindex({ initiatedBy: req.session.userId, ...parsed.data });

    await AuditLog.create({
      action: 'search.reindex.triggered', actorId: req.session.userId,
      jobId, reason: parsed.data.reason, at: new Date(),
    });

    return res.status(202).json({ jobId });
  }
);

CORS60-003 — Timing oracle via Origin reflection before ownership check on index stats endpoint

Severity: MEDIUM

The search index stats endpoint reflects the caller-supplied Origin header as Access-Control-Allow-Origin before evaluating the authentication and ownership check. This creates a measurable timing channel: a request from an origin with an active admin session completes the stats query slightly faster than one that hits the unauthorized branch of the ownership check. An attacker script iterates registry indexes and measures response latency from a cross-origin context, using the timing delta to identify which indexes are actively being managed with live admin sessions.

Indexes with high modification velocity — indicated by high reindex frequency in the stats response timing pattern — are prime targets for CORS60-001 credential exfiltration. These indexes are the ones where suppressed skill data is most likely to be current and commercially sensitive. The timing oracle does not directly exfiltrate data, but it dramatically reduces the attacker's reconnaissance burden before launching the higher-impact CORS60-001 and CORS60-002 attacks.

Vulnerable
// GET /api/search/index/stats — Origin reflected BEFORE auth check
router.get('/search/index/stats', cors({ origin: true }), async (req, res) => {
  const config = await SearchIndex.findOne({ registry: 'default' }); // ownership check here
  if (!config || config.adminId.toString() !== req.session?.userId) {
    return res.status(403).json({ error: 'Forbidden' });
  }
  const stats = await SearchIndexStats.findOne({ registry: 'default' });
  return res.json({ stats });
});
Fixed
// GET /api/search/index/stats — auth first, constant-time floor, unified WHERE
const MIN_RESPONSE_MS = 60;

router.get(
  '/search/index/stats',
  requireSession,
  cors({ origin: (o, cb) => cb(null, CORS_ALLOWLIST.includes(o)), credentials: true }),
  async (req, res) => {
    const start = Date.now();

    const stats = await SearchIndexStats.findOne({
      registry: 'default',
      adminId: req.session.userId, // unified WHERE — same query regardless of ownership
    }).select('lastReindexAt entryCount -reindexHistory');

    const elapsed = Date.now() - start;
    if (elapsed < MIN_RESPONSE_MS) {
      await new Promise(r => setTimeout(r, MIN_RESPONSE_MS - elapsed));
    }

    if (!stats) return res.status(403).json({ error: 'Forbidden' });
    return res.json({ stats });
  }
);

CORS60-004 — Credential-bearing CORS on index entry deletion makes skills undiscoverable

Severity: CRITICAL

The index entry deletion endpoint uses cors({origin: true, credentials: true}). When an admin is logged in and visits an attacker-controlled page, the page can silently DELETE the search index entry for any skill, authenticated by the victim's session cookie. Unlike registry deletion, removing a search index entry makes the skill undiscoverable through the marketplace search interface without removing it from the registry. Users who have bookmarked the skill's direct URL can still access it, but new users searching for the skill's functionality will not find it. This is a targeted suppression attack that is difficult to attribute to a specific action because the registry itself shows the skill as active and published.

The skill owner receives no notification. The deletion is attributed to the victim admin in the audit log, making post-incident forensic analysis difficult. For high-traffic skills that depend on search discovery for new user acquisition, an index entry deletion causes immediate and significant revenue impact that the skill owner may attribute to algorithm changes rather than a security incident. Recovery requires the skill owner to contact registry support and request manual re-indexing.

Index entry deletion is a high-impact write operation requiring full CORS hardening. Removing a skill from search results suppresses its discoverability without leaving an obvious trail in the registry. Deletion endpoints must enforce explicit CORS allowlists, session authentication with ownership verification, and email or webhook notifications to the affected skill owner on every deletion event.

Vulnerable
// DELETE /api/search/index/entries/:skillId — mirrors origin, allows credentials, no ownership check
router.delete(
  '/search/index/entries/:skillId',
  cors({ origin: true, credentials: true }),
  requireSession,
  async (req, res) => {
    // no ownership check — any authenticated admin session can remove any skill from search
    await SearchIndexEntry.deleteOne({ skillId: req.params.skillId });
    return res.json({ deleted: true });
  }
);
Fixed
// DELETE /api/search/index/entries/:skillId — allowlist CORS + ownership + notification + audit
router.delete(
  '/search/index/entries/:skillId',
  cors({ origin: (o, cb) => cb(null, CORS_ALLOWLIST.includes(o)), credentials: true }),
  requireSession,
  requireRole('admin'),
  async (req, res) => {
    const skill = await Skill.findById(req.params.skillId).select('ownerId publisherEmail name');
    if (!skill) return res.status(404).json({ error: 'Skill not found' });

    // require the acting admin to own the skill or have registry-level admin role
    if (skill.ownerId.toString() !== req.session.userId && !req.session.roles.includes('registry_admin')) {
      return res.status(403).json({ error: 'Forbidden' });
    }

    await SearchIndexEntry.deleteOne({ skillId: req.params.skillId });

    await AuditLog.create({
      action: 'search.index.entry.deleted', actorId: req.session.userId,
      skillId: req.params.skillId, at: new Date(),
    });

    // notify skill owner so they can investigate and request re-indexing
    await notifyIndexEntryDeletion({ skillId: skill._id, skillName: skill.name,
      ownerEmail: skill.publisherEmail, deletedBy: req.session.userId });

    return res.json({ deleted: true });
  }
);

All four SA-SKL-CORS60 vulnerabilities reflect a consistent pattern of overly permissive CORS configuration on search administration endpoints that control the commercial discoverability of skills in the registry marketplace. SkillAudit detects CORS60-001 and CORS60-004 by flagging cors({origin:true,credentials:true}) usage on search index routes; CORS60-002 by detecting wildcard ACAO on POST routes handling index rebuild operations; and CORS60-003 by detecting CORS header emission before authentication checks in route handler chains. See also SA-SKL-CORS59 on version pinning and dependency lock endpoints for the companion chain targeting version management CORS misconfigurations.

Compound attack chain: CORS60-003 → CORS60-001 → CORS60-002 → CORS60-004

The four CORS60 findings compose into a complete search manipulation kill chain. An attacker first exploits the timing oracle (CORS60-003) to identify indexes with high modification velocity and active admin sessions without triggering authentication failures. With target indexes identified, the attacker uses CORS60-001 to exfiltrate the full search index configuration — obtaining the current boost rules, the suppressed skill list, and the internal scoring parameters used to rank search results.

Armed with the current configuration, the attacker crafts a reindex payload (CORS60-002) that modifies boost rules to suppress competitors and elevate attacker-controlled skills. Because the reindex is triggered under the victim admin's session, it appears as a legitimate administrative action in monitoring. Finally, to cover the attack and ensure targeted skills remain undiscoverable even if the boost rule manipulation is detected, the attacker uses CORS60-004 to delete the index entries for the most threatening competitor skills outright, making them invisible in marketplace search without removing them from the registry.

The result is a silently manipulated search index attributed to a legitimate admin, with targeted skills suppressed at both the boost rule level and the index entry level, creating a durable competitive suppression effect that persists until the registry operators manually investigate the audit log and perform a clean reindex from a known-good configuration.

SkillAudit detection

SkillAudit's static analysis rules detect all four CORS60 vulnerability classes during CI pipeline scanning. The CORS credential mirroring detector flags any route handler that passes {origin: true, credentials: true} or {origin: (o, cb) => cb(null, true), credentials: true} to the cors() middleware on endpoints under /search/ or /index/ path segments. The wildcard ACAO detector flags any route that sets Access-Control-Allow-Origin: * on POST, PUT, PATCH, or DELETE handlers. The CORS-before-auth detector flags route handler chains where cors() middleware appears before requireSession() or equivalent authentication middleware. All findings include remediation snippets and links to this advisory.