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.
Real-world impact

Real-world CVEs caused by CWE-105

No public CVE references are linked to this CWE in MITRE's catalog yet.

How attackers exploit it

Step-by-step attacker path

  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.

Vulnerable code example

Vulnerable XML

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

Vulnerable 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>
Secure code example

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.

Secure 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.
Prevention checklist

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.
Detection signals

How to detect CWE-105

SAST High

Run static analysis (SAST) on the codebase looking for the unsafe pattern in the data flow.

DAST Moderate

Run dynamic application security testing against the live endpoint.

Runtime Moderate

Watch runtime logs for unusual exception traces, malformed input, or authorization bypass attempts.

Code review Moderate

Code review: flag any new code that handles input from this surface without using the validated framework helpers.

Plexicus auto-fix

Plexicus auto-detects CWE-105 and opens a fix PR in under 60 seconds.

Codex Remedium scans every commit, identifies this exact weakness, and ships a reviewer-ready pull request with the patch. No tickets. No hand-offs.

Frequently asked questions

Frequently asked questions

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.

How serious is CWE-105?

MITRE has not published a likelihood-of-exploit rating for this weakness. Treat it as medium-impact until your threat model proves otherwise.

What languages or platforms are affected by CWE-105?

MITRE lists the following affected platforms: Java.

How can I prevent CWE-105?

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

How does Plexicus detect and fix CWE-105?

Plexicus's SAST engine matches the data-flow signature for CWE-105 on every commit. When a match is found, our Codex Remedium agent opens a fix PR with the corrected code, tests, and a one-line summary for the reviewer.

Where can I learn more about CWE-105?

MITRE publishes the canonical definition at https://cwe.mitre.org/data/definitions/105.html. You can also reference OWASP and NIST documentation for adjacent guidance.

Ready when you are

Don't Let Security
Weigh You Down.

Stop choosing between AI velocity and security debt. Plexicus is the only platform that runs Vibe Coding Security and ASPM in parallel — one workflow, every codebase.