Microsoft Corp. took the unusual step of warning that a computer bug it has now patched could be used by a cyber weapon similar to the WannaCry worm, which spread across the globe two years ago.

The bug is one of several high-profile computer-security issues to emerge this week, though the impact isn’t yet clear.

Microsoft said that it hasn’t seen anyone take advantage of the flaw, which affects older versions of its Windows operating system, but that it believes it is “highly likely” the flaw will wind up being exploited by malicious software, now that it has been publicly disclosed.

Any “future malware that exploits this vulnerability could propagate from vulnerable computer to vulnerable computer in a similar way as the WannaCry malware spread across the globe,” Microsoft said Tuesday in a blog post.

WHATSAPP DISCOVERS SPYWARE THAT INFECTED WITH ONLY A PHONE CALL

The flaw affects Windows 7 and Windows Server 2008. It also affects Windows 2003 and Windows XP—older versions of Windows that Microsoft doesn’t typically patch. But, in a sign of the severity of the bug, Microsoft released XP and Windows 2003 patches as well.

“This is certainly one to take seriously,” said Chris Coulter, vice president of technology with BlackBerry Ltd.’s Cylance security group.

Users of Windows 10 and Windows 8 aren’t affected by the flaw, Microsoft said.

WannaCry spread quickly, and infected more than 200,000 systems worldwide with ransomware—software that rendered computer systems unusable and demanded a digital ransom. It affected systems at England’s National Health Service, FedEx Corp. and Nissan Motor Co.

The 2017 worm could have been more devastating, but it was stopped when a security researcher activated a “kill switch” feature that prevented the worm from spreading.

EMBATTLED FACEBOOK SLAMS ANTITRUST EFFORTS, SAYS IT WOULD 'PENALIZE SUCCESS'

Microsoft’s bug came a day after Facebook Inc. patched its WhatsApp encrypted-messaging application following the company’s disclosure it had been used in a novel form of attack: Hackers had found a way to install spyware on mobile phones by using a bug in the voice-calling feature of WhatsApp.

That flaw was particularly interesting because WhatsApp is often used by security-conscious people looking to take advantage of its end-to-end encryption capability, which prevents others from snooping on messages as they are sent, Mr. Coulter said. “Myself and millions of others inadvertently put all that at risk by blindly trusting the app,” he said.

Click here for more from The Wall Street Journal, where this story was first published.