← Security advisories

Claude MCP skill insecure deserialization — skill vulnerability disclosure and security advisory management endpoints — SA-SKL-DESER47

SA-SKL-DESER47 documents four insecure deserialization vulnerabilities in MCP skill registry vulnerability disclosure and security advisory management endpoints. These endpoints orchestrate the lifecycle of security advisories — from draft creation through disclosure notification scheduling and aggregation. Each deserialization sink in this pipeline is triggered at advisory publication time, meaning an attacker who places a malicious payload in the advisory configuration, disclosure schedule model, event queue, or aggregation input achieves RCE or authentication bypass at the moment a legitimate security advisory is published — a particularly impactful trigger because advisory publication events are both operationally significant and infrequent enough to escape routine security scrutiny. DESER47-001 identifies a YAML RCE via Redis at advisory config publication; DESER47-002 identifies a BSON Code eval path at disclosure notification scheduling; DESER47-003 identifies a MessagePack prototype pollution sink that disables advisory authentication globally until process restart; DESER47-004 identifies a node-serialize IIFE gadget at advisory aggregation time reachable from any authenticated consumer of the advisory API.

SA-SKL-DESER47 findings at a glance
CRITICALDESER47-001 — advisory config reads from Redis as YAML via yaml.load() DEFAULT_FULL_SCHEMA — !!js/function in advisoryConfig.onDisclosurePublish achieves RCE at every security advisory publication event; fix: FAILSAFE_SCHEMA; JSON for all advisory config; Zod AdvisoryConfigSchema; named-event dispatch table
CRITICALDESER47-002 — disclosure schedule model reads from MongoDB as BSON — BSON Code type at notificationDeliveryFn field triggers eval() during disclosure notification at every advisory publication event; fix: reject BSON Code; promoteValues:false; Zod string-only schema; named-delivery lookup
CRITICALDESER47-003 — advisory event queue stored in Redis as MessagePack — __proto__.skipAdvisoryAuth:true pollutes Object.prototype, disabling authentication checks for all subsequent advisory API requests in process until restart; fix: null-prototype target; Zod strict(); JSON instead of MessagePack
CRITICALDESER47-004 — advisory aggregation reads via node-serialize — IIFE gadget achieves RCE at advisory aggregation time reachable from any authenticated consumer of the security advisory API; fix: JSON.parse + Zod; detect and reject _$$ND_FUNC$$_ payloads; sealed config at deploy time

DESER47-001 — Redis YAML RCE on advisory config publication

Severity: CRITICAL

The advisory configuration document is stored in Redis in YAML format and loaded via yaml.load(config, { schema: yaml.DEFAULT_FULL_SCHEMA }) at every security advisory publication event. DEFAULT_FULL_SCHEMA permits the !!js/function YAML type tag, which the js-yaml library deserializes by executing new Function(body)() — equivalent to eval() for the function body embedded in the YAML document. An attacker who can write to the advisory configuration key in Redis places a malicious !!js/function value at the advisoryConfig.onDisclosurePublish field, achieving arbitrary code execution at the next advisory publication event.

The trigger is specifically dangerous because it fires during security-critical operations. An attacker who achieves RCE at advisory publication time can intercept the notification to downstream consumers, modify the advisory content before it reaches the public, or exfiltrate the full advisory database including embargoed CVE details. The Redis write required to place the payload may be achievable via SSRF to the Redis port, via a compromised internal service that writes advisory configuration, or via prototype pollution in an upstream deserialization sink that allows arbitrary key writes to the config object.

