← Security advisories

Claude MCP skill insecure deserialization — skill CI/CD pipeline integration configuration endpoints — SA-SKL-DESER36

SA-SKL-DESER36 documents four insecure deserialization vulnerabilities in MCP skill registry CI/CD pipeline integration configuration endpoints. CI/CD pipeline configurations sit at the intersection of trusted infrastructure and untrusted user-supplied data: pipeline configs control how skills are built, tested, and deployed, and they are frequently stored in cache layers that an attacker with any registry-level write access can poison. All four DESER36 findings are CRITICAL severity because they achieve remote code execution or complete authentication bypass at the pipeline service process level, and each fires within the normal operational path rather than requiring an exotic trigger.

SA-SKL-DESER36 findings at a glance
CRITICALDESER36-001 — CI pipeline config reads from Redis as YAML via yaml.load() DEFAULT_FULL_SCHEMA — !!js/function in pipelineConfig.onBuildComplete achieves RCE at every build completion event; fix: FAILSAFE_SCHEMA; JSON for all pipeline config; Zod PipelineConfigSchema; named-event dispatch table
CRITICALDESER36-002 — pipeline step metadata reads from MongoDB as BSON — BSON Code type at stepExecutorFn field triggers eval() during pipeline step execution; fix: reject BSON Code; promoteValues:false; Zod string-only schema; named-executor lookup
CRITICALDESER36-003 — pipeline trigger event queue stored in Redis as MessagePack — __proto__.skipPipelineAuth:true pollutes Object.prototype, disabling authentication checks for all subsequent pipeline API requests in process; fix: null-prototype target; Zod strict(); JSON instead of MessagePack
CRITICALDESER36-004 — pipeline output aggregation reads via node-serialize — IIFE gadget achieves RCE at pipeline output aggregation time reachable from any authenticated pipeline consumer; fix: JSON.parse + Zod; detect and reject _$$ND_FUNC$$_ payloads; sealed config at deploy time

DESER36-001 — YAML DEFAULT_FULL_SCHEMA RCE at build completion event handler

Severity: CRITICAL

The pipeline service reads CI pipeline configuration from Redis using yaml.load(config, { schema: yaml.DEFAULT_FULL_SCHEMA }). The DEFAULT_FULL_SCHEMA permits YAML tags including !!js/function, which the js-yaml library instantiates as a live JavaScript function during deserialization. When the pipeline config contains an onBuildComplete lifecycle hook, the pipeline service calls it at every build completion event. An attacker who can write a poisoned config to the Redis cache — achievable through any authenticated pipeline config update endpoint — can inject a !!js/function value into the onBuildComplete field that executes arbitrary Node.js code with the pipeline service's process privileges.

Build completion events fire for every CI run across every skill in the registry. A single poisoned config entry propagates RCE to all pipeline service instances that read the same Redis cache key, since most pipeline service deployments share a single Redis configuration cache. The attacker payload typically exfiltrates GITHUB_TOKEN, NPM_TOKEN, DOCKER_HUB_TOKEN, and cloud provider credentials that the pipeline service needs to build and push skill artifacts.

Vulnerable
// Pipeline config read from Redis — YAML with DEFAULT_FULL_SCHEMA permits !!js/function
const raw = await redis.get(`pipeline:config:${skillId}`);
const config = yaml.load(raw, { schema: yaml.DEFAULT_FULL_SCHEMA });

// Fires at every build completion — executes attacker function if config is poisoned
if (config.onBuildComplete) {
  await config.onBuildComplete({ skillId, buildId, status });
}
Fixed
// Pipeline config read from Redis — FAILSAFE_SCHEMA + JSON preferred
const raw = await redis.get(`pipeline:config:${skillId}`);

// Prefer JSON; fall back to YAML only with FAILSAFE_SCHEMA (strings/arrays/maps only)
let parsed;
try {
  parsed = JSON.parse(raw);
} catch {
  parsed = yaml.load(raw, { schema: yaml.FAILSAFE_SCHEMA });
}

const config = PipelineConfigSchema.parse(parsed); // Zod: strings only, no function fields

// Named dispatch table — attacker cannot inject a function, only a known event name
const BUILD_COMPLETE_HANDLERS = {
  notify: notifyBuildComplete,
  deploy: triggerDeploy,
  badge: updateBadge,
};
const handlerName = config.onBuildComplete;
if (handlerName && BUILD_COMPLETE_HANDLERS[handlerName]) {
  await BUILD_COMPLETE_HANDLERS[handlerName]({ skillId, buildId, status });
}

DESER36-002 — BSON Code type eval() during pipeline step execution

Severity: CRITICAL

The pipeline service reads step metadata documents from MongoDB using the default MongoClient BSON deserialization settings, which promote BSON Code objects to JavaScript Code objects. When the step metadata document contains a stepExecutorFn field stored as BSON Code, MongoDB's Node.js driver instantiates it as a bson.Code object during deserialization. If the pipeline service subsequently calls stepExecutorFn(context) on the retrieved document, it invokes the attacker's JavaScript code with the pipeline service's process context.

