I sat with Kaab bin Ujra in this mosque, meaning the mosque of Kufa, and asked him about the ransom of fasting.He said, "I was carried to the Prophet ﷺ while lice were falling onto my face. He said, 'I did not think the hardship had reached this point with you. Can you find a sheep?'I replied, 'No.'He said, 'Then fast three days, or feed six poor people, half a saa of food for each, and shave your head.'So it was revealed concerning my particular case, but it applies to all of you in general."
قعدت إلى كعب بن عجرة في هذا المسجد- يعني مسجد الكوفة- فسألته عن فدية من صيام فقال: حملت إلى النبي ﷺ والقمل يتناثر على وجهي فقال: ما كنت أرى أن الجهد قد بلغ بك هذا، أما تجد شاة؟ قلت: لا، قال: صم ثلاثة أيام، أو أطعم ستة مساكين، لكل مسكين نصف صاع من طعام، واحلق رأسك فنزلت في خاصة وهي لكم عامة.
Bukhari related it in tafsir (4517), and Muslim in Hajj (85:1201), both from the hadith of Shubah, from Abdul-Rahman bin Asbahani, who said, I heard Abdullah bin Maqil say, then he mentioned it. And the words of the Almighty, "So whoever performs Umrah followed by Hajj" [Baqarah 2:196]