Maliks Muwatta Book 20, Hadith Number 248.
Yahya related to me from Malik that Ata ibn Abdullah al-Khurasani said that an old man from Suq al-Buram in Kufa had related to him that Kab ibn Ujra said, “The Messenger of Allah, may Allah bless him and grant him peace, came to me while I was blowing under a cooking pot belonging to my companions and my head and beard were full of lice. He took my forehead and said, ‘Shave your hair and fast three days or feed six poor people.’ The Messenger of Allah, may Allah bless him and grant him peace, was aware that I did not have anything with me to sacrifice.'”
Malik said, concerning paying compensation (fidya) for the relief of physical discomfort, “The custom concerning it is that no one pays compensation until he has done something which makes it obligatory to pay compensation just as making amends (kaffara) is only done when it has become obligatory for the one who owes it. The person can pay the compensation wherever he wishes, regardless of whether he has to sacrifice an animal or fast or give sadaqa… in Makka or in any other town.”
Malik said, “It is not correct for a person in ihram to pluck out any of his hair or to shave it or cut it until he has left ihram, unless he is suffering from an ailment of the head, in which case he owes the compensation Allah the Exalted has ordered. It is not correct for a person in ihram to cut his nails, or to kill his lice, or to remove them from his head or from his skin or his garment to the ground. If a person in ihram removes lice from his skin or his garment, he must give away the quantity of food that he can scoop up with both hands.”
Malik said, “Anyone who, while in ihram, plucks out hairs from his nose or armpit or rubs his body with a depilatory agent or shaves the hair from around a head wound out of necessity or shaves his neck for the place of the cupping glasses, regardless of whether it is in forgetfulness or in ignorance, owes compensation in all these instances, and he must not shave the place of the cupping glasses. Someone, who, out of ignorance, shaves his head before he stones the jamra. must also pay compensation.”