SA-SKL-CORS39 — CORS Misconfiguration
CORS Misconfiguration in MCP Skill Registry Skill Version and Changelog Management Endpoints
Version and changelog management endpoints carry some of the most commercially sensitive data in a skill registry: unreleased feature descriptions, planned security patch timelines, internal draft names, and the full lineage of breaking changes. CORS39 covers four patterns that expose this data to any origin — credential-bearing CORS on the version history endpoint lets any page read the full list including draft versions and unannounced security patches using the victim’s session; wildcard ACAO on the draft creation endpoint lets any page consume the victim’s authoring quota and overwrite in-progress work; Origin reflection before the ownership query on the changelog endpoint creates a timing oracle that reveals which private skills have unpublished changelog entries; and credential-bearing CORS on the version deletion endpoint lets any origin instruct the registry to remove a pinned version via the victim’s admin session, silently breaking all downstream installations that have locked to that version.
GET /api/skills/:id/versions uses cors({origin:true,credentials:true}); any origin reads full version history including draft versions with unreleased feature descriptions and planned security patch content using victim session; fix: set-based allowlist at router level; requireSession; return only published versions for public callers; never return draft version contentPOST /api/skills/:id/versions/draft has ACAO: *; any page creates a draft version on behalf of victim consuming authoring quota, potentially overwriting existing draft content, and triggering pre-publish notification workflows; fix: remove wildcard; require session; CSRF token; requireRole('author'); verify skill ownershipGET /api/skills/:id/changelog reflects Origin before ownership check; timing oracle reveals changelog entry existence for private skills across all organizations; fix: unified WHERE skillId AND orgId; auth and ownership enforced before CORS header emission; identical response latency for not-found vs wrong-ownerDELETE /api/skills/:id/versions/:versionId uses cors({origin:true,credentials:true}); any origin deletes any version using victim admin session, breaking pinned installations across all consuming registries; fix: allowlist CORS at router level + requireRole('admin') + soft-delete only (status='yanked') + audit log + webhook notification to affected pinned-version consumersCORS39-001 — Credential-bearing CORS on version history reads draft versions and unreleased changelogs
The version listing endpoint GET /api/skills/:id/versions was designed to allow authorized partner portals to display published version history alongside install badges and compatibility matrices. The endpoint was assigned cors({origin:true,credentials:true}) so that partner portal origins could pass session cookies without being blocked by the browser’s preflight policy. Because origin:true in the Express cors package reflects whatever Origin header the browser sends back as Access-Control-Allow-Origin, the allowlist is effectively empty — any origin receives a credentialed grant.
An attacker who controls any page the victim has open in a tab can silently issue a fetch('/api/skills/target-skill-id/versions', {credentials:'include'}) cross-origin request. Because the CORS grant is reflected with credentials allowed, the browser delivers the response body to the attacker’s page. That body contains not just published version records but also draft versions that have never been announced — complete with internal version names, unreleased feature descriptions, and the full text of planned security patch entries before disclosure. For a commercial skill competing in the same niche as an attacker, this constitutes a continuous competitive intelligence feed. For a security-sensitive skill with a coordinated disclosure process, it allows an attacker to learn the patch content and release window before the patch ships, leaving users exposed during the window.
// CORS39-001 — VULNERABLE
// cors({origin:true,credentials:true}) — any origin reads draft versions and unreleased changelogs.
router.get('/:id/versions',
cors({ origin: true, credentials: true }), // VULNERABLE — reflects any Origin with credentials
requireSession,
async (req, res) => {
const versions = await db.versions.findBySkillId(req.params.id, {
includeUnpublished: true, // ← draft versions visible to authenticated callers
includeChangelogBody: true, // ← full unreleased changelog text included
});
res.json(versions);
}
);
// CORS39-001 — FIXED
// 1. Set-based allowlist at router level — no per-route CORS overrides.
// 2. requireSession on every version endpoint.
// 3. Return only published versions to non-admin callers.
// 4. Never return draft changelog body to public callers.
const ALLOWED_ORIGINS = new Set([
'https://app.skillaudit.dev',
'https://skillaudit.dev',
'https://partner-portal.example.com',
]);
router.use(cors({
origin: (o, cb) => ALLOWED_ORIGINS.has(o) || !o ? cb(null, true) : cb(new Error('CORS')),
credentials: true,
}));
router.get('/:id/versions', requireSession, async (req, res) => {
const isAdmin = req.session.role === 'admin';
const isOwner = await db.skills.isOwnedBy(req.params.id, req.session.orgId);
const versions = await db.versions.findBySkillId(req.params.id, {
statusFilter: (isAdmin || isOwner) ? undefined : 'published', // only published for public
includeChangelogBody: isAdmin || isOwner, // never expose draft changelog body externally
});
res.json(versions);
});
CORS39-002 — Wildcard ACAO on draft creation lets any page consume authoring quota and overwrite in-progress work
The draft version creation endpoint POST /api/skills/:id/versions/draft allows skill authors to save work-in-progress before committing to a formal release. The endpoint was given ACAO: * to support lightweight editor integrations embedded in external documentation tools. Because the endpoint performs a state-changing mutation using the victim’s session identity, the wildcard creates a request-forgery vector: any page the victim visits while logged into the registry can POST a crafted draft body on their behalf without any user interaction.
The consequences are broader than a typical CSRF. First, most registries enforce a per-author draft quota — a cap on how many simultaneous draft versions an author can maintain. A single forged draft exhausts one quota slot. If the attacker fires repeated requests, they can fill the victim’s entire draft quota, blocking them from saving legitimate work-in-progress. Second, if a draft already exists for the same skill, the forged request may overwrite it depending on upsert semantics — silently destroying the victim’s unpublished edits. Third, many registries fire pre-publish notification workflows when a draft is created or updated — notifying downstream consumers that a new version is imminent. Forge-creating a draft triggers these notifications erroneously, polluting consumer inboxes and potentially causing premature dependency upgrades.
// CORS39-002 — VULNERABLE
// ACAO:* on a mutating endpoint — any page creates a draft version via victim session.
router.post('/:id/versions/draft', async (req, res) => {
res.set('Access-Control-Allow-Origin', '*'); // VULNERABLE
const session = req.session;
if (!session) return res.status(401).json({ error: 'Unauthenticated' });
// No ownership check — any authenticated user can draft any skill
const draft = await db.versions.upsertDraft({
skillId: req.params.id,
authorId: session.userId,
version: req.body.version,
changelogBody: req.body.changelogBody,
features: req.body.features,
});
// Triggers pre-publish notification to all pinned-version consumers
await notifyConsumers(req.params.id, 'draft-updated');
res.status(201).json({ draftId: draft.id });
});
// CORS39-002 — FIXED
// 1. Remove ACAO:* — allowlist at router level handles CORS.
// 2. requireSession + verifyCsrfToken.
// 3. requireRole('author') — only authors may create draft versions.
// 4. Verify skill ownership before write.
// 5. Check draft quota before upsert to prevent exhaustion.
router.post('/:id/versions/draft',
requireSession,
verifyCsrfToken,
requireRole('author'),
async (req, res) => {
const isOwner = await db.skills.isOwnedBy(req.params.id, req.session.orgId);
if (!isOwner) return res.status(403).json({ error: 'Forbidden' });
const draftCount = await db.versions.countDraftsByOrg(req.session.orgId);
const draftLimit = await db.orgs.getDraftLimit(req.session.orgId);
if (draftCount >= draftLimit)
return res.status(429).json({ error: 'Draft quota exceeded' });
const { version, changelogBody, features } = req.body;
if (!version || typeof version !== 'string')
return res.status(400).json({ error: 'Invalid version string' });
const draft = await db.versions.upsertDraft({
skillId: req.params.id,
orgId: req.session.orgId,
authorId: req.session.userId,
version: version.slice(0, 32),
changelogBody: changelogBody?.slice(0, 10000) ?? '',
features: Array.isArray(features) ? features.slice(0, 50) : [],
});
// Only notify on explicit publish action, not every draft save
res.status(201).json({ draftId: draft.id });
}
);
CORS39-003 — Origin reflection before ownership check creates changelog timing oracle for private skills
The changelog endpoint GET /api/skills/:id/changelog returns the changelog entries for a given skill. For private skills, the registry enforces an ownership check: only members of the owning organization may read changelog content. The vulnerability arises because the CORS Origin reflection is applied as middleware that runs before the ownership-scoped database query. The browser’s timing API is precise enough — and cross-origin response timing is exposed even for opaque responses — that the latency difference between the two server-side code paths can be reliably distinguished from the attacking page.
The two paths are: (a) changelog exists and belongs to another organization — the server fetches the changelog record, checks ownership, finds a mismatch, and returns 403; (b) no changelog record exists for this skill ID at all — the server fetches nothing and returns 404. Path (a) takes measurably longer because it involves a successful database row fetch before the authorization comparison. By probing a large number of private skill IDs and measuring response latency, an attacker can build a map of which private skills have unpublished changelog entries — identifying in-progress release candidates and upcoming patch windows without reading the content itself. This information is sufficient to time coordinated attack campaigns to precede a security patch that the attacker knows is coming.
// CORS39-003 — VULNERABLE
// CORS emitted before ownership check — timing oracle via latency difference
// between "changelog exists but belongs to another org" vs "no changelog".
router.get('/:id/changelog',
cors({ origin: true, credentials: true }), // CORS emitted first — timing observable
requireSession,
async (req, res) => {
// Fetches changelog for ANY orgId first, then checks ownership
const changelog = await db.changelogs.findBySkillId(req.params.id); // scans all orgs
if (!changelog)
return res.status(404).json({ error: 'Not found' }); // fast path — no row fetch cost
if (changelog.orgId !== req.session.orgId)
return res.status(403).json({ error: 'Forbidden' }); // slow path — row already fetched
res.json(changelog.entries);
}
);
// CORS39-003 — FIXED
// 1. Allowlist CORS at router level — no per-route CORS overrides.
// 2. Single WHERE clause enforces skillId AND orgId simultaneously.
// 3. Identical response latency for not-found vs wrong-owner (both hit same code path).
// 4. Auth enforced before any CORS header is emitted.
router.get('/:id/changelog', requireSession, async (req, res) => {
// Single query — ownership enforced at the database level, not in application code.
// "Not found" and "wrong owner" are indistinguishable from the caller's perspective.
const changelog = await db.changelogs.findOne({
where: {
skillId: req.params.id,
orgId: req.session.orgId, // ownership in the same WHERE clause
},
});
if (!changelog) return res.status(404).json({ error: 'Not found' });
// Only return published entries to non-admin callers
const isAdmin = req.session.role === 'admin';
const entries = changelog.entries.filter(e => isAdmin || e.status === 'published');
res.json(entries);
});
CORS39-004 — Credential-bearing CORS on version deletion lets any origin break pinned installations via admin session
The version deletion endpoint DELETE /api/skills/:id/versions/:versionId allows registry administrators to remove a published version from the index. The endpoint uses cors({origin:true,credentials:true}), which reflects any browser-supplied Origin with a credentialed grant. Any page an admin user visits can silently issue a cross-origin DELETE request using the admin’s active session. The browser’s SameSite cookie default of Lax does not protect DELETE requests initiated via fetch() with credentials:'include' when the CORS response explicitly grants the requesting origin — the browser sends the cookie because the server has authorized the cross-origin read.
Version deletion is among the most destructive operations a registry admin can perform. MCP skill consumers frequently pin to a specific version in their agent manifests to guarantee behavioral stability across environment updates. When a pinned version is hard-deleted from the registry, every agent and pipeline that references that version identifier immediately fails at install time with a resolution error. The failure is silent from the registry’s perspective — there is no built-in mechanism to notify affected consumers that the version they depend on has been removed. An attacker who tricks a registry admin into visiting a malicious page can delete high-impact versions that are pinned by hundreds of downstream deployments, triggering cascading installation failures at a time of their choosing. Beyond direct disruption, an attacker could target the deletion of the most recent stable version of a security-patched release, forcing consumers who re-resolve to fall back to an older, unpatched version.
// CORS39-004 — VULNERABLE
// cors({origin:true,credentials:true}) + hard delete — any origin destroys pinned versions.
router.delete('/:id/versions/:versionId',
cors({ origin: true, credentials: true }), // VULNERABLE — reflects any Origin with credentials
requireSession,
requireRole('admin'),
async (req, res) => {
// Hard delete — no soft-delete, no audit trail, no consumer notification
await db.versions.deleteById(req.params.versionId);
res.json({ deleted: true });
}
);
// CORS39-004 — FIXED
// 1. Allowlist CORS at router level — no per-route CORS overrides.
// 2. requireRole('admin') already present — keep.
// 3. Soft-delete only: status='yanked', never hard-delete published versions.
// 4. Full audit log on every yank action.
// 5. Notify all pinned-version consumers via webhook before the yank takes effect.
router.delete('/:id/versions/:versionId',
requireSession,
requireRole('admin'),
async (req, res) => {
const version = await db.versions.findOne({
where: { id: req.params.versionId, skillId: req.params.id },
});
if (!version) return res.status(404).json({ error: 'Not found' });
if (version.status === 'yanked')
return res.status(409).json({ error: 'Already yanked' });
// Identify all consumers pinned to this version before yanking
const pinnedConsumers = await db.installations.findByVersion(req.params.versionId);
// Soft-delete: mark yanked, never remove the row
await db.versions.update(
{
status: 'yanked',
yankedAt: new Date(),
yankedBy: req.session.userId,
yankReason: req.body.reason?.slice(0, 500) ?? '',
},
{ where: { id: req.params.versionId } }
);
// Audit log
await auditLog.write({
action: 'version.yank',
skillId: req.params.id,
versionId: req.params.versionId,
adminId: req.session.userId,
reason: req.body.reason,
affectedInstallations: pinnedConsumers.length,
});
// Notify affected pinned-version consumers via webhook
await webhookDispatcher.notifyYank({
skillId: req.params.id,
versionId: req.params.versionId,
consumers: pinnedConsumers.map(c => c.webhookUrl).filter(Boolean),
});
res.json({ yanked: true, affectedInstallations: pinnedConsumers.length });
}
);
Why hard-deleting a registry version is irreversible harm. Unlike a soft-delete that sets status='yanked' and preserves the row, a hard delete removes the version identifier from every index and resolution path. Any agent manifest that references the deleted version ID will fail at the resolution step with no fallback, and the registry cannot reconstruct which installations were affected. Soft-deletes preserve the ability to notify consumers, provide a migration path, restore the version if the yank was erroneous, and produce a complete audit trail for post-incident review.
Summary of remediation patterns
All four CORS39 findings share a common root cause: CORS policy is configured at the route level rather than the router level, allowing inconsistent and overly permissive grants to coexist with stricter defaults elsewhere in the codebase. The recommended remediation pattern applies a single set-based allowlist once at the router level using the cors middleware’s callback form. This guarantees that every endpoint under the router inherits the same policy with no possibility of a per-route override accidentally re-opening the grant.
Beyond the CORS fix, each endpoint requires its own authorization hardening. Version history endpoints must gate on session role and skill ownership before deciding which records to include in the response — draft content and unreleased changelog body should never leave the server for public callers regardless of the CORS grant. Draft creation endpoints must verify skill ownership and check authoring quota before writing, and must not trigger consumer notification workflows on every save. Changelog endpoints must enforce ownership at the database query level to prevent timing oracles. Version deletion endpoints must be soft-delete only, with a complete audit trail and pre-yank consumer notification to limit the blast radius of both legitimate and attacker-forced yanks.
| Finding | Severity | Vulnerable pattern | Primary impact |
|---|---|---|---|
| CORS39-001 | CRITICAL | cors({origin:true,credentials:true}) on version list |
Draft version and unreleased changelog exfiltration |
| CORS39-002 | HIGH | ACAO: * on draft creation |
Authoring quota exhaustion; draft content overwrite |
| CORS39-003 | MEDIUM | Origin reflection before ownership query | Timing oracle reveals private changelog existence |
| CORS39-004 | CRITICAL | cors({origin:true,credentials:true}) on version delete |
Pinned installation breakage across all registries |
Related findings
- SA-SKL-CORS38 — CORS misconfiguration in skill rating and review submission endpoints
- SA-SKL-CORS37 — CORS misconfiguration in skill search and autocomplete suggestion endpoints
- Blog: CORS Misconfigurations in Skill Search and Autocomplete Endpoints