The Messenger of Allah ﷺ said to him, "Perhaps the lice on your head are troubling you?"He replied, "Yes, Messenger of Allah."The Messenger of Allah ﷺ said, "Shave your head, and fast three days, or feed six poor people, or sacrifice a sheep."
أن رسول الله ﷺ قال له: لعلك آذاك هوامك؟ فقلت: نعم يا رسول الله، فقال رسول الله ﷺ: احلق رأسك، وصم ثلاثة أيام، أو أطعم سنة مساكين، أو انسك بشاة.
Malik narrated it in Hajj (238) from Humayd bin Qays, from Mujahid Abu Hajjaj, from Abdul-Rahman bin Abu Layla, from Kaab bin Ujra, and he mentioned it. Bukhari narrated it in the chapter on being prevented from completing the pilgrimage (1814) from Abdullah bin Yusuf, who said Malik informed us, with the same wording.Bukhari (1815) and Muslim (1201) both narrated it through the hadith of Sayf (who is Ibn Sulayman), from Mujahid, who said, I heard Abdul-Rahman bin Abu Layla say that Kaab bin Ujra told him, he said, "The Messenger of Allah ﷺ stopped by me at Hudaybiya, while lice were falling off my head." He said, "Are your vermin bothering you?" I said, "Yes." He said, "Then shave your head," or he said, "Shave it." He said, it was concerning me that this verse was revealed (then he mentioned the verse). The Prophet said, "Fast three days, or give a faraq of food in charity divided among six people, or offer whatever sacrifice is easiest for you."Bukhari narrated it in tafsir (4517), and Muslim in Hajj (1201:85), through the route of Shuba, from Abdul-Rahman bin Asbahani, who said, I heard Abdullah bin Maqil say, I sat with Kaab bin Ujra in this masjid, meaning the masjid of Kufa, and I asked him about "then a fidya of fasting" [Baqarah 2:196], and he said, I was carried to the Prophet ﷺ while lice were falling off my face, and he said, "I did not think the hardship had reached you to this extent. Do you have a sheep?" I said, "No." He said, "Fast three days, or feed six poor people, half a saa of food for each poor person, and shave your head." It was revealed concerning me specifically, but it applies to all of you generally.As for what Malik narrated in Hajj (252) from Abdul-Kareem bin Malik Jazari, from Abdul-Rahman bin Abu Layla, from Kaab bin Ujra, that he was with the Messenger of Allah ﷺ in a state of pilgrim consecration, and lice troubled him on his head, so the Messenger of Allah ﷺ ordered him to shave his head and said, "Fast three days, or feed six poor people, two mudds for each person, or sacrifice a sheep. Whichever of these you do will suffice for you." This has a break in the chain between Abdul-Kareem bin Malik and Abdul-Rahman bin Abu Layla. This is how Yahya narrated it from Malik, omitting Mujahid between them.Ibn Abdul-Barr said, "Abu Musab, Ibn Bukayr, Qanabi, Mutarrif, Shafii, Maen bin Isa, Saeed bin Afir, Abdullah bin Yusuf Tanisi, Musab Zubayri, and Muhammad bin Mubarak Sawri all followed him in this, all of them narrating it from Malik just as Yahya narrated it, without mentioning Mujahid in the chain of this hadith. Ibn Wahb, Ibn Qasim, and Makki bin Ibrahim narrated it from Malik, from Abdul-Kareem Jazari, from Mujahid, from Abdul-Rahman bin Abu Layla, from Kaab bin Ujra." He said, "The correct view regarding the chain of this hadith is the statement of those who placed Mujahid between Abdul-Kareem and Ibn Abu Layla, and whoever omitted him erred in doing so. Shafii claimed that it was Malik who made the mistake in this." End of quote. See Tamhid (20/62).Bayhaqi narrated it (5/55) through the route of Husayn bin Walid, who said, Malik bin Anas narrated to us, from Abdul-Kareem Jazari, from Mujahid, from Abdul-Rahman bin Abu Layla, from Kaab bin Ujra, and he mentioned it. Bayhaqi said, "Husayn bin Walid Nisaburi narrated it soundly from Malik. Ibn Wahb likewise narrated it from Malik, and a group narrated it from Malik without mentioning Mujahid in its chain, and barley is mentioned only in the narration of Husayn bin Walid, not in others."Malik held the view of this choice mentioned in the hadith of Abdul-Kareem, saying, "Everything in the Book of Allah concerning expiations stated as 'this or that,' the person concerned has the choice in that, to do whichever he prefers." He said, "As for the sacrifice, it is a sheep. As for fasting, it is three days. As for the food, six poor people are fed, two mudds for each poor person, by the mudd of the Prophet ﷺ." End of quote.See, for more details and the statements of scholars on this, Minna Kubra (4/44–50).As for what has been reported that he ﷺ ordered him to sacrifice a cow, this is daif. Abu Dawud narrated it (1859), and it contains an unnamed man, as well as a contradiction with the trustworthy narrators who specified a sheep or whatever is easiest.