CWE-110: Struts: Validator Without Form Field

Description

Validation fields that do not appear in forms they are associated with indicate that the validation logic is out of date.

Submission Date :

July 19, 2006, midnight

Modification Date :

2023-06-29 00:00:00+00:00

Organization :

MITRE
Extended Description

It is easy for developers to forget to update validation logic when they make changes to an ActionForm class. One indication that validation logic is not being properly maintained is inconsistencies between the action form and the validation form.

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.

Example Vulnerable Codes

Example - 1

This example shows an inconsistency between an action form and a validation form. with a third field.

This first block of code shows an action form that has two fields, startDate and endDate.


this.startDate = startDate;
this.endDate = endDate;String startDate, endDate;public void setStartDate(String startDate) {}public void setEndDate(String endDate) {}public class DateRangeForm extends ValidatorForm {}

This second block of related code shows a validation form with a third field: scale. The presence of the third field suggests that DateRangeForm was modified without taking validation into account.

<arg0 key="start.date"/>
<arg0 key="end.date"/>
<arg0 key="range.scale"/><field property="startDate" depends="date"></field><field property="endDate" depends="date"></field><field property="scale" depends="integer"></field><form name="DateRangeForm"></form>

Related Weaknesses

This table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined to give an overview of the different insight to similar items that may exist at higher and lower levels of abstraction.

Visit http://cwe.mitre.org/ for more details.