The adverb 'ever' usually comes in mid-position, that is before the verb, after the auxiliary – if there is one – and after the first auxiliary if there are more than one. (Practical English Usage, fully revised fourth edition, Oxford University Press, first published in 2016, pages 199-200)
Have you ever criticised anyone?
Have you ever been criticised by anyone?
Why then does it not keep the same position in the perfect gerund?
He denied ever having criticised anyone.
He denied ever having been criticised by anyone.