It is possible out of the box. There is a commercial CB Replicator solution that solves exactly this problem. It performs complex mapping of the CRM security model in SharePoint groups and folder-level permissions.
It is briefly described that it deploys a tiny plugin in CRM that collects all the events that may require permission changes. There is a separate service that receives these events and writes the appropriate permissions to SharePoint as element-level permissions for referenced folders using the sharepointdocumentlocation object.
It supports various actions in CRM that change permissions, for example, security roles, hierarchy of business units, depth of privileges, team membership, access group, access command templates, sharing.
source share