They take two pictures, each taking up half the total observation period. If you subtract the two images, the deltas should be the cosmic ray flashes. You can then subtract those out. They use two pictures as opposed to more to minimize the impact of readout noise.
To deal with "stuck pixel" type errors, they can slightly shift the camera between the two observations. They can counter act the shift before doing the initial subtraction.