← Security advisories

Claude MCP skill CORS misconfiguration — skill version pinning and dependency lock endpoints — SA-SKL-CORS59

SA-SKL-CORS59 documents four CORS misconfiguration vulnerabilities in MCP skill registry version pinning and dependency lock endpoints. Version pinning endpoints govern which exact commits, tags, and branches a skill resolves to during installation and updates — including security-patch-only pin flags that prevent automatic upgrades to versions that introduce breaking changes. CORS59 identifies four distinct cross-origin attack paths: credential-bearing CORS on the version pin list endpoint exposes the full pin configuration including internal dependency management strategy; wildcard ACAO on the pin creation endpoint allows any page to inject attacker-controlled pin overrides locking skills to known-vulnerable versions; a timing oracle via Origin reflection before ownership check identifies active admin sessions as targets; and credential-bearing CORS on the pin deletion endpoint allows any cross-origin page to force skills to resolve to the latest potentially-vulnerable versions without notifying the pin owner.

SA-SKL-CORS59 findings at a glance
CRITICALCORS59-001 — GET /api/skills/:id/version-pins has cors({origin:true,credentials:true}) — any origin reads full version pin list including pinned commit hashes, branch locks, and security-patch-only pin flags using victim admin session; reveals internal dependency management strategy and identifies skills locked to vulnerable versions as targets for CORS59-002
CRITICALCORS59-002 — POST /api/skills/:id/version-pins has ACAO:* — any page creates attacker-controlled version pin overrides under victim admin identity locking skills to known-vulnerable versions or unpinning security-critical locks; fix: remove wildcard; require session; requireRole('admin'); CSRF token; Zod VersionPinSchema; audit log; rate-limit per userId+skillId
MEDIUMCORS59-003 — GET /api/skills/:id/version-pins/audit reflects Origin before ownership check — timing oracle reveals pin modification velocity tiers identifying skills with active version management as CORS59-001 targets during live admin sessions
CRITICALCORS59-004 — DELETE /api/skills/:id/version-pins/:pinId has cors({origin:true,credentials:true}) — any origin removes any version pin using victim admin session, forcing skills to resolve to latest (potentially vulnerable) versions without notifying the pin owner; fix: allowlist + requireSession + ownership check + notification to affected users + audit log on pin deletion events

CORS59-001 — Credential-bearing CORS on version pin list exposes dependency management strategy

Severity: CRITICAL

The version pin list 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 a page under attacker control, the page reads the full version pin list for any skill ID — including pinned commit hashes that reveal exact internal build timestamps, branch lock configurations that expose internal release branch naming conventions, and security-patch-only pin flags that identify which skills are considered security-sensitive by the registry administrators. This intelligence directly enables CORS59-002 by revealing which pin entries to override with vulnerable version hashes.

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/skills/:id/version-pins — mirrors origin, allows credentials
router.get('/version-pins', cors({ origin: true, credentials: true }), requireSession, async (req, res) => {
  const pins = await VersionPin.find({ skillId: req.params.id });
  // returns pinned commit hashes, branch locks, security-patch-only flags
  return res.json({ pins });
});
Fixed
// GET /api/skills/:id/version-pins — explicit allowlist, session + role required
const CORS_ALLOWLIST = (process.env.CORS_ORIGINS || '').split(',').map(s => s.trim());

router.get(
  '/version-pins',
  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.id).select('ownerId');
    if (!skill || skill.ownerId.toString() !== req.session.userId) {
      return res.status(403).json({ error: 'Forbidden' });
    }
    const pins = await VersionPin.find({ skillId: req.params.id })
      .select('tag branch securityPatchOnly createdAt -commitHash'); // never return raw commit hash
    return res.json({ pins });
  }
);

CORS59-002 — Wildcard ACAO on pin creation enables attacker-controlled version lock overrides

Severity: CRITICAL

The version pin creation endpoint sets Access-Control-Allow-Origin: *. The wildcard prevents credentials from being forwarded in the standard CORS flow, but the endpoint also processes session tokens supplied in a custom header or as a URL parameter — a common pattern in older registry APIs. An attacker page lures an admin and uses JavaScript's fetch() to POST a crafted version pin override that locks a target skill to a commit hash known to contain a vulnerability. The override is attributed to the victim admin's session in the audit log. When a downstream CI pipeline or automated installer encounters the manipulated pin, it installs the attacker-specified version. For security-patch-only pins, removing the flag causes the resolver to follow automatic update rules and upgrade to a version that introduces the targeted breaking change.

Wildcard ACAO on write endpoints is never safe. Even when session cookies cannot be forwarded, write endpoints with wildcard ACAO are reachable from any origin via custom headers or token parameters. Version pin endpoints must enforce session authentication, CSRF token validation, and role-based access regardless of CORS configuration.