Vulnerable
// Advisory config loaded from Redis as YAML with DEFAULT_FULL_SCHEMA
const raw = await redis.get(`advisory:config:${skillId}`);
const advisoryConfig = yaml.load(raw, { schema: yaml.DEFAULT_FULL_SCHEMA });
// !!js/function in advisoryConfig.onDisclosurePublish executes at advisory publish time
await advisoryConfig.onDisclosurePublish(advisoryRecord);
Fixed
// Advisory config: JSON in Redis + Zod schema + named-event dispatch table
const AdvisoryConfigSchema = z.object({
  onDisclosurePublish: z.enum(['notify_subscribers', 'notify_cve_feeds', 'notify_enterprise_customers']),
  notificationDelayMs: z.number().int().min(0).max(86_400_000),
  requireApproval:     z.boolean(),
});
const raw = await redis.get(`advisory:config:${skillId}`);
const parsed = AdvisoryConfigSchema.safeParse(JSON.parse(raw));
if (!parsed.success) throw new Error('Invalid advisory config');
// named-dispatch table — no code execution from config data
const handler = ADVISORY_PUBLISH_HANDLERS[parsed.data.onDisclosurePublish];
await handler(advisoryRecord, parsed.data);

DESER47-002 — BSON Code eval on disclosure notification scheduling

Severity: CRITICAL

The disclosure schedule model is stored in MongoDB and loaded with the default Mongoose driver settings, which allow BSON Code type deserialization. When the notificationDeliveryFn field of a disclosure schedule document contains a BSON Code object, Mongoose deserializes it into a JavaScript function and the advisory notification pipeline calls it via schedule.notificationDeliveryFn(advisory) — triggering arbitrary code execution at every advisory publication event that has a disclosure schedule attached.

An attacker who can write to MongoDB disclosure schedule documents places a malicious BSON Code value at the notificationDeliveryFn field, achieving RCE at the next scheduled advisory publication. This is achievable via MongoDB injection in an upstream endpoint that accepts user-controlled query filters without sufficient sanitization, or via a compromised service account with write access to the advisory schedule collection.

Vulnerable
// Disclosure schedule loaded from MongoDB — BSON Code type triggers eval()
const schedule = await DisclosureSchedule.findOne({ skillId, advisoryId });
// schedule.notificationDeliveryFn may be BSON Code — deserialized as JS function
await schedule.notificationDeliveryFn(advisory);  // RCE if attacker controls the field
Fixed
// Disclosure schedule: reject BSON Code + promoteValues:false + named-delivery lookup
const DELIVERY_HANDLERS = {
  'email_subscribers': deliverByEmail,
  'webhook_enterprise': deliverByWebhook,
  'cve_feed_push':     deliverByCveFeed,
};
const DisclosureScheduleSchema = z.object({
  notificationDeliveryFn: z.enum(Object.keys(DELIVERY_HANDLERS)),
  scheduledAt:            z.date(),
});
// Use promoteValues:false to prevent BSON Code → function promotion
const rawDoc = await db.collection('disclosureSchedules')
  .findOne({ skillId, advisoryId }, { promoteValues: false });
if (rawDoc?.notificationDeliveryFn?._bsontype === 'Code') throw new Error('BSON Code rejected');
const parsed = DisclosureScheduleSchema.safeParse(rawDoc);
const handler = DELIVERY_HANDLERS[parsed.data.notificationDeliveryFn];
await handler(advisory);

DESER47-003 — MessagePack prototype pollution disabling advisory authentication

Severity: CRITICAL

The advisory event queue is stored in Redis as MessagePack. The deserialization call msgpack.decode(buffer) uses the default target object ({}), which inherits from Object.prototype. A message in the queue containing the key path __proto__ → skipAdvisoryAuth with value true pollutes Object.prototype.skipAdvisoryAuth, causing every subsequent if (req.skipAdvisoryAuth) check in the advisory API request handlers to evaluate to true for all requests in the Node.js process until it restarts — effectively disabling advisory API authentication globally.

An attacker who can enqueue advisory events (via any endpoint that writes to the advisory event queue, or via direct Redis write) places a crafted MessagePack message with a __proto__ merge key to trigger the pollution. The impact extends beyond the advisory API: any object created with {} in the process inherits the polluted skipAdvisoryAuth: true property, potentially bypassing authentication checks in unrelated components of the registry that check the same property name.

