Claude MCP skill CORS misconfiguration — skill search and autocomplete suggestion endpoints

SA-SKL-CORS37 documents four CORS vulnerabilities in MCP skill registry skill search and autocomplete suggestion endpoints. Credential-bearing CORS on the personalized search endpoint lets any origin read private skill names from the victim org’s internal registry using the victim’s session; wildcard ACAO on the autocomplete endpoint exposes suggestions derived from the victim’s search history and recently accessed private skills; Origin reflection on the saved-search endpoint before ownership verification creates a timing oracle that reveals saved-search ID existence across all users; credential-bearing CORS on the search history endpoint lets any origin read the victim’s full query log including every private skill name they have ever searched.

Critical CORS37-001 — GET /api/skills/search has cors({origin:true,credentials:true}); any origin reads personalized search results including private skill names from the victim org’s internal registry via victim session
High CORS37-002 — GET /api/skills/autocomplete has ACAO:*; any page reads autocomplete suggestions generated from victim’s search history and recently accessed private skills
Medium CORS37-003 — POST /api/skills/search/save reflects Origin before ownership check; timing oracle reveals saved-search ID existence across all users
High CORS37-004 — GET /api/skills/search/history has cors({origin:true,credentials:true}); any origin reads full search history including private skill names queried by the victim

CORS37-001 — Credential-bearing CORS on personalized search leaks private skill names

MCP skill registries that support private or org-internal skills configure the search endpoint to blend public marketplace results with private org results based on the authenticated session. The search endpoint GET /api/skills/search returns personalized results — including the names, descriptions, and version histories of private skills visible only to the victim’s organization — with CORS configured via cors({origin:true,credentials:true}) to serve multiple internal dashboards. Any attacker page running in the victim’s browser can send a credentialed search request and read the full personalized result set, learning which private skills the org has developed or licensed.

Vulnerable
// CORS37-001 — VULNERABLE
router.get(
  '/skills/search',
  cors({ origin: true, credentials: true }), // reflects any Origin with credentials
  requireSession,
  async (req, res) => {
    const { q, page = 1, limit = 20 } = req.query;
    // Returns mixed public + private org results based on session
    const results = await skillSearch.query(q, {
      orgId: req.session.orgId,
      includePrivate: true, // private skill names and metadata visible cross-origin
      page, limit,
    });
    res.json(results);
  }
);

Personalized endpoints are always high-sensitivity: Any endpoint that returns different data based on the authenticated session must treat that data as having the sensitivity of the most privileged content it can return. A search endpoint that blends private results with public ones is a private data endpoint, not a public one — it must use an explicit allowlist, never an origin-reflecting wildcard.

Fixed
// CORS37-001 — FIXED
// Set-based allowlist; return only public skills for callers whose origin is not in the allowlist.
const ALLOWED_ORIGINS = new Set(['https://app.skillaudit.dev', 'https://skillaudit.dev']);
const searchCors = {
  origin: (origin, cb) => ALLOWED_ORIGINS.has(origin) || !origin ? cb(null, true) : cb(new Error('CORS')),
  credentials: true,
};

router.get('/skills/search', cors(searchCors), requireSession, async (req, res) => {
  const { q, page = 1, limit = 20 } = req.query;
  const results = await skillSearch.query(q, {
    orgId: req.session.orgId,
    includePrivate: true,
    page, limit,
  });
  res.json(results);
});

CORS37-002 — Wildcard ACAO on autocomplete exposes search history–derived suggestions

Autocomplete endpoints that learn from user behavior are particularly sensitive: the suggestions they return are derived from the victim’s historical search terms and recently accessed skills, including private ones. The GET /api/skills/autocomplete endpoint returns personalized suggestions based on session context with Access-Control-Allow-Origin: *. Even though a wildcard ACAO cannot be combined with Access-Control-Allow-Credentials: true in a spec-compliant browser, autocomplete responses that do not require cookies — because the session ID is embedded in a query parameter or derived from the host-bound cookie set by an earlier authenticated request — will be readable cross-origin, leaking the query-history-derived suggestion list to any attacker page.

Vulnerable
// CORS37-002 — VULNERABLE
router.get('/skills/autocomplete', async (req, res) => {
  res.header('Access-Control-Allow-Origin', '*'); // VULNERABLE — personalized suggestions readable by any origin
  const { q, sessionToken } = req.query; // session passed as query param — bypasses cookie restriction
  const session = await verifySessionToken(sessionToken);
  if (!session) return res.json({ suggestions: await publicAutocomplete(q) });

  // Personalized suggestions derived from victim's private search history
  const suggestions = await personalizedAutocomplete(q, session.userId, session.orgId);
  res.json({ suggestions });
});

Session tokens in query parameters make wildcard ACAO exploitable even without credentials: When the session is conveyed via a URL parameter rather than a cookie, the browser’s SameSite cookie protection does not apply, and the wildcard ACAO restriction (“wildcard + credentials is forbidden”) is bypassed — the attacker page reads the authenticated response without needing withCredentials: true.

