Hazrat Mahdi (as) will possess secret knowledge like the hidden knowledge (ilm al-ladun) from the presence of Allah
Kab says, “The reason why he who is to come is named as Hazrat Mahdi (as) is because he is guided to secret matters.” (As-Suyuti, Al-Hawi Lil-Fatawi, Vol. 2, p. 148)