Allan, who signed for Liverpool in 2015 but never played a competitive game for the English club after failing to get a work permit, had been booked early in the second half at Fluminense on Wednesday after an argument with Luciano Acosta.
Just as the referee turned away, the 29-year-old made the gesture towards Fluminense forward Kevin Serna.
The referee, alerted by the VAR, went over to the pitchside screen to see replays of the incident, before giving Allan his marching orders.
Fluminense, level on points with league leaders Palmeiras, won the game 3-1 against 11th-placed Corinthians.
