Facebook said it was working with Kaspersky Lab, bolstering a program implemented with other online security firms including ESET, F-Secure and Trend Micro.
"Thanks to the collaboration with these companies, in the past three months we have helped clean up more than two million people's computers that we detected were infected with malware when they connected to Facebook," said Trevor Pottinger, a Facebook security engineer.
"In these cases, we present a cleanup tool that runs in the background while you continue using Facebook, and you get a notification when the scan is done to show you what it found."
Pottinger said the program uses "a combination of signals to help find infections and get the malware off of your computer for good, even if the malware isn't actively spreading spam or harmful links."
Kaspersky Lab's Kate Kochetkova said in a separate blog post that Facebook users are often targeted in online fraud schemes such as "phishing," which are faked emails designed to get recipients to download malware.
"Facebook is a major aim for phishers: one in five phishing scams targets Facebook notifications," she said.
"So be vigilant when you receive emails appearing to be from Facebook: as they can be fake. There are lots of Trojans targeting Facebook users as well."
Fraudsters may also use Facebook, Kochetkova said, to "'like' weird things and promote questionable goods and services on your behalf."
Get your daily dose of tech news, reviews, and insights, in under 80 characters on Gadgets 360 Turbo. Connect with fellow tech lovers on our Forum. Follow us on X, Facebook, WhatsApp, Threads and Google News for instant updates. Catch all the action on our YouTube channel.