All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
It is confirmed that the Prophet said: “There are five (kinds of creatures) for which there is no sin on the one who kills them (while he is) in the state of Ihraam (ritual consecration) or inside the Haram (sacred precincts of Makkah): the rat, the scorpion, the crow, the kite, and the mordacious (biting) dog.” [Al-Bukhari and Muslim; this is the wording of Muslim]
There are various narrations of this Hadeeth reported by Al-Bukhari and Muslim or by others scholars (in the Sunan). The scholars differed in opinion as to whether the permission to kill them means only permissibility, or that it is recommended to kill them. The view of the Hanbali and Shaafi'i Schools, which is the correct view –Allah willing –is that killing these animals is desirable in order to repel their harm and evil. Therefore, if a person kills them while seeking the reward of Allah, he will be rewarded.
For more benefit, please refer to Fataawa 342181, 355552, 36901, 90204, 119702, and 363838.
Allah knows best.