fight fire with fire
US /faɪt ˈfaɪər wɪð ˈfaɪər/
UK /faɪt ˈfaɪər wɪð ˈfaɪər/

1.
to use the same methods as your opponent, even if they are unpleasant, in order to achieve a victory
:
•
When they started spreading rumors, we decided to fight fire with fire and expose their lies.
•
Some argue that to deal with cyberattacks, you sometimes have to fight fire with fire.