Claude MCP skill CORS misconfiguration — audit result caching and diff comparison endpoints
SA-SKL-CORS36 documents four CORS vulnerabilities in MCP skill registry audit result caching and diff comparison endpoints. Credential-bearing CORS on the cached audit read endpoint lets any origin read the full cached vulnerability finding set using a victim session; wildcard ACAO on the diff computation endpoint lets any page consume victim scan quota and read the resulting diff; Origin reflection on the cache metadata endpoint before ownership check creates a timing oracle that reveals audit ID existence system-wide; credential-bearing CORS on the cache deletion endpoint lets any origin purge the victim org’s cached results, forcing expensive LLM-backed re-scans that drain the monthly quota.
cors({origin:true,credentials:true}); any origin reads full cached audit result including all vulnerability findings and remediation hints via victim session
ACAO:*; any page initiates diff computation using victim’s session scan quota and reads the resulting vulnerability diff of two audit reports
Origin before ownership check; timing oracle reveals cache entry existence (and thus audit ID existence) system-wide from any origin
cors({origin:true,credentials:true}); any origin deletes victim’s cached audit results forcing expensive re-scan that consumes LLM tokens and monthly scan quota
CORS36-001 — Credential-bearing CORS on cached audit reads leaks full finding sets
Audit result caches exist to avoid re-running expensive LLM-backed scans on unchanged skill versions. The cache endpoint GET /api/audits/:id/cache returns the full cached finding set — identical to the original audit report — with CORS configured via cors({origin:true,credentials:true}) to serve multiple internal dashboards. Any attacker page running in the victim’s browser can read the complete cached audit result for any audit ID using the victim’s session cookie, bypassing the access control on the primary audit report endpoint.
// CORS36-001 — VULNERABLE
router.get(
'/audits/:id/cache',
cors({ origin: true, credentials: true }), // reflects any Origin with credentials
requireSession,
async (req, res) => {
const cached = await cache.get(`audit:${req.params.id}`);
if (!cached) return res.status(404).json({ error: 'Cache miss' });
// Returns full audit result: all findings, CVSS scores, remediation hints
res.json(JSON.parse(cached));
}
);
Cache endpoints inherit the sensitivity of the data they store: The access control applied to the primary audit report endpoint is irrelevant if the cache endpoint for the same data has weaker access control. Treat every cache read endpoint as having the same sensitivity classification as the original resource it caches.
// CORS36-001 — FIXED
// Set-based allowlist; requireRole('member') + org ownership check before returning cached data.
const ALLOWED_ORIGINS = new Set(['https://app.skillaudit.dev', 'https://skillaudit.dev']);
const auditCacheCors = {
origin: (origin, cb) => ALLOWED_ORIGINS.has(origin) || !origin ? cb(null, true) : cb(new Error('CORS')),
credentials: true,
};
router.get('/audits/:id/cache', cors(auditCacheCors), requireSession, async (req, res) => {
const audit = await db.audits.findByIdAndOrg(req.params.id, req.session.orgId);
if (!audit) return res.status(404).json({ error: 'Audit not found' });
const cached = await cache.get(`audit:${req.params.id}`);
if (!cached) return res.status(404).json({ error: 'Cache miss' });
res.json(JSON.parse(cached));
});
CORS36-002 — Wildcard ACAO on diff computation drains scan quota
The diff computation endpoint POST /api/audits/diff accepts two audit IDs and returns a diff showing new, resolved, and unchanged findings between them. Each diff computation is billed against the requesting org’s monthly scan quota (since it re-runs the LLM comparison pass). With ACAO:*, any page can initiate diff computations using the victim org’s session quota. An attacker with a list of valid audit IDs (from CORS36-003 or CORS36-001) can submit hundreds of diff requests, exhausting the monthly quota within minutes.
// CORS36-002 — VULNERABLE
router.post('/audits/diff',
(req, res, next) => { res.header('Access-Control-Allow-Origin', '*'); next(); }, // VULNERABLE
requireApiKeyOrSession,
async (req, res) => {
const { auditIdA, auditIdB } = req.body;
// diff computation billed against org quota — attacker drains it cross-origin
const diff = await diffEngine.compare(auditIdA, auditIdB, req.auth.orgId);
res.json(diff);
}
);
// CORS36-002 — FIXED
// Remove wildcard ACAO; use allowlist; add per-org rate limit on diff calls.
const rateLimit = require('express-rate-limit');
const diffLimiter = rateLimit({
windowMs: 60 * 60 * 1000, max: 10,
keyGenerator: req => req.auth.orgId,
message: { error: 'Diff rate limit exceeded. Retry after 1 hour.' },
});
router.post('/audits/diff', cors(auditCacheCors), requireApiKeyOrSession, diffLimiter,
async (req, res) => {
const { auditIdA, auditIdB } = req.body;
// Verify both audit IDs belong to the requesting org
const [a, b] = await Promise.all([
db.audits.findByIdAndOrg(auditIdA, req.auth.orgId),
db.audits.findByIdAndOrg(auditIdB, req.auth.orgId),
]);
if (!a || !b) return res.status(403).json({ error: 'Audit not found or not owned by your org' });
const diff = await diffEngine.compare(auditIdA, auditIdB, req.auth.orgId);
res.json(diff);
}
);
CORS36-003 — Origin reflection timing oracle on cache metadata reveals audit ID existence
The cache metadata endpoint GET /api/audits/:id/cache/metadata reflects the Origin header before performing the ownership check. The timing difference between a cache hit (fast key lookup) and a cache miss (slower index scan) is measurable cross-origin, allowing enumeration of which audit IDs have cached results. Combined with sequential or time-ordered audit IDs, an attacker can enumerate all audit IDs across all organizations.
// CORS36-003 — VULNERABLE
router.get('/audits/:id/cache/metadata', 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' });
// Fast path: check cache key existence
const exists = await cache.exists(`audit:${req.params.id}`);
if (!exists) return res.status(404).json({ error: 'No cache entry' }); // 2-5ms
// Slow path: ownership check
const audit = await db.audits.findById(req.params.id);
if (!audit || audit.orgId !== session.orgId) {
return res.status(403).json({ error: 'Forbidden' }); // 8-15ms — reveals cache hit to any origin
}
res.json({ cachedAt: audit.cachedAt, ttl: audit.cacheTtl });
});
// CORS36-003 — FIXED
// CORS applied via allowlist middleware at router level (never inline before auth).
// Single WHERE audit_id = $1 AND org_id = $2 query — unified timing for not-found and forbidden.
router.get('/audits/:id/cache/metadata', requireSession, async (req, res) => {
// Single query: ownership checked atomically with existence — no timing oracle
const audit = await db.audits.findByIdAndOrg(req.params.id, req.session.orgId);
if (!audit) return res.status(404).json({ error: 'Audit not found' });
const meta = await cache.getMeta(`audit:${req.params.id}`);
if (!meta) return res.status(404).json({ error: 'No cache entry' });
res.json(meta);
});
CORS36-004 — Credential-bearing CORS on cache deletion forces expensive re-scans
The cache deletion endpoint DELETE /api/audits/:id/cache purges the cached result for an audit, forcing the next access to run a full re-scan. Each re-scan consumes LLM tokens and counts against the monthly scan quota. With cors({origin:true,credentials:true}), any attacker page running in the victim’s browser can delete the cache for any audit ID, repeatedly forcing expensive re-scans that drain the monthly quota and degrade registry performance for the victim org.
// CORS36-004 — VULNERABLE
router.delete(
'/audits/:id/cache',
cors({ origin: true, credentials: true }), // any origin can delete any cache entry via victim session
requireSession,
async (req, res) => {
await cache.del(`audit:${req.params.id}`); // no ownership check — deletes any org's cache
res.json({ deleted: req.params.id });
}
);
// CORS36-004 — FIXED
// Allowlist CORS; requireRole('admin'); CSRF token; verify org ownership before delete.
router.delete('/audits/:id/cache',
cors(auditCacheCors), requireSession, requireRole('admin'), verifyCsrfToken,
async (req, res) => {
const audit = await db.audits.findByIdAndOrg(req.params.id, req.session.orgId);
if (!audit) return res.status(404).json({ error: 'Audit not found' });
await cache.del(`audit:${req.params.id}`);
await auditLog.write({ action: 'cache_delete', auditId: req.params.id, userId: req.session.userId });
res.json({ deleted: req.params.id });
}
);
Related advisories: For credential-bearing CORS on audit report sharing and public badge endpoints, see SA-SKL-CORS31. For CORS misconfigurations in team invitation and member onboarding endpoints, see SA-SKL-CORS35. For insecure deserialization in webhook delivery retry endpoints, see SA-SKL-DESER21.
SkillAudit checks for CORS36, CORS35, SSRF, injection, prototype pollution, and 50+ more vulnerability patterns — in 60 seconds, with a shareable grade badge.
Get early access