Praise be to Allaah.
This hadeeth is false and has no basis. It is not permissible to learn witchcraft or to use it. It is an evil action and is kufr and misguidance. Allaah clearly stated that witchcraft is forbidden in His Book, where He says (interpretation of the meaning):
“They followed what the Shayaateen (devils) gave out (falsely of the magic) in the lifetime of Sulaymaan (Solomon). Sulaymaan did not disbelieve, but the Shayaateen (devils) disbelieved, teaching men magic and such things that came down at Babylon to the two angels, Haaroot and Maaroot, but neither of these two (angels) taught anyone (such things) till they had said, ‘We are for trial, so disbelieve not (by learning this magic from us).’ And from these (angels) people learn that by which they cause separation between man and his wife, but they could not thus harm anyone except by Allaah’s Leave. And they learn that which harms them and profits them not. And indeed they knew that the buyers of it (magic) would have no share in the Hereafter. And how bad indeed was that for which they sold their ownselves, if they but knew.
And if they had believed and guarded themselves from evil and kept their duty to Allaah, far better would have been the reward from their Lord, if they but knew!”
In these verses, Allaah clearly states that witchcraft is kufr and that it is from the teachings of the devils. Allaah has condemned them for that, and they are our enemies. And He has stated that teaching witchcraft is kufr and that it is harmful and not beneficial, so we must beware of it.
Learning witchcraft is all kufr, hence He stated that the two angels did not teach it to people until they had told them, “We are for trial, so disbelieve not (by learning this magic from us).” Then He says, “but they could not thus harm anyone except by Allaah’s Leave” so it is known that it is kufr and misguidance, and that the practitioners of witchcraft cannot harm anyone except by Allaah’s Leave. What is meant is His universal qadari will (i.e., things that He decrees should happen even though He may dislike them), not His religious shar’i will (i.e., that which He prescribes and which pleases Him) – because Allaah has not prescribed this and has not given permission for it in His sharee’ah; rather He has forbidden it and stated that it is kufr and is from the teachings of the devils. And He has stated that whoever buys it – i.e., learns it – will have no share in the Hereafter. This is a serious warning. Then Allaah says: “And how bad indeed was that for which they sold their ownselves, if they but knew” – what is meant is that they have sold themselves to the devils for this witchcraft. Then Allaah says, “And if they had believed and guarded themselves from evil and kept their duty to Allaah, far better would have been the reward from their Lord, if they but knew!” – this indicates that learning witchcraft and using it is the opposite of faith and piety. There is no power and no strength except with Allaah.
Majmoo’ Fataawa wa Maqaalaat Mutanawwi’ah li’l-Shaykh Ibn Baaz, 6/371