The malicious advertisements are connected to servers hosting the Angler exploit kit, a software package that probes a computer for software vulnerabilities in order to deliver malware, Trend Micro said.
Security vendor Trustwave wrote on Monday that it also detected a large Angler-related malvertising campaign.
It wasn't immediately clear if both vendors were writing about the same campaign. Both did note in their blog posts that the campaign delivered a backdoor called BEDEP, which allows an attacker to place other malware on a computer.
Trustwave said in some cases it saw the attack deliver BEDEP and TeslaCrypt, a type of file-encrypting malware.
The attackers Trustwave studied appeared to have gained control of a domain called "brentsmedia[dot]com" that at one time may have been used for online advertising.
"BrentsMedia was probably a legitimate business, and though we can't know Angler's side of this story for sure, it's likely that the people behind Angler are trying to ride on the reputation the domain had and abuse it to trick ad companies into publishing their malicious ads," Trustwave wrote.
Several high-profile websites pulled a JSON file from brentsmedia[dot]com as part of loading advertisements shown on their sites, Trustwave wrote. The JSON file had 12,000 lines of heavily obfuscated JavaScript, which was suspicious.
The JavaScript in part tries to figure out if certain security products or tools are running a computer. If none are, it loads a landing page from another domain hosting the Angler exploit kit, Trustwave wrote.
The malicious ads were hosted by two online advertising companies, one of which immediately killed the offending ad after being notified by Trustwave. The other company couldn't be reached.
The affected sites included answers.com and zerohedge.com, Trustwave said. Trend Micro didn't identify the publishers it saw were affected.
There's little publishers can do to stop malvertising since online advertising companies should be vetting and filtering malicious ones. Although detecting malicious ads is getting better, it's far from perfect.
Placing a malicious ad on a highly trafficked website means an attacker could potentially infect many computers in a very short period of time, offering a great advantage over simple spam.
The Angler campaign observed by Trend may have "affected tens of thousands of users in the last 24 hours alone," wrote Joseph C. Chen, a Trend Micro fraud researcher.
"Based on our monitoring, the malicious ads were delivered by a compromised ad network in various highly-visited mainstream websites–including news, entertainment and political commentary sites," Chen wrote.
"As of this writing, while the more popular portals appear to be no longer carrying the bad ad, the malvertising campaign is still ongoing and thus continues to put users at risk of downloading malware into their systems," he wrote.