← Security advisories

Claude MCP skill insecure deserialization — skill CI/CD webhook and integration configuration endpoints — SA-SKL-DESER29

SA-SKL-DESER29 documents four insecure deserialization vulnerabilities in MCP skill registry CI/CD webhook and integration configuration endpoints. CI/CD webhook systems read trigger filters and callback configurations from Redis and MongoDB at webhook evaluation time — if those stores contain attacker-controlled data deserialized with unsafe parsers, code execution follows immediately. DESER29-001 uses yaml.load() DEFAULT_FULL_SCHEMA on webhook trigger config from Redis, enabling !!js/function RCE at trigger evaluation. DESER29-002 uses BSON Code deserialization on integration config from MongoDB, triggering eval() on the transformFn field during payload transformation. DESER29-003 uses MessagePack deserialization on the webhook event queue from Redis, enabling prototype pollution that bypasses HMAC verification for all subsequent events in the process. DESER29-004 uses node-serialize on integration config aggregation summaries, exposing IIFE gadget RCE at aggregation time.

SA-SKL-DESER29 findings at a glance
CRITICALDESER29-001 — CI webhook config reads trigger filter from Redis as YAML via yaml.load() DEFAULT_FULL_SCHEMA — !!js/function in webhookConfig.onTriggerMatch achieves RCE at webhook trigger evaluation; fix: FAILSAFE_SCHEMA; JSON for all webhook config; Zod WebhookConfigSchema; named-trigger dispatch table
CRITICALDESER29-002 — Integration config reads from MongoDB as BSON — BSON Code type at transformFn field triggers eval() during payload transformation; fix: reject BSON Code; promoteValues:false; Zod string-only schema; named-transformer lookup
CRITICALDESER29-003 — Webhook event queue stored in Redis as MessagePack — __proto__.skipHmacVerification:true pollutes Object.prototype, bypassing HMAC verification for all subsequent webhook events in process; fix: null-prototype target; Zod strict(); JSON instead of MessagePack
CRITICALDESER29-004 — Integration config aggregation reads summary via node-serialize — IIFE gadget achieves RCE at integration config aggregation time; fix: JSON.parse + Zod; detect and reject _$$ND_FUNC$$_ payloads; sealed config at deploy time

DESER29-001 — YAML RCE via webhook trigger filter config from Redis

The CI webhook trigger evaluation system reads the webhook configuration — including the trigger filter that determines which CI events activate the webhook — from Redis as YAML using yaml.load() with DEFAULT_FULL_SCHEMA. An attacker who can write to the Redis key containing the webhook config can embed a !!js/function YAML type tag in the webhookConfig.onTriggerMatch field. When the webhook processor evaluates the trigger filter at the next CI event, the YAML deserializer instantiates the function and the webhook evaluation code calls it, executing attacker-controlled code in the Node.js process with the same privileges as the webhook service.

Redis key injection is achievable via several paths in a CI/CD webhook system: a compromised CI pipeline that writes webhook config back to Redis as part of a configuration sync step, an SSRF vulnerability that allows internal Redis writes, or a supply chain compromise in a CI configuration plugin that has Redis write access. Once RCE is established via the webhook trigger, the attacker has persistent code execution that fires on every CI event that matches the trigger pattern — potentially dozens or hundreds of times per day in an active development organization.

DESER29-001 fix: Replace yaml.load() with yaml.load(str, {schema: yaml.FAILSAFE_SCHEMA}) which only supports strings, booleans, and integers — no executable types. Better: use JSON for all webhook config stored in Redis; JSON.parse cannot execute code. Validate the parsed config with Zod WebhookConfigSchema using a named-trigger dispatch table (a Map from string trigger names to handler functions defined in server-side code) so the config can never specify executable logic, only references to known handlers.

WRONG
// Webhook trigger config from Redis deserialized as YAML with DEFAULT_FULL_SCHEMA
const raw = await redis.get(`webhook:config:${webhookId}`);
const webhookConfig = yaml.load(raw); // !!js/function in onTriggerMatch → RCE
if (webhookConfig.onTriggerMatch(event)) {
  await deliverWebhook(webhookConfig, event);
}
RIGHT
// Webhook trigger config from Redis deserialized as JSON + Zod validation
const raw = await redis.get(`webhook:config:${webhookId}`);
const parsed = JSON.parse(raw);
const webhookConfig = WebhookConfigSchema.parse(parsed); // Zod schema; triggerName is a string
// Named dispatch: triggerName references a server-side handler, never executes stored code
const handler = TRIGGER_DISPATCH.get(webhookConfig.triggerName);
if (!handler) throw new Error('unknown trigger');
if (handler.matches(event)) {
  await deliverWebhook(webhookConfig, event);
}

DESER29-002 — BSON Code eval() via integration config transformFn from MongoDB

The integration configuration system reads per-integration config from MongoDB using the MongoDB Node.js driver without promoteValues:false. When an integration config document contains a BSON Code type at the transformFn field — a MongoDB-native type that stores JavaScript source code — the driver promotes it to a JavaScript Code object during deserialization. The integration config processor then calls eval(transformFn.code) to execute the transformation function during payload processing. An attacker who can inject a BSON Code document into the MongoDB collection (via a compromised integration setup flow, a MongoDB injection in an upstream write path, or a supply chain compromise in a configuration migration script) achieves code execution on every payload transformation.

DESER29-002 fix: Pass promoteValues:false to the MongoDB driver so BSON Code values are returned as opaque objects rather than promoted to Code instances. At the application layer, explicitly reject any config document where any field is an instanceof mongodb.Code. Validate with Zod using a string-only schema for all config fields. Use a named-transformer lookup table (similar to DESER29-001) so the config specifies a transformer name, not transformer code.

