Gheebah is haram (impermissible) and emphatically so, because Allah says (interpretation of the meaning):
“…neither backbite one another. Would one of you like to eat the flesh of his dead brother?”
And it is proven from Anas (may Allah be pleased with him) that the Prophet (blessings and peace of Allah be upon him) said: “When I was taken up into heaven, I was taken past some people who had nails of copper with which they were scratching their faces and chests. I said: Who are these, O Jibreel? He said: These are the ones who ate the flesh of the people and impugned their honour.” [Imam Ahmad and Abu Dawood] The Prophet (blessings and peace of Allah be upon him) defined gheebah as saying about your brother that which he dislikes.
It is permissible in a few cases which are indicated by shar’i (legal) evidence when there is a need for that, such as if someone consults you with regard to marriage or business partnership, or if someone complains to the ruler and asks him to put a stop to a person's wrongdoing. In that case there is nothing wrong with saying about him things that he dislikes for the purpose of serving an obvious interest. One of them compiled a list of the cases in which gheebah is permissible in two lines of verse in which he said:
Criticism is not gheebah in six cases: complaining about mistreatment, identifying a person, warning about a person, highlighting evildoing, seeking a fatwa/verdict, and seeking help to remove an evil.
But if there is no obvious interest to be served by mentioning him in a way that he dislikes, then it comes under the heading of gheebah which is haram.
With regard to the question about the phrase “There is no gheebah (backbiting) in the case of a faasiq (evildoer)” and whether it is a hadeeth or not, Imam Ahmad said it is munkar (basically rejected). Al-Haakim, al-Daaraqutni and al-Khateeb said: it is false.
But the fact that there is no gheebah in the case of a faasiq (an evildoer who openly commits sins) is indicated by the proven report which says that the Prophet (blessings and peace of Allah be upon him) saw a funeral passing by, and those who were with him spoke ill of the deceased person, and he (blessings and peace of Allah be upon him) said: “It is due.” Then another funeral passed by, and they spoke well of the deceased person, and the Prophet (blessings and peace of Allah be upon him) said: “It is due.” They asked him what he had meant by saying it is due, and he said: “The one of whom you spoke ill, Hell is his due, and the one of whom you spoke well, Paradise is his due. You are the witnesses of Allah on His earth.” and he did not rebuke them for speaking ill of the deceased person of whose evildoing they were aware. This indicates that if a person commits evil openly, there is no gheebah in his case.
And Allah is the source of strength. May Allah send blessings and peace upon our Prophet Muhammad and his family and companions. End quote.