French researchers have found a way to save Windows files encrypted by the WannaCry virus, racing against a deadline as the ransomware threatens to start locking up victims' computers first infected a week ago.
WannaCry, which started to sweep round the globe last Friday and has infected more than 300,000 computers in 150 nations, threatens to lock out victims who have not paid a sum of $300 to $600 (£230 to £460) within one week of infection.
A loose-knit team of security researchers scattered across the globe have revealed they have collaborated to develop a workaround to unlock the encryption key for files hit in the global attack, which several independent security researchers have confirmed.
But the researchers said their solution would only work in certain conditions, namely if computers had not been rebooted since becoming infected and if victims applied the fix before WannaCry carried out its threat to lock their files permanently.
The group includes Adrien Guinet, who works as a security expert, Matthieu Suiche, who is an internationally known hacker, and Benjamin Delpy, whose day job is at the Banque de France.
"We knew we must go fast because, as time passes, there is less chance to recover," Delpy said after a second sleepless night of work this week allowed him to release a workable way to decrypt WannaCry at 6am this morning. He calls his free tool for decrypting infected computers without paying ransom "wanakiwi".
Suiche published a blog with technical details summarising what the group of passing online acquaintances has built and is racing to share with technical staff at organisations infected by WannaCry.
Wanakiwi was quickly tested and shown to work on Windows 7 and older Windows versions XP and 2003, Suiche said, adding that he believed the hastily developed fix also works with Windows 2008 and Vista, meaning all affected PCs.
"(The method) should work with any operating system from XP to Win7," Suiche told Reuters, via direct message on Twitter. Delpy added that so far, banking, energy and some government intelligence agencies from several European countries and India had contacted him regarding the fix.
Guinet, a security researcher at Paris-based Quarks Lab, published the theoretical technique for decrypting WannaCry files late Wednesday and Thursday, which Delpy, also in Paris, figured out how to turn into a practical tool to salvage files.
Suiche, based in Dubai and one of the world's top independent security researchers, provided advice and testing to ensure the fix worked across all various versions of Windows. His blog post links to a Delpy's "wanakiwi" decryption tool which is based on Guinet's original concept. His idea involves extracting the keys to WannaCry encryption codes using prime numbers rather than attempting to break the endless string of digits behind the malicious software's full encryption key.
"This is not a perfect solution," Suiche said. "But this is so far the only workable solution to help enterprises to recover their files if they have been infected and have no back-ups" which allow users to restore data without paying black-mailers.
As of Wednesday, half of all internet addresses corrupted globally by WannaCry were located in China and Russia, with 30 and 20 percent of infections, respectively, according to data supplied by threat intelligence firm Kryptos Logic.
By contrast, the United States accounts for 7 percent of WannaCry infections while Britain, France and Germany each represent just 2 percent of worldwide attacks, Kryptos said.
Only 309 transactions worth around $94,000 appear to have been paid into WannaCry blackmail accounts, seven days after the attack began - just under one in 1,000 of the estimated victims.
This may reflect a variety of factors, security experts say, including scepticism that attackers will honour their promises or the possibility that organisations have back-up storage plans allowing them to recover their data without paying ransom.