Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) narrated: We were with the Messenger of Allah (peace and blessings be upon him) in a cave when Surah "Wal-Mursalati 'urfa" was revealed to him (peace and blessings be upon him). He (the narrator) said: I was learning it from his mouth while it was still fresh, and his mouth was still moist with it, when a snake came out at us. The Messenger of Allah (peace and blessings be upon him) said: "Kill it," but it escaped from us. Then the Messenger of Allah (peace and blessings be upon him) said: "It has been protected from your harm just as you have been protected from its harm."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 10112