To safeguard against black magic, one should put their trust in GOD and ask for protection.
وَاتَّبَعوا ما تَتلُوا الشَّيٰطينُ عَلىٰ مُلكِ سُلَيمٰنَ وَما كَفَرَ سُلَيمٰنُ وَلٰكِنَّ الشَّيٰطينَ كَفَروا يُعَلِّمونَ النّاسَ السِّحرَ وَما أُنزِلَ عَلَى المَلَكَينِ بِبابِلَ هٰروتَ وَمٰروتَ وَما يُعَلِّمانِ مِن أَحَدٍ حَتّىٰ يَقولا إِنَّما نَحنُ فِتنَةٌ فَلا تَكفُر فَيَتَعَلَّمونَ مِنهُما ما يُفَرِّقونَ بِهِ بَينَ المَرءِ وَزَوجِهِ وَما هُم بِضارّينَ بِهِ مِن أَحَدٍ إِلّا بِإِذنِ اللَّهِ وَيَتَعَلَّمونَ ما يَضُرُّهُم وَلا يَنفَعُهُم وَلَقَد عَلِموا لَمَنِ اشتَرىٰهُ ما لَهُ فِى الـٔاخِرَةِ مِن خَلٰقٍ وَلَبِئسَ ما شَرَوا بِهِ أَنفُسَهُم لَو كانوا يَعلَمونَ
...The devils were disbelievers. They taught the people sorcery, and that which was sent down through the two angels of Babel, Haroot and Maroot. These two did not divulge such knowledge without pointing out "This is a test. You shall not abuse such knowledge." But the people used it in such evil schemes as the breaking up of marriages. They can never harm anyone against the will of God. They thus learn what hurts them, not what benefits them, and they know full well that whoever practices witchcraft will have no share in the Hereafter. Miserable indeed is what they sell their souls for, if they only knew.
Indeed ,they can never harm anyone against the will of GOD.
GOD is the most powerful. Hence there is no other power that can harm or benefit us if we truly believe GOD.
GOD bless .
Peace