Skip to main content
Glama

Detectar riesgo de deserialización insegura

detect_insecure_deserialization_risk

Analiza el código fuente de una herramienta MCP que carga datos serializados (un modelo de IA, un archivo de configuración, un objeto guardado) en busca de funciones que pueden terminar ejecutando código arbitrario al momento de "leer" esos datos: (1) funciones que SIEMPRE reconstruyen objetos arbitrarios sin ninguna variante segura (pickle.load/loads, cPickle, marshal.loads, dill.loads, joblib.load, y unserialize() de PHP); (2) funciones que solo son peligrosas si no se usa su opción segura — yaml.load() sin Loader=yaml.SafeLoader (o yaml.safe_load()), y torch.load() sin weights_only=True; y (3) un método reduce/reduce_ex que ejecuta un comando del sistema al reconstruirse — la firma clásica de un payload malicioso de pickle. Motivada por CVE-2025-45146 (CVSS 9.8, CRÍTICO) en ModelCache, una librería de caché para agentes/LLM que llamaba a torch.load() sobre bytes sin validar; y CVE-2025-32434 (CVSS 9.3), que mostró que ni siquiera weights_only=True bastaba solo en versiones de PyTorch anteriores a la 2.6.0 — por eso esta herramienta trata esa opción como una señal que reduce el riesgo, no como algo que lo elimina. Reconoce un Unpickler restringido (RestrictedUnpickler/find_class) como señal de que ya se tomó una precaución real. Es un análisis estático por patrones de texto (no ejecuta el código) — mismo enfoque que detect_ssrf_risk, detect_path_traversal_risk, detect_command_injection_risk, detect_sql_injection_risk, detect_token_passthrough_risk y detect_hardcoded_secrets_risk. Requiere una llave de acceso válida (usos gratis o créditos) — ver POST /crear-llave.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "codigo": "<codigo>"
    },
    "name": "detect_insecure_deserialization_risk"
  }
}

Input Schema

NameRequiredDescriptionDefault
codigoYesEl código fuente de la función/herramienta que deserializa datos, en texto plano.
lenguajeNoSolo informativo (ej. "python", "javascript", "php") — la detección ya cubre varios lenguajes a la vez, este campo no cambia el resultado.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the load well: it discloses that analysis is static text-pattern matching and does NOT execute the code, that it covers multiple languages simultaneously, that weights_only=True is treated as risk-reducing rather than eliminating (with the CVE-2025-32434 rationale), and that RestrictedUnpickler counts as a real precaution. It also discloses the access-key prerequisite. Missing only what the response looks like.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose, then a numbered (1)/(2)/(3) breakdown of detection categories that is easy to scan. The CVE citations are long but justify the non-obvious claim that weights_only=True is only a risk-reduction signal, so they largely earn their space; the closing sibling list and key note are compact.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter static analyzer with no output schema and no annotations, the description covers detection logic, scope, safety posture of the analysis, and prerequisites thoroughly. The remaining gap is that it never indicates the shape or severity vocabulary of the findings, which the agent would want before reporting results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so both parameters are already documented, including that lenguaje is informational only. The description adds no parameter-level syntax or format guidance beyond restating that source code is the input, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Names a specific verb+resource: static analysis of source code that deserializes data, and enumerates the exact patterns sought in three labeled categories (always-dangerous sinks, conditionally-dangerous sinks, __reduce__ payloads). It also flags what distinguishes this from sibling detectors by naming the vuln class and the shared pattern-based approach.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Clearly scopes the input (source code of an MCP tool that loads serialized data) and positions itself against the sibling family by stating it uses the same approach as detect_ssrf_risk, detect_command_injection_risk, etc., which lets an agent infer it is the deserialization-specific member of that set. It does not explicitly state when NOT to use it or what to do with the results, so not a full 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources