2023-10-27 09:29:39 +02:00
|
|
|
Having two form validation entries with the same name indicates a configuration
|
|
|
|
issue. Only one of the two configurations will be applied, which can lead to
|
|
|
|
validation gaps.
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
2023-10-27 09:29:39 +02:00
|
|
|
In Struts, form validation is used to validate the data the application's
|
|
|
|
clients provide as part of a form submission to the server. Configuring two
|
|
|
|
different form validations with the same name leads to unexpected behaviors.
|
|
|
|
|
|
|
|
When faced with multiple form validations with the same name, Struts will
|
|
|
|
arbitrarily choose one and apply it while discarding the others.
|
|
|
|
|
|
|
|
=== What is the potential impact?
|
2021-04-28 16:49:39 +02:00
|
|
|
|
2023-10-27 09:29:39 +02:00
|
|
|
The application might perform an incomplete validation of user-submitted forms.
|
|
|
|
Some parts of the validation configuration defined in discarded items will not
|
|
|
|
apply, which can have severe consequences if not duplicated in the applied one.
|
2021-04-28 16:49:39 +02:00
|
|
|
|
2023-10-27 09:29:39 +02:00
|
|
|
Missing input validation can make the application vulnerable to injection
|
|
|
|
attacks or other severe issues. They might affect the confidentiality,
|
|
|
|
integrity, or availability of the application or the data it stores.
|
2021-04-28 16:49:39 +02:00
|
|
|
|
2023-10-27 09:29:39 +02:00
|
|
|
== How to fix it
|
2021-04-28 16:49:39 +02:00
|
|
|
|
2023-10-27 09:29:39 +02:00
|
|
|
=== Code examples
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2023-10-27 09:29:39 +02:00
|
|
|
==== Noncompliant code example
|
2021-04-28 16:49:39 +02:00
|
|
|
|
2023-10-27 09:29:39 +02:00
|
|
|
[source,xml,diff-id=1,diff-type=noncompliant]
|
2021-04-28 16:49:39 +02:00
|
|
|
----
|
|
|
|
<form-validation>
|
|
|
|
<formset>
|
|
|
|
<form name="BookForm"> ... </form>
|
|
|
|
<form name="BookForm"> ... </form> <!-- Noncompliant -->
|
|
|
|
</formset>
|
|
|
|
</form-validation>
|
|
|
|
----
|
|
|
|
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2023-10-27 09:29:39 +02:00
|
|
|
==== Compliant solution
|
2021-04-28 16:49:39 +02:00
|
|
|
|
2023-10-27 09:29:39 +02:00
|
|
|
[source,xml,diff-id=1,diff-type=compliant]
|
2021-04-28 16:49:39 +02:00
|
|
|
----
|
|
|
|
<form-validation>
|
|
|
|
<formset>
|
|
|
|
<form name="BookForm"> ... </form>
|
|
|
|
</formset>
|
|
|
|
</form-validation>
|
|
|
|
----
|
|
|
|
|
2023-10-27 09:29:39 +02:00
|
|
|
=== How does this work?
|
|
|
|
|
|
|
|
Only one validation configuration should remain. Depending on what was
|
|
|
|
previously configured, one should either remove the useless validation entries
|
|
|
|
or merge all of them into a single complete one.
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
== Resources
|
2021-04-28 16:49:39 +02:00
|
|
|
|
2023-10-27 09:29:39 +02:00
|
|
|
=== Standards
|
|
|
|
|
|
|
|
* CWE - https://cwe.mitre.org/data/definitions/102[CWE-102 - Struts: Duplicate Validation Forms]
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2023-10-27 09:29:39 +02:00
|
|
|
=== Documentation
|
|
|
|
|
|
|
|
* Struts Documentation - https://svn.apache.org/repos/asf/struts/struts1/tags/STRUTS_1_1_B1/contrib/validator/docs/overview.html[Struts Validator]
|
|
|
|
* OWASP - https://owasp.org/www-community/vulnerabilities/Improper_Data_Validation[Improper Data Validation]
|
2021-06-02 20:44:38 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
2021-09-20 15:38:42 +02:00
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
=== Message
|
|
|
|
|
|
|
|
Rename this form; line x holds another form declaration with the same name.
|
|
|
|
|
|
|
|
|
|
|
|
=== Highlighting
|
|
|
|
|
|
|
|
* primary: second instance of form name
|
|
|
|
* secondary: original instance of form name
|
|
|
|
** message: original
|
2021-09-20 15:38:42 +02:00
|
|
|
|
|
|
|
|
2021-06-08 15:52:13 +02:00
|
|
|
'''
|
2021-06-02 20:44:38 +02:00
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
=== on 12 Oct 2015, 14:49:34 Ann Campbell wrote:
|
|
|
|
in ``++validation.xml++``
|
|
|
|
|
|
|
|
=== on 19 Mar 2018, 11:04:46 Sébastien GIORIA - AppSecFR wrote:
|
|
|
|
According to [CWE-102], is a member of A1:2017 Injection.
|
|
|
|
|
|
|
|
=== on 29 May 2018, 17:07:01 Alexandre Gigleux wrote:
|
|
|
|
\[~SPoint] CWE-102 is saying "OWASP Top Ten 2004 Category A1 - Unvalidated Input" and there is no longer a category for "Unvalidated Input".
|
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
endif::env-github,rspecator-view[]
|
2023-10-27 09:29:39 +02:00
|
|
|
|