The Prophet ﷺ said, "The Muslim who commits the gravest offense is one who asks about something that was not forbidden, and it becomes forbidden because of his question."
أن النبي ﷺ قال: إن أعظم المسلمين جرما من سأل عن شيء لم يحرم، فحرم من أجل مسألته.
Bukhari narrated it in the Book of Holding Fast (7289), and Muslim in the Book of Virtues (2358:132), both from the hadith of Ibn Shihab, from Amir bin Saad bin Abu Waqqas, from his father, who said, and he mentioned it.