CWE-383 Variante Borrador

J2EE Bad Practices: Direct Use of Threads

Creating or managing threads directly within a J2EE application is a risky practice that violates the platform's standards and often leads to unstable applications.

Definición

What is CWE-383?

Creating or managing threads directly within a J2EE application is a risky practice that violates the platform's standards and often leads to unstable applications.
Direct thread management in a J2EE environment is problematic because it bypasses the container's control, which is designed to manage resources and concurrency. This can cause unpredictable conflicts with the application server's own threading, leading to crashes, performance issues, and difficult-to-reproduce errors. Common bugs like deadlocks and race conditions become much harder to diagnose when they originate from custom threads instead of the container-managed ones. These flaws are tricky to find manually, especially in complex deployments. While SAST tools can flag the pattern, Plexicus uses AI to analyze the context and suggest specific, safe refactoring steps—such as replacing custom threads with JMS or the ManagedExecutorService—saving significant development time and preventing runtime instability.
Impacto en el mundo real

Real-world CVEs caused by CWE-383

Todavía no hay CVEs públicos enlazados a esta CWE en el catálogo de MITRE.

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 Java

In the following example, a new Thread object is created and invoked directly from within the body of a doGet() method in a Java servlet.

Vulnerable Java
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
```
// Perform servlet tasks.* 
  		...
  		
  		
  		 *// Create a new thread to handle background processing.* 
  		Runnable r = new Runnable() {
  		```
  				public void run() {
```
// Process and store request statistics.* 
  						...}};
  		
  		new Thread(r).start();}
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-383

  • Architecture and Design For EJB, use framework approaches for parallel execution, instead of using threads.
Señales de detección

How to detect CWE-383

Automated Static Analysis High

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Auto-corrección de Plexicus

Plexicus detecta automáticamente CWE-383 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-383?

Creating or managing threads directly within a J2EE application is a risky practice that violates the platform's standards and often leads to unstable applications.

¿Qué gravedad tiene CWE-383?

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-383?

MITRE lists the following affected platforms: Java.

¿Cómo puedo prevenir CWE-383?

For EJB, use framework approaches for parallel execution, instead of using threads.

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

El motor SAST de Plexicus detecta la firma de flujo de datos para CWE-383 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-383?

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

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.