A number of CIA contractors were fired from their positions at agency after it was discovered they had stolen thousands of dollars worth of snacks by hacking a vending machine, BuzzFeed News reported.

The scheme started in the fall of 2012 and carried on through March 2013, according to an October 2013 report from the Office of Inspector General that BuzzFeed News obtained through a Freedom of Information Act request.

Read: What Is Elsa? CIA Can Track Location Of Wi-Fi-Enabled Devices Using Windows

To carry out the snack-stealing effort, the contractors took aim at FreedomPay, a cloud-based payments platform that is often used in vending machines to process payments from cards rather than only allowing cash payments.

Vending machines at the CIA’s campus used the FreedomPay network, which was connected to the CIA’s Agency Internet Network via a cable that allowed the machine to communicate with the payment platform’s remote server.

One of the contractors—who was known for his “knowledge of computer networks,” according to the Office of Inspector General report—unplugged the cable connecting the FreedomPay system, making it impossible for the machine to verify payment.

With the payment platform offline, the contractors were able to swipe unfunded cards through the machine. Because the vending machines no longer had a way to check the validity of the card, it would dispense snacks at no cost, allowing the contractors to get free snacks on demand from a number of machines.

Read: Government Spying: WikiLeaks 'Cherry Blossom' Documents Reveal CIA Hacks Wi-Fi Routers

The plot to eat for free was put to an end after the Office of Inspector General learned snacks were going missing from machines and installed surveillance cameras at “several key vending locations where a high occurrence of thefts were taking place.”

Video footage from the cameras caught several contractors in the act of tampering with the machines. The contractors were quickly identified on tape and confronted by investigators.

The guilty parties all confessed upon being presented with the evidence, including the contractor who had apparently masterminded the hack and shared the method with a number of his colleagues. In total, the group managed to steal an estimated $3,314.40 worth of snacks from the machines.

Contractors involved in the scheme were asked to surrender their CIA badges and were escorted from the premises by security before officially being fired by their employers.

While the group of vending machine hackers lost their jobs, they did not face any additional punishment. The Office of Inspector General referred the case to the U.S. Attorney's office for Eastern District of Virginia for prosecution but the Department of Justice chose not to press charges against the contractors.

News of the incident comes between ongoing releases from Wikileaks that show the CIA’s hacking ability. Documents published by the anti-privacy organization have detailed the intelligence agency’s ability to compromise Apple devices, Windows machines, launch malware attacks, obfuscate the origins of an attack to hide its tracks, compromise Wi-Fi routers to track a target’s activity online and attack air-gapped computer networks.