Microsoft's president and top lawyer has sharply criticized Donald Trump's administration for failing to do more to prevent Friday's massive cyber attack.

Brad Smith slammed US intelligence agencies, including the CIA and National Security Agency, for 'stockpiling' software code that can be used by hackers.

Cybersecurity experts revealed the unknown hackers who launched the weekend's 'ransomware' attacks used a vulnerability that was exposed in NSA documents leaked online.

As a result, parts of the National Health Service (NHS) in Britain was battered into submission and some surgeries and hospitals were forced to close their services.

Brad Smith (pictured) slammed US intelligence agencies, including the CIA and National Security Agency, for 'stockpiling' software code that can be used by hackers on Friday

In a post on Microsoft's blog, Smith said: 'An equivalent scenario with conventional weapons would be the US military having some of its Tomahawk missiles stolen.'

The tech giant's president and chief legal officer says governments should 'report vulnerabilities' that they discover to software companies, 'rather than stockpile, sell, or exploit them.'

US President Donald Trump ordered his homeland security adviser, Tom Bossert, to hold an emergency meeting Friday night.

Donald Trump (pictured) has already called two emergency meetings over the attack

The meeting was called to assess the threat posed by a global computer ransomware attack, a senior administration official said.

Senior security staff held another meeting in the White House Situation Room on Saturday.

He believes there are three areas that need improving to prevent it happening again.

Microsoft need to address the issue with updates, their customers - companies and government branches - need to take responsibility and the authorities need to be held accountable, according to the lawyer.

Smith added: 'The governments of the world should treat this attack as a wake-up call.

'They need to take a different approach and adhere in cyberspace to the same rules applied to weapons in the physical world.

'We need governments to consider the damage to civilians that comes from hoarding these vulnerabilities and the use of these exploits.

'This is one reason we called in February for a new Digital Geneva Convention to govern these issues, including a new requirement for governments to report vulnerabilities to vendors, rather than stockpile, sell, or exploit them.

'And it’s why we’ve pledged our support for defending every customer everywhere in the face of cyberattacks, regardless of their nationality.

'This weekend, whether it’s in London, New York, Moscow, Delhi, Sao Paulo, or Beijing, we’re putting this principle into action and working with customers around the world.'

Hospitals and other organizations in the UK are braced for mayhem today as the NHS tries to get back on its feet following Friday's crippling cyber attack (pictured)

Security experts say a cyberattack that holds computer data for ransom grew out of vulnerabilities purportedly identified by the National Security Agency.

Microsoft has released fixes for vulnerabilities and related tools disclosed by TheShadowBrokers, a mysterious group that has repeatedly published alleged NSA software code.

But many companies and individuals haven't installed the fixes yet, or are using older versions of Windows that Microsoft no longer supports and didn't fix.

Chris Wysopal of the software security firm Veracode said criminal organizations are likely behind this, given how quickly the malware has spread.

'For so many organizations in the same day to be hit, this is unprecedented,' he added.