Diebold's machines have cheap locks for which keys are readily available (I don't know which particular cheap lock they use, but for many types of cheap locks there are only a few dozen different keys; some are packaged such that a case of locks will contain one of each different key). In many election offices, it would not be difficult for a member of the party in power to get access to the machines prior to the election.
Unless all hard drives and flash are removed from the machines and read out without running code from them prior to the machines' being used for elections, it will be difficult to detect well-designed stealth cheat-ware. I don't think the machines are set up to facilitate such verification, and doubt anybody does it.
If done well, such a hack would be undetectable after the fact except by doing magnetic-domain analysis on the system's hard drive or by examining the hard drive of a compromised system before the cheatware had an opportunity to remove itself.