Claude MCP skill CORS misconfiguration — skill search and discovery feed endpoints — SA-SKL-CORS53
SA-SKL-CORS53 documents four CORS misconfiguration patterns in MCP skill registry search and discovery feed endpoints. These surfaces touch the discovery graph of the entire skill ecosystem — a credential-bearing CORS misconfiguration here exposes not just the victim's data but the platform's private skill inventory and competitive ranking intelligence. Credential-bearing CORS on the search endpoint lets any origin read personalized results including private and unlisted skills visible only to privileged users. Wildcard ACAO on the saved-search creation endpoint allows any page to inject attacker-controlled search queries into the victim's discovery feed, poisoning the results surfaced on every future platform visit. A timing oracle on the trending endpoint reveals skill popularity velocity tiers before public boards update, leaking commercially sensitive growth signals. And credential-bearing CORS on the search history deletion endpoint allows any origin to silently erase the victim's complete search history, removing the forensic record of any reconnaissance the attacker has already conducted using prior vulnerabilities in this series.
cors({origin:true,credentials:true}) on GET /api/skills/search; any origin reads personalized search results including private/unlisted skills and session-dependent competitor ranking signals using victim session; fix: allowlist; requireSession for private results; public search returns only published skills with no session-dependent ranking signalsACAO: * on POST /api/skills/search/save; any page saves attacker-controlled search query as victim's saved search consuming quota and injecting attacker-controlled discovery feed entries; fix: remove wildcard; require session; CSRF token; Zod SavedSearchSchema; validate query against allowed field setACAO origin reflection on GET /api/skills/trending emitted before rate-limit check; timing oracle reveals trending skill popularity tiers with sub-millisecond precision before public boards update; fix: rate-limit before CORS emission; normalize timing across tierscors({origin:true,credentials:true}) on DELETE /api/skills/search/history; any origin clears victim's full search history removing forensic record of attacker reconnaissance; fix: allowlist + requireSession + ownership check + audit log on history clear eventsCORS53-001 — Credential-bearing CORS on search exposes private skills and session-dependent ranking signals
Severity: CRITICAL
The GET /api/skills/search endpoint is configured with cors({origin:true,credentials:true}), reflecting every origin back as Access-Control-Allow-Origin and setting Access-Control-Allow-Credentials: true. Cross-origin JavaScript can issue authenticated search requests and read the full response body using the victim's session cookie.
The search endpoint's session-aware behavior is what makes this critical. For authenticated users, the query pipeline includes a session-dependent filter that surfaces private and unlisted skills visible only to the victim's privilege tier — unpublished drafts, private organization skills, and skills shared with the victim directly. It also applies a personalized ranking model that reflects the victim's behavioral signals, boosting competitors they interact with and revealing which alternatives the platform algorithmically prioritizes for their usage profile. An attacker who reads this data can enumerate the full set of private skills the victim has access to, understand the platform's competitive positioning intelligence for the victim's category, and identify the highest-ranked unpublished competitors to target for prior-art challenges or coordinated negative reviews before those skills reach public listing.
// GET /api/skills/search — cors({origin:true,credentials:true}) inherited from router
router.get('/search', async (req, res) => {
const { q, page = 1, limit = 20 } = req.query;
const userId = req.session?.userId;
// session-dependent filter includes private/unlisted skills for privileged users
const filter = buildSearchFilter(q, userId);
const results = await Skill.find(filter)
.sort(personalizedRanking(userId))
.skip((page - 1) * limit)
.limit(limit);
return res.json(results);
});
// GET /api/skills/search — split public vs authenticated paths; never mix session signals into public response
const searchCors = cors({ origin: ALLOWED_ORIGINS, credentials: true });
router.get('/search', searchCors, async (req, res) => {
const { q, page = 1, limit = 20 } = req.query;
// Public path: only published, public skills; no session-dependent ranking
if (!req.session?.userId) {
const results = await Skill.find({
status: 'published',
visibility: 'public',
$text: { $search: z.string().max(200).parse(q) },
})
.sort({ relevanceScore: -1, publishedAt: -1 })
.skip((page - 1) * 20)
.limit(20)
.select('name slug tagline auditGrade publishedAt -_id');
return res.json(results);
}
// Authenticated path: session-gated; apply visibility filter
const userId = req.session.userId;
const filter = buildAuthenticatedSearchFilter(q, userId); // only skills user can see
const results = await Skill.find(filter)
.sort({ relevanceScore: -1, publishedAt: -1 })
.skip((page - 1) * 20)
.limit(20);
return res.json(results);
});
CORS53-002 — Wildcard ACAO on saved-search creation injects attacker-controlled discovery feed entries
Severity: HIGH
The POST /api/skills/search/save endpoint returns Access-Control-Allow-Origin: *. This endpoint persists a named search query to the victim's account for display in the platform's personalized discovery feed — the sidebar panel shown on every return visit. Any web page can induce the victim's browser to issue a cross-origin POST that creates a saved search with attacker-controlled query parameters.
The discovery feed renders the saved search query label and executes the saved search on page load, populating the feed with results for whatever the attacker specified. An attacker who controls a saved search name and query can substitute a trusted platform search term with an attacker-controlled one — for example, replacing a victim's saved security audit search with one that surfaces only attacker-owned skills ranked to appear as platform recommendations. Because the discovery feed is session-persistent and visually indistinguishable from the victim's own saved searches, this constitutes a persistent discovery manipulation with no session TTL. It also consumes the victim's saved search quota, eventually preventing the creation of legitimate saved searches once the quota ceiling is reached.
Saved search injection is persistent UI manipulation, not just a data leak. Unlike session-scoped CORS reads, a saved search created by an attacker continues to populate the victim's discovery feed on every subsequent platform visit until the victim notices and deletes it. Combined with CORS53-001 (search result enumeration), an attacker can read which terms the victim uses most, replace them with attacker-controlled versions, and monitor whether the victim adopted the injected recommendations.
// POST /api/skills/search/save — ACAO:* with no CSRF or input validation
router.post('/search/save', requireSession, async (req, res) => {
const { name, query } = req.body;
await SavedSearch.create({
userId: req.session.userId,
name,
query, // attacker-controlled; no field validation
});
return res.status(201).json({ saved: true });
});
// POST /api/skills/search/save — per-route allowlist cors + CSRF + Zod validation
const savedSearchCors = cors({ origin: ALLOWED_ORIGINS, credentials: true });
const SavedSearchSchema = z.object({
name: z.string().min(1).max(80),
query: z.object({
q: z.string().max(200),
filters: z.object({
category: z.string().optional(),
auditGrade: z.enum(['A', 'B', 'C', 'D', 'F']).optional(),
minAuditScore: z.number().min(0).max(100).optional(),
}).strict(),
}).strict(),
});
router.post('/search/save', savedSearchCors, requireSession, verifyCsrf, async (req, res) => {
const parsed = SavedSearchSchema.safeParse(req.body);
if (!parsed.success) return res.status(400).json({ error: 'Invalid saved search' });
const count = await SavedSearch.countDocuments({ userId: req.session.userId });
if (count >= 20) return res.status(429).json({ error: 'Saved search quota reached' });
await SavedSearch.create({ userId: req.session.userId, ...parsed.data });
return res.status(201).json({ saved: true });
});
CORS53-003 — Timing oracle on trending endpoint reveals skill velocity tiers before public boards update
Severity: MEDIUM
The GET /api/skills/trending endpoint reflects the Origin header before performing the rate-limit check. The trending query buckets skills into velocity tiers based on install counts, audit runs, and bookmark additions in a rolling window. Skills in the top tier trigger a cache hit that responds in under 5 ms; skills in lower tiers hit the aggregation pipeline and respond in 40–120 ms. The latency difference is cross-origin-detectable even without reading the response body, because the browser exposes the round-trip time to JavaScript regardless of CORS policy on response bodies.
An attacker who polls the trending endpoint for a target skill ID can detect tier transitions with sub-millisecond precision — days or hours before the public trending board updates on its weekly cadence. This timing intelligence constitutes advance commercial knowledge: a skill crossing into the top velocity tier is about to receive organic discovery traffic boost, and an attacker who knows this in advance can prepare competing skills for launch, acquire the skill at pre-trend valuation if the marketplace supports trading, or time coordinated negative review campaigns to intercept traffic before the trending badge appears.
The fix performs rate limiting before emitting any CORS header, uses a uniform query path for all tier levels, and adds a constant-time response floor of 20 ms across all tiers to eliminate the latency signal.
CORS53-004 — Credential-bearing CORS on search history deletion erases forensic reconnaissance records
Severity: HIGH
The DELETE /api/skills/search/history endpoint shares the same cors({origin:true,credentials:true}) policy as CORS53-001. Any web page can instruct the victim's browser to clear the victim's complete search history using their session cookie — there is no ownership confirmation and no partial-clear capability.
Search history is a forensic artifact with two distinct values. For the victim, it records what reconnaissance the attacker has already conducted via CORS53-001 — an attacker who reads private skill data via the search CORS vulnerability can then erase the history entries that would reveal what they searched for, removing the trail that platform security tooling or the victim could use to detect the exfiltration. For the platform operator, search history informs abuse detection: bulk reads of private skill names indicate credential stuffing or insider threat activity, and clearing the history resets the detection signal. The combined attack sequence of CORS53-001 (enumerate private skills via victim search) followed by CORS53-004 (erase history to defeat forensic detection) is a complete cover-your-tracks chain executable entirely from an attacker-controlled web page.
// DELETE /api/skills/search/history — no audit log, no granularity
router.delete('/search/history', requireSession, async (req, res) => {
await SearchHistory.deleteMany({ userId: req.session.userId });
return res.status(204).end();
});
// DELETE /api/skills/search/history — allowlist cors + audit log
const searchHistoryCors = cors({ origin: ALLOWED_ORIGINS, credentials: true });
router.delete('/search/history', searchHistoryCors, requireSession, verifyCsrf, async (req, res) => {
const count = await SearchHistory.countDocuments({ userId: req.session.userId });
await SearchHistory.deleteMany({ userId: req.session.userId });
await AuditLog.create({
action: 'user.search.history.cleared',
userId: req.session.userId,
entriesDeleted: count,
requestIp: req.ip,
timestamp: new Date(),
});
return res.status(204).end();
});
Remediation summary
| Finding | Severity | Primary remediation | Secondary hardening |
|---|---|---|---|
| CORS53-001 | Critical | Replace origin:true with allowlist; split public vs. authenticated search paths; never include session-dependent ranking in unauthenticated responses | Gate private/unlisted skill visibility on explicit session ownership check; audit all search result fields for sensitivity |
| CORS53-002 | High | Remove ACAO: *; require session, CSRF token; Zod SavedSearchSchema with allowed-field constraint | Enforce saved-search quota; validate query fields against schema rather than passing raw to DB; add feed poisoning detection heuristic |
| CORS53-003 | Medium | Rate-limit before CORS header emission; normalize response latency across velocity tiers with 20 ms floor | Unified query path regardless of tier; add jitter to timing-sensitive endpoints |
| CORS53-004 | High | Replace origin:true with allowlist; require CSRF token; audit log all history clear events with entry count and requestIp | Add partial-clear capability (by time range or specific entries) to reduce blast radius of legitimate clears; alert on anomalous bulk clear patterns |
Find CORS misconfigurations like these before attackers do. SkillAudit scans your MCP skill registry search and discovery endpoints for all four SA-SKL-CORS53 patterns plus the broader CORS advisory series. See the SA-SKL-CORS52 API key management advisory and the SA-SKL-CORS51 organization invitation advisory for related findings. Connect your repository at skillaudit.dev.