Safari homepage hijacked and I can't change back
This answer is not for a malware hijack situation, but rather a bug in Safari 11.0 that does not allow you to change the homepage. If you try to change the homepage, as soon as you defocus from that field, it reverts back to the original.

The workaround is:


Enter the new homepage. Do not press tab/enter or leave the field.
Click on another tab in Preferences, such as the Advanced tab.


Now it should ask you to confirm to change your homepage.