An attack discovered by A.I. researchers could have compromised hundreds of millions of devices within hours, experts said.