I'm not sure if this top voted answer workaround is valid anymore. It didn't work for my below Exec. anonymous code. Feel free to copy-paste and try.
Map<Id, ContentVersion> mapCV = new Map<Id, ContentVersion>();
Set<Id> setId = mapCV.keyset();
List<ContentDocumentLink> listCDL = [SELECT LinkedEntityId, ContentDocumentId, Visibility
The answer is to use a without sharing class that does access control and only delivers the data the current guest user is allowed to access. You should not be granting declarative access to objects to guest users as there is no way to distinguish them. In your controller, you can distinguish them.
In general when you have guest users your controllers will ...
PermissionsManageContentPermissions & PermissionsContentAdministrator can be used to retrieve those two app permissions from the PermissionSet object.