Malware intentionally created by the U.S. National Security Agency to infect personal computer hard disk drives (HDDs) and solid-state drives (SSDs) cannot be detected by antivirus programs.

The spyware, which infects a drive's firmware, can also produce a treasure trove of data for any government agency controlling the drives, according to Russian security software maker Kaspersky Lab.

Kaspersky released a report this week saying that it had discovered the spyware on hard drives in personal computers from 30 countries, including the U.S. The company said the malware, known as Fanny, likely predated other NSA spyware, such as Stuxnet, and has likely been in use for nearly two decades.

Kaspersky does not name the NSA in its report. Instead, it refers to those in charge of the spyware program as "the Equation group," noting that the same group was closely linked to Stuxnet.

Stuxnet, which came to light in 2010, was a computer worm developed by the NSA to sabotage Iran's nuclear program.

According to a report by Reuters, a former NSA employee "confirmed that the NSA had developed the prized technique of concealing spyware in hard drives, but said he did not know which spy efforts relied on it."

Kaspersky said the latest spyware was discovered on hard drives from more than a dozen major manufacturers, including Seagate, Maxtor (now a subsidiary of Seagate), Western Digital (WD), Toshiba, IBM and even SSD makers such as Micron and Samsung.

"There is no way to understand whether your HDD is infected," Igor Soumenkov, principal security researcher at Kaspersky Lab, said in an email reply to Computerworld. "Once the hard drive gets infected with this malicious payload, it's impossible to scan its firmware."

To put it simply: For most hard drives, there are functions to write into the hardware's firmware area, but there are no functions to read it back.

Kaspersky The government agency identified by Kaspersky only as "The Equation Group", was likely using its cyber-espionage malware for nearly two decades.

"It means that we are practically blind, and cannot detect hard drives that have been infected by this malware," Soumenkov said.

Steve Gibson, a software engineer and security researcher, agreed that the NSA malware is undetectable because it subtly changes the "behavior" of a compromised drive making it impossible to scan, probe or explicitly check for that alteration.

"The only thing that could be done would be to catch the drive's (mis)behavior. And the very tricky thing about doing that is that this misbehavior only occurs at system boot time... when nothing else is yet running," Gibson said in an email reply to Computerworld.

Gibson, who founded Gibson Research Corp. and its SpinRite hard drive scanning software, said what Kaspersky found wasn't the actual malware on hard drives, but evidence of the technology to perform the code embedding on the drive.

"They happened to capture some of the vestigial bits of the exploit setup that had not been removed from a system -- the so-called "dropper" that knew how to check the drive's make and model and then invoke the required drive-specific code to install the malware," Gibson said. "When you consider it, it's really quite diabolical."

The Equation group used a variety of methods to spread its programs, including infecting USB sticks and CDs, as well as the Fanny computer worm.

Fanny was "presumably" compiled in July 2008, Kaspersky's report stated, as it was first observed and blocked by the company in December of that year.

Kaspersky's report stated that it's not known when the Equation group began its ascent into cyberespionage. Some of the earliest malware samples Kaspersky discovered were compiled in 2002, but some of the command and control (C&C) software was registered in August 2001.

"Other C&Cs used by the Equation group appear to have been registered as early as 1996, which could indicate this group has been active for almost two decades," Kaspersky's report stated.

Hard drive maker WD said that prior to the release of Kaspersky's report, it had no knowledge of the NSA cyberespionage program.

"We take such threats very seriously. The integrity of our products and the security of our customers' data are of paramount importance to us," a WD spokesman wrote in an email reply to Computerworld.

The WD spokesman said the company has not participated in or supported the development or deployment of cyberespionage technology by government entities, adding that "Western Digital has not provided its source code to government agencies."

"We are in the process of reviewing the report from Kaspersky Labs and the technical data set forth within the report," the spokesman said.

Seagate, the largest producers of hard disk drives, said it also had "no specific knowledge of any allegations regarding third-parties accessing our drives."

"For over seven years Seagate has been shipping drives offering industry-leading levels of self encryption, while putting in place secure measures to prevent tampering or reverse engineering of its firmware and other technologies," a spokesman stated.

Perhaps the most powerful tool in the Equation group's arsenal, Kaspersky's report states, is a mysterious module known only by a cryptic name: "nls_933w.dll."

Kaspersky Lab

The worm allows the Equation group to reprogram the hard drive's firmware.

"This is an astonishing technical accomplishment and is testament to the group's abilities," Kaspersky's report stated.

Kaspersky's report said the company found personal computers in 30 countries infected with one or more of the spying programs, with the most infections seen in Iran, followed by Russia, Pakistan, Afghanistan, China, Mali, Syria, Yemen and Algeria. The targets included government and military institutions, telecommunication companies, banks, energy companies, nuclear researchers, media and Islamic activists, Kaspersky said.

"During our research, we've only identified a few victims who were targeted by this module," Soumenkov said. "This indicates that it is probably only kept for the most valuable victims or for some very unusual circumstances."

The spyware module itself is used only to deliver the customized firmware to the victim's hard drive, and someone deploying it would need to know special commands that will let a user communicate with a particular HDD hardware, which is vendor specific, Soumenkov said.

Soumenkov said the most complex and expensive process in deploying the malicious worm is reprogramming an HDD's firmware. To do that, someone would need to first obtain the source code of all the major vendors' firmware, which would require having access to the fully proprietary information and internal documentation kept by drive manufacturers.

Either that, "or to have abnormal skills to reverse engineer the firmware's code," Soumenkov said. "And they did it for more than 12 HDD brands!"