2023-10-26 15:19:47 +02:00
|
|
|
This vulnerability exposes the application to failures of a wide range of
|
|
|
|
application-specific features the Strut filter was supposed to perform, such as
|
|
|
|
authentication, logging, encryption, and more.
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
2023-10-26 15:19:47 +02:00
|
|
|
Filters are used to intercept requests and responses from a server and allow
|
|
|
|
developers to manipulate them. When a `filter` is declared, but the
|
|
|
|
corresponding `filter assignment` is inadvertently not, then the code is
|
|
|
|
vulnerable to security problems or business logic instability.
|
2021-04-28 16:49:39 +02:00
|
|
|
|
2023-10-26 15:19:47 +02:00
|
|
|
If a filter is defined in the web application descriptor file `web.xml` but is
|
|
|
|
not used in a "filter mapping", this is an indication that it may have been
|
|
|
|
forgotten.
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2023-10-26 15:19:47 +02:00
|
|
|
=== What is the potential impact?
|
2021-04-28 16:49:39 +02:00
|
|
|
|
2023-10-26 15:19:47 +02:00
|
|
|
If a filter is not used in a ``++<filter-mapping>++`` element, it will not be
|
|
|
|
called. Below are some examples of the impact of this oversight.
|
|
|
|
|
|
|
|
==== Unauthorized access
|
|
|
|
|
|
|
|
One of the main uses of Struts filters is to provide security measures such as
|
|
|
|
authentication and authorization. If a filter is forgotten in the filter
|
|
|
|
mappings, unauthorized users could gain access to sensitive data or perform
|
|
|
|
actions that they are not authorized to perform.
|
|
|
|
|
|
|
|
==== Functional problems
|
2021-04-28 16:49:39 +02:00
|
|
|
|
2023-10-26 15:19:47 +02:00
|
|
|
Filters can also be used to modify requests and responses, format data, or even
|
|
|
|
handle errors. If these features are not included in the filter mappings, they
|
|
|
|
may not work as expected, resulting in a poor user experience or even
|
|
|
|
application crash.
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2023-10-26 15:19:47 +02:00
|
|
|
==== Performance issues
|
2021-04-28 16:49:39 +02:00
|
|
|
|
2023-10-26 15:19:47 +02:00
|
|
|
Some filters are designed to improve the performance of your application, such
|
|
|
|
as those that implement caching strategies. If these are not mapped, you may
|
|
|
|
experience slow response times or increased server load on your application.
|
|
|
|
|
|
|
|
== How to fix it
|
|
|
|
|
|
|
|
=== Code examples
|
|
|
|
|
|
|
|
==== Noncompliant code example
|
|
|
|
|
|
|
|
[source,xml,diff-id=1,diff-type=noncompliant]
|
2021-04-28 16:49:39 +02:00
|
|
|
----
|
2023-10-26 15:19:47 +02:00
|
|
|
<filter>
|
|
|
|
<filter-name>ValidationFilter</filter-name> <!-- Noncompliant -->
|
|
|
|
<filter-class>com.myco.servlet.ValidationFilter</filter-class>
|
|
|
|
</filter>
|
2021-04-28 16:49:39 +02:00
|
|
|
----
|
|
|
|
|
2023-10-26 15:19:47 +02:00
|
|
|
==== Compliant solution
|
|
|
|
|
|
|
|
[source,xml,diff-id=1,diff-type=compliant]
|
|
|
|
----
|
|
|
|
<filter>
|
|
|
|
<filter-name>ValidationFilter</filter-name>
|
|
|
|
<filter-class>com.myco.servlet.ValidationFilter</filter-class>
|
|
|
|
</filter>
|
|
|
|
|
|
|
|
<filter-mapping>
|
|
|
|
<filter-name>ValidationFilter</filter-name>
|
|
|
|
<url-pattern>/*</url-pattern>
|
|
|
|
</filter-mapping>
|
|
|
|
----
|
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-26 15:19:47 +02:00
|
|
|
=== Documentation
|
|
|
|
|
|
|
|
* Struts Docs - https://struts.apache.org/core-developers/web-xml[Web.xml Developpers Guide]
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2023-10-26 15:19:47 +02:00
|
|
|
=== Standards
|
|
|
|
|
|
|
|
* OWASP - https://owasp.org/Top10/A05_2021-Security_Misconfiguration/[Top 10 2021 Category A5 - Security Misconfiguration]
|
|
|
|
* OWASP - https://owasp.org/www-project-top-ten/2017/A6_2017-Security_Misconfiguration[Top 10 2017 Category A6 - Security Misconfiguration]
|
2021-04-28 18:08:03 +02:00
|
|
|
|
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
|
|
|
|
|
|
|
|
* "xxx" filter should have a mapping.
|
|
|
|
|
2021-06-08 15:52:13 +02:00
|
|
|
'''
|
2023-05-25 14:18:12 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
endif::env-github,rspecator-view[]
|