Allah, exalted be His praise, says: "And do not pursue that of which you have no knowledge. Indeed, the hearing, the sight and the heart, about all of these there will be questioning." [Surah al-Isra': 36]
And He said: "Except those who testify to the truth while they know." [Surah al-Zukhruf: 86]
And in the story of the brothers of Yusuf (peace be upon him) He said: "And we have testified only to what we know, and we were not guardians of the unseen." [Surah Yusuf: 81]
Imam al-Shafi'i (may Allah have mercy on him) said: "It is not permissible for a witness to testify except to what he knows."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / Q20578