An attacker who can write a step metadata document to MongoDB — achievable through any authenticated pipeline step configuration endpoint — can inject a BSON Code value at the stepExecutorFn field. The pipeline service executes this code at every step that references the poisoned metadata document, which may be hundreds of pipeline runs per hour in an active registry. The fix rejects any document that contains a BSON Code type at any field, disables value promotion with promoteValues: false, enforces a Zod string-only schema over step metadata, and replaces dynamic executor invocation with a named-executor lookup table.

BSON Code promotion is an opt-out, not an opt-in. MongoDB's default driver settings promote BSON Code objects to JavaScript Code objects silently. Any pipeline service that reads step metadata from MongoDB without explicitly setting promoteValues: false and promoteLongs: false is vulnerable to this pattern. Audit all MongoDB read paths that touch user-influenced documents and add an explicit BSON Code type check before any field is treated as callable.

DESER36-003 — MessagePack prototype pollution disabling pipeline authentication

Severity: CRITICAL

The pipeline service reads trigger event messages from a Redis queue using MessagePack deserialization. The MessagePack library used by the pipeline service deserializes maps into plain JavaScript objects via Object.create(Object.prototype), making the deserialized object share the prototype chain with Object.prototype. A message payload containing a __proto__ map key causes the MessagePack library to write properties onto Object.prototype itself during deserialization.

An attacker who can enqueue a crafted trigger event — achievable through any authenticated webhook or CI trigger endpoint — can set __proto__.skipPipelineAuth to true in the poison payload. After the pipeline service processes this message, every subsequent authentication check in the same process that evaluates if (req.skipPipelineAuth) or if (options.skipPipelineAuth) returns true due to prototype inheritance, bypassing pipeline authentication for all requests until the process restarts. The fix deserializes into null-prototype objects, enforces Zod strict() schema to reject unexpected keys, and uses JSON for the event queue to avoid MessagePack's prototype-chain coupling entirely.

DESER36-004 — node-serialize IIFE gadget RCE at pipeline output aggregation

Severity: CRITICAL

The pipeline service reads aggregated output documents using require('node-serialize').unserialize(). The node-serialize library supports an Immediately Invoked Function Expression (IIFE) gadget: any string value in the serialized object that matches the pattern _$$ND_FUNC$$_function(){…}() is evaluated as JavaScript during deserialization. An attacker who can write a poisoned aggregation record — achievable from any authenticated pipeline consumer that can submit output documents — can inject an IIFE payload that executes arbitrary code with the pipeline service's privileges at aggregation time.

Pipeline output aggregation runs on a background worker that processes outputs from all skills in the registry, typically as a batch job or message queue consumer. The IIFE payload executes in that worker's process, which often holds the most sensitive credentials in the pipeline service deployment: cloud storage keys for build artifact upload, container registry credentials for image push, and deployment service tokens for skill release automation. The fix replaces node-serialize with JSON.parse plus Zod schema validation, adds an explicit pre-parse check that rejects any payload string containing _$$ND_FUNC$$_, and seals pipeline output config at deploy time so aggregation workers read only from a server-side constant rather than from user-influenced storage.

Vulnerable
// node-serialize IIFE gadget — evaluates attacker code at aggregation time
const serialize = require('node-serialize');
const rawOutput = await redis.get(`pipeline:output:${buildId}`);
const outputDoc = serialize.unserialize(rawOutput); // IIFE fires here if payload crafted
await aggregateResults(outputDoc);
Fixed
// Safe aggregation — JSON + Zod + IIFE pre-check
const rawOutput = await redis.get(`pipeline:output:${buildId}`);

// Reject node-serialize IIFE gadget payloads before parsing
if (rawOutput.includes('_$$ND_FUNC$$_')) {
  logger.warn({ buildId }, 'Rejected node-serialize IIFE gadget in pipeline output');
  return;
}

const parsed = JSON.parse(rawOutput);
const outputDoc = PipelineOutputSchema.parse(parsed); // Zod: strict shape, strings only
await aggregateResults(outputDoc);

Remediation summary

FindingSeverityPrimary remediationSecondary hardening
DESER36-001CriticalSwitch to FAILSAFE_SCHEMA or JSON; Zod PipelineConfigSchema rejects function fieldsNamed-event dispatch table; seal config at deploy time
DESER36-002CriticalReject BSON Code type; promoteValues:false; Zod string-only step schemaNamed-executor lookup table; audit all MongoDB read paths
DESER36-003CriticalNull-prototype deserialization target; Zod strict() rejecting __proto__JSON instead of MessagePack for event queue
DESER36-004CriticalReplace node-serialize with JSON.parse + Zod; pre-parse IIFE gadget detectionSealed config at deploy time; server-side constants for aggregation schema

Find deserialization vulnerabilities like these before attackers do. SkillAudit scans your MCP skill registry pipeline endpoints for all four SA-SKL-DESER36 patterns plus the broader deserialization advisory series. See the SA-SKL-DESER35 review workflow advisory and the SA-SKL-DESER34 test suite advisory for related findings. Connect your repository at skillaudit.dev.