לישועת אלחנן בן הענא מרים
Hilchos Lashon Hara chapter 10, section 1
If someone saw someone harming a person by stealing from him or damaging his property, whether the robbed or harmed person knows it or not, or that he shamed him or distressed him or embarrassed him. If one clearly knows that he did not return the stolen item and did not pay him his damage and did not ask forgiveness for his wrongdoing, and one saw this oneself, one may relate the incident to people in order to assist the injured party and to disparage evil deeds before people. But one must be careful that seven rules are fulfilled.
Hilchos Lashon Hara chapter 10, section 2
These are: a) One must see the act oneself and no merely hear it from others oneself one clarified afterwards that it was true.
b) One must be very careful to not immediately decide that the matter was theft, robbery or damage and suchlike, but carefully examine the matter to see whether it comes under these categories.
c) One must first gently rebuke the wrongdoer as this might help and make him change his ways. If he does not listen, one can then tell the public his wrongdoing against his fellow. (If one knows he will not accept the rebuke, this is explained later in paragraph 7).
d) One may not exaggerate the wrongdoing.
e) One's intent must be for benefit as explained later in paragraph 4, and not to enjoy disparaging the person or because of prior hatred.
f) If one can bring about the benefit somehow without speaking lashon hara about the person, one may not speak about him.
g) One may not cause more damage than halacha demands to the person through one's story than would have been caused if one testified against him in beis din. We explain this later in hilchos rechilus chapter 9.