Some of the nation’s top intelligence minds were fired from the CIA — for hacking a vending machine.

The spy group axed several contractors after it discovered they had stolen $3,314.40 in eats from compromised vending machines between fall 2012 and March 2013, according to a report obtained by BuzzFeed News.

When nosh began going missing from agency vending machines, the CIA did what it does best — it put up cameras and started spying on the break room, according to the report.

“Video footage recovered from the surveillance cameras captured numerous perpetrators engaged in the … theft scheme, all of whom were readily identifiable as agency contract personnel,” the report states.

The machines take payment via prepaid cards, but one contract worker realized he could use a dummy card with no money on it if he simply unplugged the so-called “FreedomPay” system so it could not connect to payment servers, the report states.

He “admitted to originating the idea of how to effect the thefts based on his knowledge of computer networks,” the report states.

The contractors, who have not been identified, were fired, according to the report, which also noted that the Office of the Attorney General referred the case to the Department of Justice, but the CIA did not seek prosecution.