CWE-103: Struts: Incomplete validate() Method Definition
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 it's found
Struts: Incomplete validate() Method Definition is a specific, narrowly defined instance of a broader pattern. Testers confirm it with targeted code review and a proof-of-concept input that exercises the exact code path this weakness describes.
Vulnerable vs. safe
super();
errors.add("name", new ActionMessage("error.name.required"));ActionErrors errors = new ActionErrors();if (getName() == null || getName().length() < 1) {}return errors;// private variables for registration formprivate String name;private String email;...public RegistrationForm() {}public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {}
// getter and setter methods for private variables...public class RegistrationForm extends org.apache.struts.validator.ValidatorForm {}super();
errors = new ActionErrors();ActionErrors errors = super.validate(mapping, request);if (errors == null) {}
errors.add("name", new ActionMessage("error.name.required"));// private variables for registration formprivate String name;private String email;...public RegistrationForm() {}public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {if (getName() == null || getName().length() < 1) {}return errors;
// getter and setter methods for private variables...public class RegistrationForm extends org.apache.struts.validator.ValidatorForm {}}Consequences
- Unexpected State, Varies by Context: 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. Disabling the validation framework for a form exposes the product to numerous types of attacks.
- 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.
Mitigations
- Implementation: Implement the validate() method and call super.validate() within that method.
Where this fits in a TurboPentest engagement
This weakness is not covered by the automated black-box pentest. IntegSec pentesters cover it in a manual engagement.
Frequently asked questions
What is CWE-103?
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 do you find Struts: Incomplete validate() Method Definition?
Struts: Incomplete validate() Method Definition is a specific, narrowly defined instance of a broader pattern. Testers confirm it with targeted code review and a proof-of-concept input that exercises the exact code path this weakness describes.
What is the impact of CWE-103?
Unexpected State, Varies by Context: 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. Disabling the validation framework for a form exposes the product to numerous types of attacks. 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.
Does TurboPentest test for Struts: Incomplete validate() Method Definition?
This weakness is not covered by the automated black-box pentest. IntegSec pentesters cover it in a manual engagement.
Related CWEs
Written and reviewed by
Michel Chamberland - Founder & CEO, IntegSec
CISSP, OSCP, OSCE, CEH, GIAC, CCSK · 20+ years in offensive security
Michel has spent 20+ years on offensive security teams including IBM X-Force Red and Trustwave SpiderLabs, leading penetration tests, red team engagements, and breach response for Fortune 500 customers. He is the founder of IntegSec and the architect of TurboPentest.
Find these issues before an attacker does
TurboPentest runs an agentic AI pentest against your target and reports findings with proof, from $99 per target.
Start a pentest