Abdullah bin Masud reported,

While we were with the Prophet ﷺ in a cave at Mina, the revelation came down to him, "By those sent forth in succession" [Mursalat 77:1]. He was reciting it, and I was receiving it directly from his mouth, his mouth still moist with it, when suddenly a snake leapt out at us.The Prophet ﷺ said, "Kill it!"We rushed at it, but it escaped.The Prophet ﷺ then said, "It has been spared your harm just as you have been spared its harm."

Azami 4845

Sahih

عن عبد الله بن مسعود، قال

بينما نحن مع النبي ﷺ في غار بمنى إذ نزل عليه: {والمرسلت عرفا} [سورة المرسلات: ١] وإنه ليتلوها وإني لأتلقاها من فيه وإن فاه لرطب بها إذ وثبت علينا حية فقال النبي ﷺ: اقتلوها، فابتدرناها فذهبت، فقال النبي ﷺ: وقيت شركم كما وقيتم شرها.

الأعظمي 4845صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Hajj
Chapter
What is permissible and what is forbidden for one in a state of ihram
Section
What the pilgrim in ihram is permitted to kill among animals in the permitted area and the sacred precinct
Numbering
Jami al-Kamil 4845 (2nd edition)
Azami 4845