A British cyber security researcher hailed as a hero for neutralizing the global "WannaCry" ransomware attack in 2017 has pleaded guilty to U.S. charges of writing malware.