April 20, 2020
Estimated Post Reading Time ~

The CSRF Protection Framework in AEM

AEM 6.1 ships with a mechanism that helps protect against Cross-Site Request Forgery attacks, called the CSRF Protection Framework. For more information on how to use it, consult the documentation.

The Sling Referrer Filter
To address known security issues with Cross-Site Request Forgery (CSRF) in CRX WebDAV and Apache Sling you need to add configurations for the Referrer filter in order to use it.

The referrer filter service is an OSGi service that allows you to configure:
which http methods should be filtered
whether an empty referrer header is allowed
and a white list of servers to be allowed in addition to the server host. By default, all variations of localhost and the current host names the server is bound to are on the white list.

To configure the referrer filter service:
- Open the Apache Felix console (Configurations) at:
http://localhost:4502/system/console/configMgr

- Login as admin.
- In the Configurations menu, select:
Apache Sling Referrer Filter
- In the Allow Hosts field, enter all hosts that are allowed as a referrer. Each entry needs to be of the form
://:

For example:
http://allowed.server:80 allows all requests from this server with the given port.
If you also want to allow https requests, you have to enter a second line.
If you allow all ports from that server you can use 0 as the port number.
- Check the Allow Empty field, if you want to allow empty/missing referrer headers.

Caution:
It is recommended to provide a referrer while using command-line tools such as cURL instead of allowing an empty value as it might expose your system to CSRF attacks.

Edit the methods this filter should use for checks with the Filter Methods field
Click Save to save your changes.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.