CWE-103 – Struts: Incomplete validate() Method Definition

Read Time:1 Minute, 18 Second

Description

The application has a validator form that either does not define a validate() method, or defines a validate() method but does not call super.validate().

If the code does not call super.validate(), the Validation Framework cannot check the contents of the form against a validation form. In other words, the validation framework will be disabled for the given form.

The Struts Validator uses a form’s validate() method to check the contents of the form properties against the constraints specified in the associated validation form. That means the following classes have a validate() method that is part of the validation framework: ValidatorForm, ValidatorActionForm, DynaValidatorForm, and DynaValidatorActionForm. If the code creates a class that extends one of these classes, and if that class implements custom validation logic by overriding the validate() method, the code must call super.validate() in the validate() implementation.

Modes of Introduction:

– Implementation

 

 

Related Weaknesses

CWE-573
CWE-20

 

Consequences

Other: Other

Disabling the validation framework for a form exposes the application to numerous types of attacks. Unchecked input is the root cause of vulnerabilities like cross-site scripting, process control, and SQL injection.

Confidentiality, Integrity, Availability, Other: Other

Although J2EE applications are not generally susceptible to memory corruption attacks, if a J2EE application interfaces with native code that does not perform array bounds checking, an attacker may be able to use an input validation mistake in the J2EE application to launch a buffer overflow attack.

 

Potential Mitigations

Phase: Implementation

Description: 

Implement the validate() method and call super.validate() within that method.

CVE References