Vulnerable
// POST /api/skills/:id/version-pins — wildcard ACAO, no CSRF, no ownership check
router.post('/version-pins', cors({ origin: '*' }), async (req, res) => {
  const { tag, commitHash, branch, securityPatchOnly } = req.body;
  // no session check, no role check, no CSRF validation
  await VersionPin.create({ skillId: req.params.id, tag, commitHash, branch, securityPatchOnly });
  return res.status(201).json({ created: true });
});
Fixed
// POST /api/skills/:id/version-pins — allowlist CORS + session + CSRF + Zod + audit
import { z } from 'zod';
const VersionPinSchema = z.object({
  tag: z.string().regex(/^v\d+\.\d+\.\d+(-[\w.]+)?$/).max(128),
  commitHash: z.string().regex(/^[0-9a-f]{40}$/).optional(),
  branch: z.string().regex(/^[\w.\-\/]{1,200}$/).optional(),
  securityPatchOnly: z.boolean().default(false),
});

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

    const skill = await Skill.findById(req.params.id).select('ownerId');
    if (!skill || skill.ownerId.toString() !== req.session.userId) {
      return res.status(403).json({ error: 'Forbidden' });
    }

    const pin = await VersionPin.create({ skillId: req.params.id, ...parsed.data });

    await AuditLog.create({
      action: 'versionpin.created', actorId: req.session.userId,
      skillId: req.params.id, pinId: pin._id, at: new Date(),
    });

    return res.status(201).json({ pinId: pin._id });
  }
);

CORS59-003 — Timing oracle via Origin reflection before ownership check on pin audit endpoint

Severity: MEDIUM

The version pin audit endpoint reflects the caller-supplied Origin header as Access-Control-Allow-Origin before evaluating the ownership check. This creates a timing channel: responses with a matching ownership check complete slightly faster than those that fall through to the unified WHERE clause. An attacker script iterates skill IDs and measures response latency from a cross-origin context. Skills with high pin modification velocity — indicating active version management workflows with frequent security updates — are identified as prime targets for CORS59-001 credential exfiltration. These skills are more likely to have live admin sessions and significant security-sensitive pin data worth stealing.

Vulnerable
// GET /api/skills/:id/version-pins/audit — Origin reflected BEFORE ownership check
router.get('/version-pins/audit', cors({ origin: true }), async (req, res) => {
  const skill = await Skill.findById(req.params.id); // ownership check happens here
  if (!skill || skill.ownerId.toString() !== req.session?.userId) {
    return res.status(403).json({ error: 'Forbidden' });
  }
  const events = await AuditLog.find({ skillId: req.params.id, action: /^versionpin/ });
  return res.json({ events });
});
Fixed
// GET /api/skills/:id/version-pins/audit — auth first, constant-time floor, unified WHERE
const MIN_RESPONSE_MS = 60;

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

    const events = await AuditLog.find({
      skillId: req.params.id,
      action: /^versionpin/,
      actorId: req.session.userId, // unified WHERE — same query regardless of ownership
    }).sort({ at: -1 }).limit(100);

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

    return res.json({ events });
  }
);

CORS59-004 — Credential-bearing CORS on pin deletion forces resolution to vulnerable versions

Severity: CRITICAL

The version pin 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 any version pin for any skill, authenticated by the victim's session cookie. Deleting a security-patch-only pin removes the flag that prevents automatic version resolution from upgrading the skill to versions that introduce breaking changes or known vulnerabilities. Deleting commit hash pins forces the resolver to fall back to tag-based resolution, which may resolve to a different commit than intended. The pin owner receives no notification, and the deletion is attributed to the victim admin in the audit log, making post-incident forensic analysis difficult.

Pin deletion is a high-impact write operation requiring full CORS hardening. Removing a version pin changes the runtime behavior of every downstream installation of the affected skill. Deletion endpoints must enforce explicit CORS allowlists, session authentication with ownership verification, and email or webhook notifications to the pin owner on every deletion event.

Vulnerable
// DELETE /api/skills/:id/version-pins/:pinId — mirrors origin, allows credentials, no ownership check
router.delete(
  '/version-pins/:pinId',
  cors({ origin: true, credentials: true }),
  requireSession,
  async (req, res) => {
    // no ownership check — any authenticated session can delete any pin
    await VersionPin.findByIdAndDelete(req.params.pinId);
    return res.json({ deleted: true });
  }
);
Fixed
// DELETE /api/skills/:id/version-pins/:pinId — allowlist CORS + ownership + notification + audit
router.delete(
  '/version-pins/:pinId',
  cors({ origin: (o, cb) => cb(null, CORS_ALLOWLIST.includes(o)), credentials: true }),
  requireSession,
  requireRole('admin'),
  async (req, res) => {
    const pin = await VersionPin.findById(req.params.pinId).populate('skillId');
    if (!pin) return res.status(404).json({ error: 'Pin not found' });

    const skill = pin.skillId;
    if (skill.ownerId.toString() !== req.session.userId) {
      return res.status(403).json({ error: 'Forbidden' });
    }

    await pin.deleteOne();

    await AuditLog.create({
      action: 'versionpin.deleted', actorId: req.session.userId,
      skillId: skill._id, pinId: req.params.pinId,
      pinTag: pin.tag, securityPatchOnly: pin.securityPatchOnly, at: new Date(),
    });

    // notify all users who have this skill installed with this pin active
    await notifyPinDeletion({ skillId: skill._id, pinTag: pin.tag, deletedBy: req.session.userId });

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

All four SA-SKL-CORS59 vulnerabilities reflect a consistent pattern of overly permissive CORS configuration on version management endpoints that control the security posture of downstream skill installations. SkillAudit detects CORS59-001 and CORS59-004 by flagging cors({origin:true,credentials:true}) usage on version-pin routes; CORS59-002 by detecting wildcard ACAO on POST routes handling dependency configuration writes; and CORS59-003 by detecting CORS header emission before ownership or authentication checks in route handler chains. See also SA-SKL-CORS58 on API key and token management endpoints for the companion chain targeting credential management CORS misconfigurations.