It is narrated from Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "Soon a time will come upon people in which remaining single (not marrying) will be permissible, and the religion of a religious person will not remain safe unless he flees with his religion, to protect it, from one mountain peak to another and from one burrow to another, just as a bird flies off with its chicks and as a fox runs off with its young. So let him (even in such a state) establish the prayer, pay the zakah, and keep away from people except in good deeds. And he said: To graze a hundred white goats on the mountain called Sal' is dearer to me than the kingdom and rule of Banu al-Nadir, and that will be when circumstances become such and such (full of fitnah and corruption)."
Imam al-Harith narrated this narration in his Musnad (Bughyat al-Bahith); its chain contains Mas'adah bin Sadaqah, a da'if (weak) narrator. However, encouragement towards seclusion in times of fitnah to save one's religion has also come in other authentic hadiths.
Hadith Referenceالمطالب العالية بزوائد المسانيد الثمانية / كتاب الفتن / 4360
Hadith Gradingمحدثین:إسناده ضعيف جدًا
Hadith Takhrij«حکم الحدیث المطالب العالیہ محققاً تنسیق د. سعد بن ناصر بن عبد العزيز الشَّثري- مکتبہ شاملہ :إسناده ضعيف جدًا. » «انفرد به المصنف من هذا الطريق»