The Messenger of Allah ﷺ forbade cauterization. He said, "Then we were tested, so we cauterized ourselves, but we neither succeeded nor prospered."
حدثنا محمد بن بشار حدثنا محمد بن جعفر حدثنا شعبة عن قتادة عن الحسن
أن رسول الله ﷺ نهى عن الكي قال فابتلينا فاكتوينا فما أفلحنا ولا أنجحنا
[Sahih]. Ibn Majah also narrated it in the Book of Medicine, chapter on kunyas, hadith no. 3490, from the hadith of Hasan, with this wording. Muslim and others narrated it from the hadith of Humayd bin Hilal, from Mutarrif, from Imran, with this wording, at greater length.The hadith of Hammam from Qatada is sahih, corroborated by Shuba from Qatada with this wording.On this subject there are also narrations from Ibn Masud [Abdul-Razzaq, hadith no. 19517, and Tahawi in Maani Athar, 4/320], from Uqba bin Amir [Ahmad, 4/156], and from Ibn Abbas [Bukhari, hadith no. 5610].