The Messenger of Allah ﷺ said, "Whoever is asked about knowledge he possesses and then conceals it will be bridled on the Day of Resurrection with a bridle of fire."
حدثنا أحمد بن بديل بن قريش اليامي الكوفي حدثنا عبد الله بن نمير عن عمارة بن زاذان عن علي بن الحكم عن عطاء
قال رسول الله ﷺ من سئل عن علم علمه ثم كتمه ألجم يوم القيامة بلجام من نار
[Its chain of transmission is hasan]. Ibn Majah recorded it in the Introduction, chapter on whoever is asked about knowledge and conceals it, hadith 261, from the hadith of Umara bin Zazan through the same route, and Ibn Hibban graded it sahih, hadith 95. The hadith has many corroborating narrations.There are also narrations on this subject from Jabir [Ibn Majah, hadith 263] and Abdullah bin Amr [Ibn Hibban, hadith 96, and Hakim, 1/102].