// WRONG — BSON Code type promoted to Code object; eval() executes stored code
const config = await db.collection('integrations').findOne({ _id: integrationId });
const result = eval(config.transformFn.code)(payload); // RCE if transformFn is BSON Code

// RIGHT — promoteValues:false; instanceof check; named-transformer lookup
const config = await db.collection('integrations').findOne(
  { _id: integrationId },
  { promoteValues: false }
);
if (config.transformFn instanceof mongodb.Code) {
  throw new Error('BSON Code type rejected in integration config');
}
const schema = IntegrationConfigSchema.parse(config); // Zod string-only fields
const transformer = TRANSFORMER_REGISTRY.get(schema.transformerName);
if (!transformer) throw new Error('unknown transformer');
const result = transformer(payload);

DESER29-003 — MessagePack prototype pollution bypasses HMAC verification via webhook event queue

The webhook event queue uses Redis with MessagePack serialization for event payloads. The MessagePack deserializer uses a plain object ({}) as the deserialization target, which inherits from Object.prototype. An attacker who can write a crafted MessagePack payload to the Redis queue — containing __proto__ as a map key with skipHmacVerification: true as a value — pollutes Object.prototype. After this payload is deserialized, every subsequent object created in the process (including the HMAC verification result objects) has skipHmacVerification: true set on their prototype chain. The HMAC verification logic, which checks if (verificationResult.skipHmacVerification), evaluates to true for all subsequent webhook events processed in the same Node.js process — until the process restarts.

DESER29-003 fix: Use Object.create(null) as the MessagePack deserialization target to create a prototype-free object that cannot pollute Object.prototype. Validate the deserialized payload with Zod.strict() which rejects any keys not in the schema definition. Replace MessagePack with JSON for the webhook event queue; JSON.parse does not construct object graphs that can pollute prototypes when processed carefully.

// WRONG — plain object target; __proto__ key pollutes Object.prototype
const eventPayload = msgpack.decode(await redis.lpop('webhook:events'));
// eventPayload.__proto__.skipHmacVerification = true → affects all objects in process
if (!verifyHmac(eventPayload)) { // verificationResult.skipHmacVerification is now true via prototype
  return res.status(401).json({ error: 'invalid signature' });
}

// RIGHT — null-prototype target; Zod strict() validation; JSON instead of MessagePack
const raw = await redis.lpop('webhook:events');
const untrusted = JSON.parse(raw); // JSON instead of MessagePack
const eventPayload = WebhookEventSchema.strict().parse(
  Object.assign(Object.create(null), untrusted) // null-prototype target
);
const hmacResult = verifyHmac(eventPayload); // fresh object, no prototype pollution
if (!hmacResult.valid) {
  return res.status(401).json({ error: 'invalid signature' });
}

DESER29-004 — node-serialize IIFE RCE via integration config aggregation

The integration config aggregation pipeline reads summary objects from Redis using node-serialize. The node-serialize library supports IIFEs (Immediately Invoked Function Expressions) using the _$$ND_FUNC$$_ marker. An attacker who can write a crafted payload to the Redis aggregation cache — with a field containing _$$ND_FUNC$$_function(){ require('child_process').exec('...') }() — achieves code execution at the moment the aggregation pipeline calls serialize.unserialize() on the cached entry. The aggregation endpoint is typically reachable from any authenticated API consumer that requests a summary of their integration configurations, making it a low-privilege-requirement RCE path.

DESER29-004 fix: Replace node-serialize entirely with JSON.parse() followed by Zod schema validation. Add a pre-parse check that rejects any raw string containing _$$ND_FUNC$$_ before deserialization. Config aggregation summaries should be derived from sealed local configuration at deploy time, never read from Redis at runtime — this eliminates the attack surface entirely.

// WRONG — node-serialize IIFE gadget; RCE at aggregation time
const cached = await redis.get(`integration:summary:${orgId}`);
const summary = serialize.unserialize(cached); // _$$ND_FUNC$$_ → RCE

// RIGHT — JSON.parse + Zod; _$$ND_FUNC$$_ pre-check
const cached = await redis.get(`integration:summary:${orgId}`);
if (cached.includes('_$$ND_FUNC$$_')) {
  await audit.log('deserialization_attack_detected', { orgId, cacheKey: `integration:summary:${orgId}` });
  throw new Error('malicious payload detected in integration summary cache');
}
const parsed = JSON.parse(cached);
const summary = IntegrationSummarySchema.parse(parsed); // Zod validates shape and types
Detect SA-SKL-DESER29 in your registry

SkillAudit scans for yaml.load() calls without FAILSAFE_SCHEMA on Redis-sourced data, BSON Code type handling in MongoDB query results, MessagePack deserialization without null-prototype targets, and node-serialize usage — across all CI/CD webhook and integration configuration code paths in your MCP skill registry.

Scan your registry
FindingSeverityVectorImpact
DESER29-001CRITICALyaml.load() DEFAULT_FULL_SCHEMA on Redis webhook configRCE at webhook trigger evaluation via !!js/function in onTriggerMatch; fires on every CI event
DESER29-002CRITICALBSON Code type in MongoDB integration config transformFnRCE at every payload transformation via eval() on Code object
DESER29-003CRITICALMessagePack __proto__ key in Redis webhook event queuePrototype pollution bypasses HMAC verification for all events in process until restart
DESER29-004CRITICALnode-serialize IIFE in Redis integration config aggregationRCE at aggregation time reachable from any authenticated API consumer

See also: SA-SKL-DESER28 (search indexing and query caching deserialization patterns) for the same YAML/BSON/MessagePack/node-serialize attack surface in search endpoints.