Thousands of visitors to the Yahoo website were attacked by malware, spread via poisoned adverts in recent days.