CWE-106 Variant Draft

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 validation plugin like the Struts Validator. Skipping this framework…

Definition

What is CWE-106?

This weakness occurs when a Java application, particularly one using the Struts framework, does not implement a structured input validation plugin like the Struts Validator. Skipping this framework forces developers to write custom validation logic, which is often error-prone and increases the risk of security flaws from improperly handled user input.
Without a dedicated validation framework, your application becomes vulnerable to common web attacks. Unchecked user input is a primary entry point for cross-site scripting (XSS), SQL injection, and unauthorized command execution, as attackers can inject malicious code or manipulate application logic. While Java environments typically avoid memory corruption issues, the risk extends to integrated native code. If your J2EE application passes unvalidated data to native libraries or components that lack proper bounds checking, a simple input validation oversight can escalate into a severe buffer overflow attack, compromising the entire system.
Auswirkungen in der Praxis

Real-world CVEs caused by CWE-106

Bisher sind in MITREs Katalog keine öffentlichen CVE-Referenzen mit dieser CWE verknüpft.

Wie Angreifer es ausnutzen

Angreiferpfad Schritt für Schritt

  1. 1

    In the following Java example the class RegistrationForm is a Struts framework ActionForm Bean that will maintain user input data from a registration webpage for an online business site. The user will enter registration data and, through the Struts framework, the RegistrationForm bean will maintain the user data.

  2. 2

    However, the RegistrationForm class extends the Struts ActionForm class which does use the Struts validator plug-in to provide validator capabilities. In the following example, the RegistrationForm Java class extends the ValidatorForm and Struts configuration XML file, struts-config.xml, instructs the application to use the Struts validator plug-in.

  3. 3

    The plug-in tag of the Struts configuration XML file includes the name of the validator plug-in to be used and includes a set-property tag to instruct the application to use the file, validator-rules.xml, for default validation rules and the file, validation.XML, for custom validation.

Verwundbares Codebeispiel

Vulnerable Java

In the following Java example the class RegistrationForm is a Struts framework ActionForm Bean that will maintain user input data from a registration webpage for an online business site. The user will enter registration data and, through the Struts framework, the RegistrationForm bean will maintain the user data.

Verwundbar Java
public class RegistrationForm extends org.apache.struts.action.ActionForm {
```
// private variables for registration form* 
  	private String name;
  	private String email;
  	...
  	
  	public RegistrationForm() {
  	```
  		super();
  	}
```
// getter and setter methods for private variables* 
  	...
  	}
Sicheres Codebeispiel

Secure Java

However, the RegistrationForm class extends the Struts ActionForm class which does use the Struts validator plug-in to provide validator capabilities. In the following example, the RegistrationForm Java class extends the ValidatorForm and Struts configuration XML file, struts-config.xml, instructs the application to use the Struts validator plug-in.

Sicher Java
public class RegistrationForm extends org.apache.struts.validator.ValidatorForm {
```
// private variables for registration form* 
  	private String name;
  	private String email;
  	...
  	
  	public RegistrationForm() {
  	```
  		super();
  	}
  	public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {...}
```
// getter and setter methods for private variables* 
  	...
  	}
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Präventions-Checkliste

How to prevent CWE-106

  • Architecture and Design Use an input validation framework such as Struts.
  • Architecture and Design Use an input validation framework such as Struts.
  • Implementation Use the Struts Validator to validate all program input before it is processed by the application. Ensure that there are no holes in the configuration of the Struts Validator. Example uses of the validator include checking to ensure that: - Phone number fields contain only valid characters in phone numbers - Boolean values are only "T" or "F" - Free-form strings are of a reasonable length and composition
  • Implementation Use the Struts Validator to validate all program input before it is processed by the application. Ensure that there are no holes in the configuration of the Struts Validator. Example uses of the validator include checking to ensure that: - Phone number fields contain only valid characters in phone numbers - Boolean values are only "T" or "F" - Free-form strings are of a reasonable length and composition
Erkennungssignale

How to detect CWE-106

SAST High

Führe statische Analyse (SAST) auf der Codebasis aus und suche im Datenfluss nach dem unsicheren Muster.

DAST Moderate

Führe dynamische Application-Security-Tests gegen den Live-Endpoint aus.

Runtime Moderate

Beobachte Runtime-Logs auf ungewöhnliche Exception-Traces, fehlerhafte Eingaben oder Versuche, Autorisierung zu umgehen.

Code review Moderate

Code Review: Markiere jeden neuen Code, der Eingaben von dieser Oberfläche ohne validierte Framework-Helper verarbeitet.

Plexicus Auto-Fix

Plexicus erkennt CWE-106 automatisch und öffnet in unter 60 Sekunden einen Fix-PR.

Codex Remedium scannt jeden Commit, identifiziert genau diese Schwachstelle und liefert einen reviewer-ready Pull Request mit dem Patch. Keine Tickets. Keine Hand-offs.

Häufig gestellte Fragen

Frequently asked questions

Was ist CWE-106?

This weakness occurs when a Java application, particularly one using the Struts framework, does not implement a structured input validation plugin like the Struts Validator. Skipping this framework forces developers to write custom validation logic, which is often error-prone and increases the risk of security flaws from improperly handled user input.

Wie gravierend ist CWE-106?

MITRE hat für diese Schwachstelle keine Exploit-Wahrscheinlichkeit veröffentlicht. Behandle sie als mittlere Auswirkung, bis dein Threat Model anderes belegt.

Welche Sprachen oder Plattformen sind von CWE-106 betroffen?

MITRE lists the following affected platforms: Java.

Wie kann ich CWE-106 verhindern?

Use an input validation framework such as Struts. Use an input validation framework such as Struts.

Wie erkennt und behebt Plexicus CWE-106?

Die SAST-Engine von Plexicus erkennt die Datenfluss-Signatur von CWE-106 bei jedem Commit. Bei einem Treffer öffnet unser Codex-Remedium-Agent einen Fix-PR mit korrigiertem Code, Tests und einer einzeiligen Zusammenfassung für den Reviewer.

Wo erfahre ich mehr über CWE-106?

MITRE veröffentlicht die kanonische Definition unter https://cwe.mitre.org/data/definitions/106.html. Für ergänzende Hinweise kannst du auch die OWASP- und NIST-Dokumentation heranziehen.

Bereit, wenn du es bist

Schluss mit dem Bezahlen pro Entwickler.
Schließ den Kreislauf.

Plexicus ist die KI-native ASPM, die scannt, filtert, fixt, pentestet und erklärt — autonom. Unbegrenzte Entwickler, unbegrenzte Repos, Fair-Use-KI-Aktionen. Echter kostenloser Tarif, €269/mo jährlich, wenn du bereit bist.