I came to the Prophet ﷺ during the time of Hudaybiyyah while lice were falling onto my face. He asked, "Are the vermin of your head troubling you?"I replied, "Yes."He said, "Then shave your head and fast three days, or feed six poor people, or offer a sacrifice."Ayub said, "I do not know with which of these he began."
أتى علي النبي ﷺ زمن الحديبية والقمل يتناثر على وجهي! فقال: أيؤذيك هوام رأسك؟ قلت: نعم. قال: فاحلق وصم ثلاثة أيام، أو أطعم ستة مساكين، أو انسك نسيكة. قال أيوب: لا أدري بأي هذا بدأ.
Bukhari related it in the Book of Military Expeditions (4190), and Muslim in the Book of Hajj (1201:80), both through the route of Hammad bin Zayd, who said, Ayub narrated to us, saying, I heard Mujahid, from Abdul-Rahman bin Abu Layla, from Kaab bin Ujra, with this wording. The wording given is Bukhari's.Bukhari also related it in the Book of Military Expeditions (4191) through the route of Warqa, from Abu Bishr, from Mujahid, with this chain, from Kaab bin Ujra, who said, "We were with the Messenger of Allah ﷺ at Hudaybiya while we were in the state of ihram..."