Struts: Form Field Without Validator

Draft Variant
Structure: Simple
Description

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

Extended Description

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.

Common Consequences 2
Scope: Integrity

Impact: Unexpected State

Scope: Integrity

Impact: Bypass Protection Mechanism

If unused fields are not validated, shared business logic in an action may allow attackers to bypass the validation checks that are performed for other uses of the form.

Potential Mitigations 1
Phase: Implementation
Validate all form fields. If a field is unused, it is still important to constrain it so that it is empty or undefined.
Demonstrative Examples 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.

Code Example:

Result
bash

// private variables for registration form* private String name; private String address; private String city; private String state; private String zipcode; private String phone; private String email;

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

Code Example:

Bad
XML
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.

Code Example:

Good
XML
xml
References 1
Seven Pernicious Kingdoms: A Taxonomy of Software Security Errors
Katrina Tsipenyuk, Brian Chess, and Gary McGraw
NIST Workshop on Software Security Assurance Tools Techniques and MetricsNIST
07-11-2005
ID: REF-6
Applicable Platforms
Languages:
Java : Undetermined
Modes of Introduction
Implementation
Taxonomy Mapping
  • 7 Pernicious Kingdoms
  • Software Fault Patterns