Iran apparently infiltrated the communications network of CIA agents who allowed their secret websites, used to exchange messages with informants, to be crawled by Google.

A report from Yahoo! News this week claims that a 2009 breach of the US spy bods' communications channels came after the Iranian government infiltrated a series of websites the CIA had used to talk to its sources in places like Iran and China.

Zach Dorfman, one of the journos behind the Yahoo! report, previously detailed the CIA's "botched" communications system, from the point of view of China, over the summer for Foreign Policy.

“We’re still dealing with the fallout,” one former national security official was quoted as saying this month. “Dozens of people around the world were killed because of this.”

Web scraping is a two-edged sword

The communications leak was believed to have stemmed from a simple Google search. Suspecting the US had agents and sources within its nuclear program, Iran began to hunt for the mole. After a double agent showed Iran's government one of the sites, they were then able to use Google to identify other sites the intel agency was using, and began to intercept their communications.

Essentially, each of the websites had common elements between them that were found using Google searches. Identify one common element; identify all the sites using that material to link them up.

"Because Google is continuously scraping the internet for information about all the world’s websites, it can function as a tremendous investigative tool — even for counter-espionage purposes," the report claims.

"And Google’s search functions allow users to employ advanced operators — like 'AND', 'OR', and other, much more sophisticated ones — that weed out and isolate websites and online data with extreme specificity." As a result Iran announced the intelligence coup and arrested many operatives. Some were executed, although others managed to escape.

Once Iran was able to track down the sites, their techniques were given to other friendly countries, who in turn used the information to weed out the CIA's communications channels in their own territories as well.

Ex-CIA man fingered as prime suspect in Vault 7 spy tool manuals leak READ MORE

“Iran was aggressively going out to hunt systems down,” a former intelligence official said. “They weren’t just protecting themselves anymore.”

The death toll mounts

This, Yahoo! says, citing agency officials, culminated in a 2012 incident in China where 30 agents working for the US were caught and executed. It was previously thought that "more than a dozen" had been killed.

The CIA does appear to have lucked out when it comes to Russia. The intelligence agency ring fences its Russian activities and the report states that intel chiefs were quick to harden up its Russian communications channel at the first sign of trouble.

But the rest of the agency had become too reliant on the system, which was originally intended to only be a temporary communications channel, and had left the relatively insecure site up far longer than intended and used it to send information that should have been reserved for more secure channels.

"It was never meant to be used long term for people to talk to sources," the report quotes one official as saying.

"The issue was that it was working well for too long, with too many people. But it was an elementary system. Everyone was using it far beyond its intention."

Shooting the messenger

A defense contractor for the CIA named John Reidy claims he warned the agency that it was using insecure communications systems in 2008, and again in 2010 when he started to suspect the channels had been cracked. A year later he was fired by the agency, a move he claims was retaliation for not shutting up.

“It was a recipe for disaster,” Reidy said. “We had a catastrophic failure on our hands that would ensnare a great many of our sources.”

Reidy said that he appealed to the CIA's Inspector General and those who were supposed to be providing congressional oversight. No one did anything to sort out the issue and Reidy was sidelined and then sacked.

“This is one of the most catastrophic intelligence failures since Sept. 11,” said Irvin McCullough, a national security analyst with the Government Accountability Project. “And the CIA punished the person who brought the problem to light.

The CIA did not respond to a request for comment. ®