Anas was asked about cupping for a person in the state of ihram. He replied, "The Messenger of Allah ﷺ had himself cupped due to a pain he was suffering from."
حدثنا علي بن عبد الله حدثنا معتمر قال سمعت
سئل أنس عن الحجامة للمحرم فقال احتجم رسول الله ﷺ من وجع كان به
No references are available.
Its isnad is sahih, it has come up many times before, and it is found in Muslim 4/1279, no. 2207, in the chapter on salam, "every disease has a remedy", and Abu Dawud 4/196, no. 3855, in the chapter on medicine, "when cupping is recommended", and Tirmidhi 4/341, no. 2051, and Ibn Majah 2/1152, no. 3483.