Thesis: If God exists, then anything is permitted.

(To be more precise: If God exists, then anything that actually happens is permitted.)

Assume that God exists. Then God is the creator of the actual world, God is omnibenevolent, and God is omnipotent. So God created the actual world, and, because of His omnibenevolence, He did so as well as He could. But because of His omnipotence, a world that is as good as He could make it is one that is as good as one could be. Thus the actual world is among the best of all possible worlds.

Other things being equal, pain is bad. Pain can be good because it is deserved, and pain can be necessary because of its consequences.

A best of all possible worlds would contain nothing unnecessarily bad. Undeserved pain that is not necessitated by its consequences is bad, and it is not necessary; thus, it is unnecessarily bad.

But the actual world is among the best of all possible worlds, so it contains nothing unnecessarily bad. Thus is contains no undeserved pain or pain that is not necessitated by its consequences. Thus all actual pain is deserved or necessary because of its consequences.

That includes any pain that I might deliberately cause. Thus, if I deliberately cause pain, that pain will be deserved or necessary. E.g., if I deliberately torture babies to death, in front of their helpless parents, the pain, both of infant and parent, will be deserved or necessary.

It is permissible to cause deserved or necessary pain. Thus, it is permitted to torture babies to death in front of their helpless parents.

If it is permissible to torture babies to death in front of their helpless parents, then anything is permitted.

Thus, if God exists, then anything is permitted. QED.

If there is a religion that could form the basis of some kind of morality, it is not a religion with a monotheistic deity or one that creates the universe and is omnipotent and omnibenevolent.