The Messenger of Allah ﷺ said, "When one of you feels pain, let him place his hand on the spot where he feels it and say seven times, 'I seek refuge in the might of Allah and His power over all things from the evil of what I feel.'"
حدثنا هاشم قال حدثنا أبو معشر عن يزيد بن خصيفة
قال رسول الله ﷺ إذا وجد أحدكم ألما فليضع يده حيث يجد ألمه ثم ليقل سبع مرات أعوذ بعزة الله وقدرته على كل شيء من شر ما أجد
Its isnad is sahih. Muslim reported it, 4/1728, no. 2202, in the Book of Greetings, as did Abu Dawud, 4/12, no. 2891, Tirmidhi, 4/408, no. 2080, who said, hasan sahih, and Ibn Majah, 2/1164, no. 3521, all of them in the Book of Medicine, and Malik, 2/942, no. 9, in the Book of the Evil Eye. Hakim graded it sahih, 1/343, in the Book of Funerals, and Dhahabi agreed with him.