This hadith has been transmitted on the authority of 'Amir b. Sa'd and the words are. Allah's Messenger (ﷺ) said
The greatest sinner of the Muslims amongst Muslims is one who asked about a certain thing which had not been prohibited and it was prohibited because of his asking about it.