Hackers have caused Yahoo’s advertising servers to distribute malware to hundreds of thousands of users since late last month, according to two Internet security companies.