CWE-106: Struts: Plug-in Framework not in Use

Description

When an application does not use an input validation framework such as the Struts Validator, there is a greater risk of introducing weaknesses related to insufficient input validation.

Submission Date :

July 19, 2006, midnight

Modification Date :

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

Organization :

MITRE
Extended Description

Unchecked input is the leading cause of vulnerabilities in J2EE applications. Unchecked input leads to cross-site scripting, process control, and SQL injection vulnerabilities, among others.

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

In the following Java example the 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.


// // private variables for registration form// 
super();
// // getter and setter methods for private variables// 
private String name;private String email;...public RegistrationForm() {}...public class RegistrationForm extends org.apache.struts.action.ActionForm {}

However, the RegistrationForm class extends the Struts ActionForm class which does use the Struts validator plug-in to provide validator capabilities. In the following example, the RegistrationForm Java class extends the ValidatorForm and Struts configuration XML file, struts-config.xml, instructs the application to use the Struts validator plug-in.


// // private variables for registration form// 
super();
// // getter and setter methods for private variables// 
private String name;private String email;...public RegistrationForm() {}public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {...}...public class RegistrationForm extends org.apache.struts.validator.ValidatorForm {}

The plug-in tag of the Struts configuration XML file includes the name of the validator plug-in to be used and includes a set-property tag to instruct the application to use the file, validator-rules.xml, for default validation rules and the file, validation.XML, for custom validation.


<form-bean name="RegistrationForm" type="RegistrationForm"/>

property="pathnames"value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/><set-property<form-beans></form-beans>...<!-- ========================= Validator plugin ================================= --><plug-in className="org.apache.struts.validator.ValidatorPlugIn"></plug-in>
<struts-config></struts-config>

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.

© cvefeed.io
Latest DB Update: Nov. 23, 2024 8:10