CWE-622 Variante Borrador

Improper Validation of Function Hook Arguments

This vulnerability occurs when an application adds monitoring or interception hooks to critical functions, but fails to properly check the arguments passed to those hooks. This lack of validation…

Definición

What is CWE-622?

This vulnerability occurs when an application adds monitoring or interception hooks to critical functions, but fails to properly check the arguments passed to those hooks. This lack of validation can allow attackers to inject malicious data, leading to security bypasses or system compromise.
Function hooks are commonly used by security and monitoring software—like antivirus or firewalls—to intercept system or API calls. When these hooks are placed into user-accessible functions without validating the arguments, the protective software itself becomes a target. Attackers can craft malicious inputs that exploit the unvalidated hook logic, potentially disabling the protection or using its privileged access to attack the underlying system. For developers, the core issue is trusting intercepted arguments without applying the same rigorous validation expected of the original function. To prevent this, always validate and sanitize all data processed by a hook with the same rules as the hooked function itself. Treat the hook as a critical gatekeeper, not just a passive observer, to ensure it cannot be manipulated into undermining the very security it's meant to enforce.
Impacto en el mundo real

Real-world CVEs caused by CWE-622

  • DoS in firewall using standard Microsoft functions

  • DoS in firewall using standard Microsoft functions

  • function does not verify that its argument is the proper type, leading to arbitrary memory write

  • invalid syscall arguments bypass code execution limits

  • DoS in IDS via NULL argument

Cómo lo explotan los atacantes

Ruta del atacante paso a paso

  1. 1

    Identifica una ruta de código que maneje entrada no confiable sin validación.

  2. 2

    Crea un payload que ejercite el comportamiento inseguro — inyección, traversal, overflow o abuso de lógica.

  3. 3

    Envía el payload a través de una solicitud normal y observa la reacción de la aplicación.

  4. 4

    Itera hasta que la respuesta filtre datos, ejecute código del atacante o escale privilegios.

Ejemplo de código vulnerable

Vulnerable pseudo

MITRE no ha publicado un ejemplo de código para esta CWE. El patrón siguiente es ilustrativo — consulta Recursos para referencias canónicas.

Vulnerable pseudo
// Example pattern — see MITRE for the canonical references.
function handleRequest(input) {
  // Untrusted input flows directly into the sensitive sink.
  return executeUnsafe(input);
}
Ejemplo de código seguro

Secure pseudo

Seguro pseudo
// Validate, sanitize, or use a safe API before reaching the sink.
function handleRequest(input) {
  const safe = validateAndEscape(input);
  return executeWithGuards(safe);
}
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Lista de prevención

How to prevent CWE-622

  • Architecture and Design Ensure that all arguments are verified, as defined by the API you are protecting.
  • Architecture and Design Drop privileges before invoking such functions, if possible.
Señales de detección

How to detect CWE-622

SAST High

Ejecuta análisis estático (SAST) sobre el código buscando el patrón inseguro en el flujo de datos.

DAST Moderate

Ejecuta pruebas dinámicas de seguridad de aplicaciones (DAST) contra el endpoint en vivo.

Runtime Moderate

Vigila los logs en tiempo de ejecución para detectar trazas de excepción inusuales, entradas malformadas o intentos de bypass de autorización.

Code review Moderate

Revisión de código: marca cualquier código nuevo que maneje entrada desde esta superficie sin usar los helpers validados del framework.

Auto-corrección de Plexicus

Plexicus detecta automáticamente CWE-622 y abre un PR de corrección en menos de 60 segundos.

Codex Remedium escanea cada commit, identifica esta debilidad concreta y entrega un pull request listo para revisión con el parche. Sin tickets. Sin traspasos.

Preguntas frecuentes

Frequently asked questions

¿Qué es CWE-622?

This vulnerability occurs when an application adds monitoring or interception hooks to critical functions, but fails to properly check the arguments passed to those hooks. This lack of validation can allow attackers to inject malicious data, leading to security bypasses or system compromise.

¿Qué gravedad tiene CWE-622?

MITRE no ha publicado una calificación de probabilidad de explotación para esta debilidad. Trátala como de impacto medio hasta que tu modelo de amenazas demuestre lo contrario.

¿Qué lenguajes o plataformas se ven afectados por CWE-622?

MITRE no ha especificado plataformas afectadas para esta CWE — puede aplicar a la mayoría de los stacks de aplicaciones.

¿Cómo puedo prevenir CWE-622?

Ensure that all arguments are verified, as defined by the API you are protecting. Drop privileges before invoking such functions, if possible.

¿Cómo detecta y corrige Plexicus CWE-622?

El motor SAST de Plexicus detecta la firma de flujo de datos para CWE-622 en cada commit. Cuando hay coincidencia, nuestro agente Codex Remedium abre un PR de corrección con el código corregido, las pruebas y un resumen de una línea para el revisor.

¿Dónde puedo aprender más sobre CWE-622?

MITRE publica la definición canónica en https://cwe.mitre.org/data/definitions/622.html. También puedes consultar la documentación de OWASP y NIST para guías relacionadas.

Debilidades relacionadas

Weaknesses related to CWE-622

CWE-20 Padre

Improper Input Validation

This vulnerability occurs when an application accepts data from an external source but fails to properly verify that the data is safe and…

CWE-102 Hermano

Struts: Duplicate Validation Forms

This vulnerability occurs when an application defines multiple Struts validation forms with identical names. The framework then…

CWE-103 Hermano

Struts: Incomplete validate() Method Definition

This vulnerability occurs in a Struts application when a validator form either completely omits a validate() method or includes one but…

CWE-104 Hermano

Struts: Form Bean Does Not Extend Validation Class

This vulnerability occurs in Apache Struts applications when a form bean class does not properly extend the framework's validation class.…

CWE-105 Hermano

Struts: Form Field Without Validator

This vulnerability occurs when a Struts application form contains an input field that lacks a corresponding validator, leaving it open to…

CWE-106 Hermano

Struts: Plug-in Framework not in Use

This weakness occurs when a Java application, particularly one using the Struts framework, does not implement a structured input…

CWE-107 Hermano

Struts: Unused Validation Form

This vulnerability occurs when a Struts application contains validation form definitions that are no longer linked to any active form or…

CWE-108 Hermano

Struts: Unvalidated Action Form

In Apache Struts, every Action Form that processes user input must have a corresponding validation form configured. Missing this…

CWE-109 Hermano

Struts: Validator Turned Off

This vulnerability occurs when an application built with Apache Struts intentionally disables its built-in validation framework. By…

Listo cuando tú lo estés

Deja de pagar por desarrollador.
Empieza a cerrar el bucle.

Plexicus es el ASPM nativo de IA que escanea, filtra, corrige, pentestea y explica — de forma autónoma. Desarrolladores ilimitados, repos ilimitados, acciones de IA de uso justo. Nivel gratuito real, €269/mo anual cuando estés listo.