It is narrated from Sayyiduna Zaid bin Arqam (may Allah be pleased with him) that the Noble Prophet (peace and blessings be upon him) said: "Evil and wicked jinn are present in the toilets. Therefore, when any one of you intends to enter them, he should recite this supplication: « اللَّهُمَّإِنِّیأَعُوذُبِکَمِنْالْخُبْثِوَالْخَبَائِثِ » 'O Allah, I seek refuge with You from the evil male and female jinn.' These are the words of Bundar's narration. But he has said 'from Al-Nadr bin Anas.' Similarly, Yahya bin Hakeem, narrating from Ibn Abi Adi, has said '« عن النصر » bin Anas' (i.e., he has used the word 'from' instead of 'I heard')."
Hadith Referenceصحيح ابن خزيمه / جماع أبواب الآداب المحتاج إليها في إتيان الغائط والبول إلى الفراغ منها / 69
Hadith Takhrij«اسناده صحيح: الصحيحة: 1070 ، سنن ابي داوٗد: كتاب الطهارة: باب ما يقول الرجل اذا دخل العقلاء ، رقم الحديث: 6 ، سنن ابن ماجه: 296 ، الترمذى: 5 ، مسند احمد: 369/6 ، 373 ، وابن حبان فى صحيحه: 1406 ، 1408 ، الحاكم: 297/1 ، 298»