Is Apple iCloud storage safe from Ransomware?
If someone was to obtain your Apple ID password they could change the password and then have control of your account. The usual way that is done is by phishing -- sending an email or message that appears to be from Apple and tricking you into using a link in the email or message so that you log in and give them your password.
It seems to be extremely unusual for that to happen to gain access to iCloud (I haven't heard of a case); the usual scenario is for thieves to do that in order to remove activation lock from a stolen iPhone or other device to make the device usable and they don't seem (from what I have seen reported) to care about any information stored on iCloud.
You can prevent that (and other methods) by using two-factor authentication to protect your Apple ID. See: Two-factor authentication for Apple ID - Apple Support