All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
There is no Hadeeth with this wording ("Do not fight an unjust Muslim authority, even if he is immoral"). However, its meaning is implied in some prophetic reports and statements of scholars. Muslim scholars stated that it is impermissible for Muslims to make an armed rebellion against a Muslim authority, even if he is unjust and oppressive. At-Tahaawi said, "We do not approve an armed rebellion against our authorities and those in charge of our affairs even if they are unjust, nor do we supplicate against them; nor do we refuse to obey them. Rather, we hold that obedience to them consists in obedience to Allaah The Exalted, and therefore it is obligatory as long as they do not command us to commit a sin. We supplicate (Allaah) for their right guidance and forgiveness." [Al-‘Aqeedah At-Tahaawiyyah]
Shaykhul-Islam Ibn Taymiyyah said: "It was established by Ahl As-Sunnah that it is forbidden to make an armed rebellion against oppressive authorities. They required Muslims to patiently endure the tyranny of the authorities and to abandon fighting them until the righteous is relieved or until the wicked relieves (i.e. until the people who are under his authority are relieved from his injustice either when the unjust ruler is guided to justice or when those people die, or until the unjust ruler dies and relieves the people from his injustice)." [Majmoo‘ Al-Fataawa]
‘Ubaadah ibn As-Saamit said: "We swore allegiance to the Messenger of Allaah, sallallaahu ‘alayhi wa sallam, to hear and obey in times of difficulty and in prosperity, in hardship and in ease, and during his selfishness, and not to contend with those in authority; he, sallallaahu ‘alayhi wa sallam, said: 'unless you see open disbelief regarding which you have proof from Allaah.'" [Al-Bukhari and Muslim]
Huthayfah ibn Al-Yamaan reported that the Prophet, sallallaahu ‘alayhi wa sallam, said: "There will be leaders who will not be led by my guidance and who will not adopt my ways. There will be among them men who will have the hearts of devils in the bodies of human beings." Huthayfah asked, "What should I do, O Messenger of Allaah, if I live in that time?" He, sallallaahu ‘alayhi wa sallam, replied: "You listen to the leader and obey him. Even if your back is flogged and your wealth is taken, listen and obey.'"
Allaah Knows best.