Remove exposed and infected plant material. If the cactus fungus is growing where a leaf has broken off, then you will need to cut off the infected area. Cut behind the infection so that you can throw the fungus away entirely.
Swab the fungus with rubbing alcohol. In many cases, fungus on cacti is accompanied by secondary infections of mealy bugs or gnats. The rubbing alcohol will kill these invaders as well as weakening or killing the fungus. Make sure that you actually rub the fungus off the cactus when you are applying the rubbing alcohol.
Treat isolated infections with cooking vinegar. If a single leaf has been infected, then cover the surface of the leaf with vinegar. This will kill the fungus and cause the leaf to drop off naturally so that you do not expose the interior of the cactus to additional infection.
Dust the plant with Bordeaux mixture. This is a fungicide that is safe to put on the surface of the cactus as well as on exposed interior areas where you have been forced to cut. It will kill the fungus without hurting the plant.