CWE-105 Variant Draft

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 unverified user input.

Definition

What is CWE-105?

This vulnerability occurs when a Struts application form contains an input field that lacks a corresponding validator, leaving it open to unverified user input.
Leaving even one form field without validation creates a direct opening for attackers. They can exploit this oversight to inject malicious data, bypass security checks, or manipulate application logic, potentially leading to data breaches, unauthorized access, or system compromise. While Java applications themselves are often protected from low-level memory issues, the risk escalates if the application interacts with native code or external systems. An attacker could use this unvalidated input as an entry point to trigger buffer overflows or other critical vulnerabilities in those connected components, turning a simple input oversight into a severe chained attack.
Auswirkungen in der Praxis

Real-world CVEs caused by CWE-105

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 example the Java 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 in the form fields using the private member variables. The RegistrationForm class uses the Struts validation capability by extending the ValidatorForm class and including the validation for the form fields within the validator XML file, validator.xml.

  2. 2

    The validator XML file, validator.xml, provides the validation for the form fields of the RegistrationForm.

  3. 3

    However, in the previous example the validator XML file, validator.xml, does not provide validators for all of the form fields in the RegistrationForm. Validator forms are only provided for the first five of the seven form fields. The validator XML file should contain validator forms for all of the form fields for a Struts ActionForm bean. The following validator.xml file for the RegistrationForm class contains validator forms for all of the form fields.

Verwundbares Codebeispiel

Vulnerable XML

The validator XML file, validator.xml, provides the validation for the form fields of the RegistrationForm.

Verwundbar XML
<form-validation>
  	<formset>
  		<form name="RegistrationForm">
  			<field property="name" depends="required">
  				<arg position="0" key="prompt.name"/>
  			</field>
  			<field property="address" depends="required">
  				<arg position="0" key="prompt.address"/>
  			</field>
  			<field property="city" depends="required">
  				<arg position="0" key="prompt.city"/>
  			</field>
  			<field property="state" depends="required,mask">
  				<arg position="0" key="prompt.state"/>
  				<var>
  					<var-name>mask</var-name>
  					<var-value>[a-zA-Z]{2}</var-value>
  				</var>
  			</field>
  			<field property="zipcode" depends="required,mask">
  				<arg position="0" key="prompt.zipcode"/>
  				<var>
  					<var-name>mask</var-name>
  					<var-value>\d{5}</var-value>
  				</var>
  			</field>
  		</form>
  	</formset>
  </form-validation>
Sicheres Codebeispiel

Secure XML

However, in the previous example the validator XML file, validator.xml, does not provide validators for all of the form fields in the RegistrationForm. Validator forms are only provided for the first five of the seven form fields. The validator XML file should contain validator forms for all of the form fields for a Struts ActionForm bean. The following validator.xml file for the RegistrationForm class contains validator forms for all of the form fields.

Sicher XML
<form-validation>
  	<formset>
  		<form name="RegistrationForm">
  			<field property="name" depends="required">
  				<arg position="0" key="prompt.name"/>
  			</field>
  			<field property="address" depends="required">
  				<arg position="0" key="prompt.address"/>
  			</field>
  			<field property="city" depends="required">
  				<arg position="0" key="prompt.city"/>
  			</field>
  			<field property="state" depends="required,mask">
  				<arg position="0" key="prompt.state"/>
  				<var>
  					<var-name>mask</var-name>
  					<var-value>[a-zA-Z]{2}</var-value>
  				</var>
  			</field>
  			<field property="zipcode" depends="required,mask">
  				<arg position="0" key="prompt.zipcode"/>
  				<var>
  					<var-name>mask</var-name>
  					<var-value>\d{5}</var-value>
  				</var>
  			</field>
  			<field property="phone" depends="required,mask">
  				<arg position="0" key="prompt.phone"/>
  				<var>
  					<var-name>mask</var-name>
  					<var-value>^([0-9]{3})(-)([0-9]{4}|[0-9]{4})$</var-value>
  				</var>
  			</field>
  			<field property="email" depends="required,email">
  				<arg position="0" key="prompt.email"/>
  			</field>
  		</form>
  	</formset>
  </form-validation>
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-105

  • Implementation Validate all form fields. If a field is unused, it is still important to constrain it so that it is empty or undefined.
Erkennungssignale

How to detect CWE-105

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

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

Wie gravierend ist CWE-105?

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-105 betroffen?

MITRE lists the following affected platforms: Java.

Wie kann ich CWE-105 verhindern?

Validate all form fields. If a field is unused, it is still important to constrain it so that it is empty or undefined.

Wie erkennt und behebt Plexicus CWE-105?

Die SAST-Engine von Plexicus erkennt die Datenfluss-Signatur von CWE-105 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-105?

MITRE veröffentlicht die kanonische Definition unter https://cwe.mitre.org/data/definitions/105.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.