Fixed
// CORS37-002 — FIXED
// Remove wildcard ACAO; require session via cookie only (not query param); return only public suggestions without session.
router.get('/skills/autocomplete', cors(searchCors), async (req, res) => {
  const { q } = req.query;
  if (!q || q.length < 1) return res.json({ suggestions: [] });

  const session = await verifySessionCookie(req); // cookie only — no query param tokens
  if (!session) {
    const suggestions = await publicAutocomplete(q);
    return res.json({ suggestions });
  }
  const suggestions = await personalizedAutocomplete(q, session.userId, session.orgId);
  res.json({ suggestions });
});

CORS37-003 — Origin reflection timing oracle on saved-search IDs enables cross-org enumeration

The saved-search update endpoint POST /api/skills/search/save allows users to persist named search queries for reuse. It reflects the Origin header before performing the ownership check. The timing difference between processing a valid saved-search ID belonging to another org (slow DB lookup + forbidden) versus an invalid ID (fast 404) is measurable cross-origin, allowing an attacker to enumerate which saved-search IDs exist across all organizations without reading their contents. Combined with sequential IDs or timestamp-ordered IDs, full saved-search existence across the registry is exposed.

Vulnerable
// CORS37-003 — VULNERABLE
router.post('/skills/search/save', async (req, res) => {
  res.header('Access-Control-Allow-Origin', req.headers.origin || '*'); // BEFORE auth — timing oracle
  res.header('Access-Control-Allow-Credentials', 'true');

  const session = await verifySession(req);
  if (!session) return res.status(401).json({ error: 'Unauthorized' });

  const { savedSearchId, name, filters } = req.body;

  // Fast path — ID existence check
  const exists = await db.savedSearches.exists(savedSearchId); // 1-3ms on cache hit
  if (!exists) return res.status(404).json({ error: 'Not found' }); // fast

  // Slow path — ownership verification
  const search = await db.savedSearches.findById(savedSearchId); // 8-15ms DB query
  if (search.userId !== session.userId) return res.status(403).json({ error: 'Forbidden' }); // reveals existence

  await db.savedSearches.update(savedSearchId, { name, filters });
  res.json({ updated: savedSearchId });
});
Fixed
// CORS37-003 — FIXED
// CORS applied via allowlist middleware; single WHERE id=$1 AND user_id=$2 query — unified timing.
router.post('/skills/search/save', cors(searchCors), requireSession, async (req, res) => {
  const { savedSearchId, name, filters } = req.body;
  // Single atomic query: ownership checked with existence — no timing oracle
  const search = await db.savedSearches.findByIdAndUser(savedSearchId, req.session.userId);
  if (!search) return res.status(404).json({ error: 'Saved search not found' });

  await db.savedSearches.update(savedSearchId, { name, filters });
  res.json({ updated: savedSearchId });
});

CORS37-004 — Credential-bearing CORS on search history leaks private skill query log

The search history endpoint GET /api/skills/search/history returns a paginated log of every search query the victim has ever submitted, including searches for private skills that exist only within the victim’s organization. This data reveals the org’s internal tooling vocabulary, in-progress projects (inferred from skill names searched), and competitive intelligence about which third-party skills are being evaluated. With cors({origin:true,credentials:true}), any attacker page running in the victim’s browser can read the full query log in a single request.

Vulnerable
// CORS37-004 — VULNERABLE
router.get(
  '/skills/search/history',
  cors({ origin: true, credentials: true }), // any origin reads victim's full search history
  requireSession,
  async (req, res) => {
    const { page = 1, limit = 50 } = req.query;
    const history = await db.searchHistory.findByUser(req.session.userId, { page, limit });
    // Includes private skill names the victim queried — leaks org tooling vocabulary cross-origin
    res.json({ history, total: history.total });
  }
);
Fixed
// CORS37-004 — FIXED
// Allowlist CORS; requireSession + ownership check; allow caller to redact private skill terms.
router.get('/skills/search/history', cors(searchCors), requireSession, async (req, res) => {
  const { page = 1, limit = 50 } = req.query;
  const history = await db.searchHistory.findByUser(req.session.userId, { page, limit });
  res.json({ history, total: history.total });
});

Related advisories: For credential-bearing CORS on audit result caching and diff comparison endpoints, see SA-SKL-CORS36. For CORS misconfigurations in team invitation and member onboarding endpoints, see SA-SKL-CORS35. For insecure deserialization in skill dependency graph and version resolution endpoints, see SA-SKL-DESER22.

Scan your MCP server or Claude skill

SkillAudit checks for CORS37, CORS36, SSRF, injection, prototype pollution, and 50+ more vulnerability patterns — in 60 seconds, with a shareable grade badge.

Get early access