CWE-608: Struts: Non-private Field in ActionForm Class

Export to Word

Description

An ActionForm class contains a field that has not been declared private, which can be accessed without using a setter or getter.

Extended Description

N/A


ThreatScore

Threat Mapped score: 0.0

Industry: Finiancial

Threat priority: Unclassified


Observed Examples (CVEs)

Related Attack Patterns (CAPEC)

N/A


Attack TTPs

N/A

Modes of Introduction

Phase Note
Implementation N/A

Common Consequences

Potential Mitigations

Applicable Platforms


Demonstrative Examples

Intro: 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 a online business site. The user will enter registration data and through the Struts framework the RegistrationForm bean will maintain the user data.

Body: However, within the RegistrationForm the member variables for the registration form input data are declared public not private. All member variables within a Struts framework ActionForm class must be declared private to prevent the member variables from being modified without using the getter and setter methods. The following example shows the member variables being declared private and getter and setter methods declared for accessing the member variables.

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

Notes

← Back to CWE list