Overlay 403 error page for rejected referrer
Good morning,
we maintain an AEM site for one of our customers. It runs on AEM 6.5 with sp19.
Another consulting company conducted a WAPT on the site.
While calling a service exposed by a servlet implemented in our code base, they faced an error. They said that the error is not properly handled because can reveal informations that can be used by an attacker.
These are the texts shown in the response page:
HTTP ERROR 403 Forbidden
URI: /content/mysite/some_path/_jcr_content/service.json
STATUS: 403
MESSAGE: Forbidden
SERVLET: org.apache.felix.http.base.internal.dispatch.DispatcherServlet-20a53b01
The information that should not be exposed here is the last row about DispatcherServlet.
This is the error I find in error.log
04.03.2024 10:49:33.194 *INFO* [qtp409487897-61] org.apache.sling.security.impl.ReferrerFilter Rejected referrer header for POST request to /content/mysite/some_path/_jcr_content/service.json : https://mydomain.com/content/mysite/some_path/some_page.html
Can you tell us how we can fix the problem hiding such details about DispatcherServlet ?
We already have a custom 404 page implemented at this path /apps/sling/servlet/errorhandler/404.html
We already tried implementing a 403 page at the same path (/apps/sling/servlet/errorhandler/403.html) but the custom 403 page we created is not called, we still have the message I showed before.
I don' t know if the problem is the fact that there is no /libs/sling/servlet/errorhandler/403.jsp in /libs to overlay.
The 403 page we want to implement should manage any 403 error that comes up anyway I specified "for rejected referrer" because this is the case that has been brought to our attention.
Best regards.