{"@ID": "107", "@Name": "Struts: Unused Validation Form", "@Abstraction": "Variant", "@Structure": "Simple", "@Status": "Draft", "Description": "An unused validation form indicates that validation logic is not up-to-date.", "Related_Weaknesses": {"Related_Weakness": [{"@Nature": "ChildOf", "@CWE_ID": "561", "@View_ID": "1000", "@Ordinal": "Primary"}, {"@Nature": "ChildOf", "@CWE_ID": "20", "@View_ID": "700", "@Ordinal": "Primary"}]}, "Weakness_Ordinalities": {"Weakness_Ordinality": {"Ordinality": "Resultant"}}, "Applicable_Platforms": {"Language": {"@Name": "Java", "@Prevalence": "Undetermined"}}, "Modes_Of_Introduction": {"Introduction": [{"Phase": "Implementation", "Note": "It is easy for developers to forget to update validation logic when they remove or rename action form mappings. One indication that validation logic is not being properly maintained is the presence of an unused validation form."}, {"Phase": "Operation"}]}, "Common_Consequences": {"Consequence": {"Scope": "Other", "Impact": "Quality Degradation"}}, "Detection_Methods": {"Detection_Method": {"@Detection_Method_ID": "DM-14", "Method": "Automated Static Analysis", "Description": "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 searching for potentially-vulnerable patterns that connect \"sources\" (origins of input) with \"sinks\" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)"}}, "Potential_Mitigations": {"Mitigation": {"Phase": "Implementation", "Description": "Remove the unused Validation Form from the validation.xml file."}}, "Demonstrative_Examples": {"Demonstrative_Example": {"Intro_Text": "In the following 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 in the form fields using the private member variables. The RegistrationForm class uses the Struts validation capability by extending the ValidatorForm class and including the validation for the form fields within the validator XML file, validator.xml.", "Example_Code": [{"@Nature": "Bad", "@Language": "Java", "xhtml:div": {"xhtml:br": null, "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:br": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null], "xhtml:i": ["// private variables for registration form", "// no longer using the phone form field", "// private String phone;", "// getter and setter methods for private variables"], "xhtml:div": {"@style": "margin-left:1em;", "#text": "super();"}, "#text": "private String name;private String address;private String city;private String state;private String zipcode;\n                           \n                           \n                           \n                           \n                           private String email;\n                           public RegistrationForm() {}\n                           \n                           \n                           ..."}}, "#text": "public class RegistrationForm extends org.apache.struts.validator.ValidatorForm {\n                     }"}, "#text_blocks": ["public class RegistrationForm extends org.apache.struts.validator.ValidatorForm {", "// private variables for registration form", "private String name;", "private String address;", "private String city;", "private String state;", "private String zipcode;", "// no longer using the phone form field", "// private String phone;", "private String email;", "public RegistrationForm() {", "super();", "}", "// getter and setter methods for private variables", "...", "}"]}, {"@Nature": "Bad", "@Language": "XML", "xhtml:div": {"xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:div": [{"@style": "margin-left:1em;", "#text": "<arg position=\"0\" key=\"prompt.name\"/>"}, {"@style": "margin-left:1em;", "#text": "<arg position=\"0\" key=\"prompt.address\"/>"}, {"@style": "margin-left:1em;", "#text": "<arg position=\"0\" key=\"prompt.city\"/>"}, {"@style": "margin-left:1em;", "xhtml:br": null, "xhtml:div": {"@style": "margin-left:1em;", "xhtml:br": null, "#text": "<var-name>mask</var-name><var-value>[a-zA-Z]{2}</var-value>"}, "#text": "<arg position=\"0\" key=\"prompt.state\"/><var></var>"}, {"@style": "margin-left:1em;", "xhtml:br": null, "xhtml:div": {"@style": "margin-left:1em;", "xhtml:br": null, "#text": "<var-name>mask</var-name><var-value>\\d{5}</var-value>"}, "#text": "<arg position=\"0\" key=\"prompt.zipcode\"/><var></var>"}, {"@style": "margin-left:1em;", "xhtml:br": null, "xhtml:div": {"@style": "margin-left:1em;", "xhtml:br": null, "#text": "<var-name>mask</var-name><var-value>^([0-9]{3})(-)([0-9]{4}|[0-9]{4})$</var-value>"}, "#text": "<arg position=\"0\" key=\"prompt.phone\"/><var></var>"}, {"@style": "margin-left:1em;", "#text": "<arg position=\"0\" key=\"prompt.email\"/>"}], "xhtml:br": [null, null, null, null, null, null], "#text": "<field property=\"name\" depends=\"required\"></field><field property=\"address\" depends=\"required\"></field><field property=\"city\" depends=\"required\"></field><field property=\"state\" depends=\"required,mask\"></field><field property=\"zipcode\" depends=\"required,mask\"></field><field property=\"phone\" depends=\"required,mask\"></field><field property=\"email\" depends=\"required,email\"></field>"}}, "#text": "<form name=\"RegistrationForm\"></form>"}}, "#text": "<formset></formset>"}}, "#text": "<form-validation></form-validation>"}, "#text_blocks": ["<form-validation>", "<formset>", "<form name=\"RegistrationForm\">", "<field property=\"name\" depends=\"required\">", "<arg position=\"0\" key=\"prompt.name\"/>", "</field>", "<field property=\"address\" depends=\"required\">", "<arg position=\"0\" key=\"prompt.address\"/>", "</field>", "<field property=\"city\" depends=\"required\">", "<arg position=\"0\" key=\"prompt.city\"/>", "</field>", "<field property=\"state\" depends=\"required,mask\">", "<arg position=\"0\" key=\"prompt.state\"/>", "<var>", "<var-name>mask</var-name>", "<var-value>[a-zA-Z]{2}</var-value>", "</var>", "</field>", "<field property=\"zipcode\" depends=\"required,mask\">", "<arg position=\"0\" key=\"prompt.zipcode\"/>", "<var>", "<var-name>mask</var-name>", "<var-value>\\d{5}</var-value>", "</var>", "</field>", "<field property=\"phone\" depends=\"required,mask\">", "<arg position=\"0\" key=\"prompt.phone\"/>", "<var>", "<var-name>mask</var-name>", "<var-value>^([0-9]{3})(-)([0-9]{4}|[0-9]{4})$</var-value>", "</var>", "</field>", "<field property=\"email\" depends=\"required,email\">", "<arg position=\"0\" key=\"prompt.email\"/>", "</field>", "</form>", "</formset>", "</form-validation>"]}], "Body_Text": ["However, the validator XML file, validator.xml, for the RegistrationForm class includes the validation form for the user input form field \"phone\" that is no longer used by the input form and the RegistrationForm class. Any validation forms that are no longer required should be removed from the validator XML file, validator.xml.", "The existence of unused forms may be an indication to attackers that this code is out of date or poorly maintained."]}}, "Taxonomy_Mappings": {"Taxonomy_Mapping": {"@Taxonomy_Name": "7 Pernicious Kingdoms", "Entry_Name": "Struts: Unused Validation Form"}}, "References": {"Reference": {"@External_Reference_ID": "REF-6"}}, "Mapping_Notes": {"Usage": "Allowed", "Rationale": "This CWE entry is at the Variant level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.", "Comments": "Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.", "Reasons": {"Reason": {"@Type": "Acceptable-Use"}}}, "Content_History": {"Submission": {"Submission_Name": "7 Pernicious Kingdoms", "Submission_Date": "2006-07-19", "Submission_Version": "Draft 3", "Submission_ReleaseDate": "2006-07-19"}, "Modification": [{"Modification_Name": "Eric Dalci", "Modification_Organization": "Cigital", "Modification_Date": "2008-07-01", "Modification_Version": "1.0", "Modification_ReleaseDate": "2008-09-09", "Modification_Comment": "updated Potential_Mitigations, Time_of_Introduction"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2008-09-08", "Modification_Version": "1.0", "Modification_ReleaseDate": "2008-09-09", "Modification_Comment": "updated Description, Relationships, Taxonomy_Mappings, Weakness_Ordinalities"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2010-06-21", "Modification_Version": "1.9", "Modification_ReleaseDate": "2010-06-21", "Modification_Comment": "updated Demonstrative_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-06-01", "Modification_Version": "1.13", "Modification_ReleaseDate": "2011-06-01", "Modification_Comment": "updated Common_Consequences"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-06-27", "Modification_Version": "2.0", "Modification_ReleaseDate": "2011-06-27", "Modification_Comment": "updated Common_Consequences"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2012-05-11", "Modification_Version": "2.2", "Modification_ReleaseDate": "2012-05-15", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2012-10-30", "Modification_Version": "2.3", "Modification_ReleaseDate": "2012-10-30", "Modification_Comment": "updated Potential_Mitigations"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2014-07-30", "Modification_Version": "2.8", "Modification_ReleaseDate": "2014-07-31", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2017-11-08", "Modification_Version": "3.0", "Modification_ReleaseDate": "2017-11-08", "Modification_Comment": "updated Causal_Nature, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-02-24", "Modification_Version": "4.0", "Modification_ReleaseDate": "2020-02-24", "Modification_Comment": "updated References, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2022-04-28", "Modification_Version": "4.7", "Modification_ReleaseDate": "2022-04-28", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-04-27", "Modification_Version": "4.11", "Modification_ReleaseDate": "2023-04-27", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-06-29", "Modification_Version": "4.12", "Modification_ReleaseDate": "2023-06-29", "Modification_Comment": "updated Mapping_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-12-11", "Modification_Version": "4.19", "Modification_ReleaseDate": "2025-12-11", "Modification_Comment": "updated Description, Modes_of_Introduction"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2026-10-28", "Modification_Version": "5.0", "Modification_ReleaseDate": "2026-10-28", "Modification_Comment": "updated Detection_Factors, References, Relationships"}]}, "entry_type": "Weakness"}
