It is narrated from Abdullah bin Haneen that Abdullah bin Abbas and Miswar bin Makhrama (may Allah be pleased with them) had a disagreement at a place called Abwa. Ibn Abbas (may Allah be pleased with him) said, "A person in the state of Ihram can wash his head," while Miswar said, "A person in the state of Ihram cannot wash his head." So Abdullah bin Abbas (may Allah be pleased with him) sent me to Abu Ayyub (may Allah be pleased with him) to ask about the matter. When I arrived, he was bathing between two wooden beams of a well, having covered himself with a cloth. When I arrived and greeted him with salam, he asked, "Who are you?" I replied, "I am Abdullah, and Ibn Abbas (may Allah be pleased with him) has sent me to you to ask how the Messenger of Allah (ﷺ) used to wash his blessed head while in the state of Ihram." Upon hearing this, he placed his hand on the cloth (with which he had covered himself) and lowered it until I could see his head. Then he told the person who was pouring water over his body to pour water over his head. That person poured water over his head, then he washed his head with both hands, moving both hands forward and then backward, and then said, "I saw the Messenger of Allah (ﷺ) do it in this manner while in the state of Ihram."
Hadith Referenceمسند الإمام الشافعي / كتاب الحج / 860
Hadith Takhrijاخرجه البخاري، جزاء الصيد، باب الاغتسال للمحرم (1840) ومسلم ، الحج، باب جواز غسل المحرم بدنه ورأسه (1205)۔