Vulnerable
// Advisory event queue deserialized from MessagePack with default {} target
const event = msgpack.decode(buffer);  // {} inherits from Object.prototype
// __proto__.skipAdvisoryAuth:true in payload pollutes Object.prototype globally
if (!event.skipAdvisoryAuth) {
  await verifyAdvisoryPermission(event.userId, event.advisoryId);
}
Fixed
// Advisory event queue: null-prototype target + JSON instead of MessagePack + Zod strict
const AdvisoryEventSchema = z.object({
  eventType:   z.enum(['advisory.published', 'advisory.updated', 'advisory.recalled']),
  advisoryId:  z.string().uuid(),
  userId:      z.string().uuid(),
  skillId:     z.string().uuid(),
  publishedAt: z.string().datetime(),
}).strict();  // reject unknown keys including __proto__

// Store as JSON, not MessagePack — eliminates binary deserialization gadget surface
const rawStr = await redis.lpop('advisory:event:queue');
const rawObj = JSON.parse(rawStr, (k, v) => {
  if (k === '__proto__') return undefined;  // belt-and-suspenders __proto__ strip
  return v;
});
const parsed = AdvisoryEventSchema.safeParse(rawObj);
if (!parsed.success) throw new Error('Invalid advisory event');
await verifyAdvisoryPermission(parsed.data.userId, parsed.data.advisoryId);

DESER47-004 — node-serialize IIFE RCE on advisory aggregation

Severity: CRITICAL

The advisory aggregation pipeline reads advisory records via serialize.unserialize() from the node-serialize library. Any object property whose value begins with the _$$ND_FUNC$$_ prefix is treated as a serialized function and immediately invoked as an IIFE during deserialization. An advisory record stored with a _$$ND_FUNC$$_function(){ require('child_process').execSync('...') }() payload in any string field achieves RCE at advisory aggregation time.

Advisory aggregation is triggered by any authenticated consumer of the advisory API — the pipeline runs on every advisory list request to compute aggregate metrics. An attacker who can write a crafted advisory record to the aggregation input (via a compromised service account or via injection into an upstream advisory creation endpoint) achieves RCE on every subsequent aggregation request. The _$$ND_FUNC$$_ gadget is well-documented and reliably exploitable; node-serialize should not be used for any deserialization of network-sourced data.

Vulnerable
// Advisory aggregation reads via node-serialize — IIFE gadget in any string field
const serialize = require('node-serialize');
const advisories = await redis.lrange('advisory:aggregation:input', 0, -1);
for (const raw of advisories) {
  const record = serialize.unserialize(raw);  // _$$ND_FUNC$$_ gadget = RCE
  await computeAdvisoryMetrics(record);
}
Fixed
// Advisory aggregation: JSON.parse + Zod + reject _$$ND_FUNC$$_ payloads + sealed config
const AdvisoryRecordSchema = z.object({
  advisoryId:    z.string().uuid(),
  skillId:       z.string().uuid(),
  cveId:         z.string().regex(/^CVE-\d{4}-\d{4,}$/).optional(),
  severity:      z.enum(['critical', 'high', 'medium', 'low', 'info']),
  status:        z.enum(['draft', 'published', 'recalled']),
  publishedAt:   z.string().datetime().nullable(),
});
const advisories = await redis.lrange('advisory:aggregation:input', 0, -1);
for (const raw of advisories) {
  if (raw.includes('_$$ND_FUNC$$_')) throw new Error('node-serialize gadget detected — rejecting');
  const parsed = AdvisoryRecordSchema.safeParse(JSON.parse(raw));
  if (!parsed.success) throw new Error('Invalid advisory record');
  await computeAdvisoryMetrics(parsed.data);
}

Run SkillAudit to detect yaml.load() DEFAULT_FULL_SCHEMA, BSON Code deserialization, MessagePack prototype pollution sinks, and node-serialize usage in your MCP skill registry advisory pipeline. Join the waitlist for access.