Description
The product has a validator form that either does not define a validate() method, or defines a validate() method but does not call super.validate().
Potential Impact
Other
Unexpected State, Varies by Context
Confidentiality, Integrity, Availability, Other
Other
Demonstrative Examples
public class RegistrationForm extends org.apache.struts.validator.ValidatorForm {
// private variables for registration formprivate String name;private String email;...
public RegistrationForm() {super();}
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {ActionErrors errors = new ActionErrors();if (getName() == null || getName().length() < 1) {errors.add("name", new ActionMessage("error.name.required"));}return errors;}
// getter and setter methods for private variables...
}public class RegistrationForm extends org.apache.struts.validator.ValidatorForm {
// private variables for registration formprivate String name;private String email;...
public RegistrationForm() {super();}
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {ActionErrors errors = super.validate(mapping, request);if (errors == null) {errors = new ActionErrors();}
if (getName() == null || getName().length() < 1) {errors.add("name", new ActionMessage("error.name.required"));}return errors;
}
// getter and setter methods for private variables...}Mitigations & Prevention
Implement the validate() method and call super.validate() within that method.
Detection Methods
- Automated Static Analysis High — Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then sea
Related Weaknesses
Taxonomy Mappings
- 7 Pernicious Kingdoms: — Struts: Erroneous validate() Method
- Software Fault Patterns: SFP24 — Tainted input to command
Frequently Asked Questions
What is CWE-103?
CWE-103 (Struts: Incomplete validate() Method Definition) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Variant-level weakness. The product has a validator form that either does not define a validate() method, or defines a validate() method but does not call super.validate().
How can CWE-103 be exploited?
Attackers can exploit CWE-103 (Struts: Incomplete validate() Method Definition) to unexpected state, varies by context. This weakness is typically introduced during the Implementation phase of software development.
How do I prevent CWE-103?
Key mitigations include: Implement the validate() method and call super.validate() within that method.
What is the severity of CWE-103?
CWE-103 is classified as a Variant-level weakness (Low-Medium abstraction). Its actual severity depends on the specific context and how the weakness manifests in your application.