Facebook today said it has fixed the bug that allowed a spamming worm to automatically post messages to users' walls earlier this week.
The flaw was the second in the past week that let spammers flood the service with messages promoting scams.
Last week, Facebook quashed a different bug in its photo upload service that let a spammer post thousands of unwanted wall messages.
The newest worm was noticed Monday by researchers at a pair of antivirus vendors, Finland-based F-Secure and U.K.-based Sophos.
"A clever spammer has discovered a Facebook vulnerability that allows for auto-replicating links," said Sean Sullivan, an F-secure security researcher. "Until now, typical Facebook spam has required the use of some social engineering to spread."
Clicking on the link to the bogus application automatically added the app to users' profiles, then automatically reposted a status message with a new link to friends' walls, said Sophos' Graham Cluley today.
While last week's spam plugged free iPhones, this week's scam touted surveys that offered Best Buy and Walmart gift cards to consumers who completed a marketing poll.
"I thought this survey stuff was GARBAGE but I just went on a shopping spree at walmart thanks to FB," some of the spam messages read.
Facebook today said it had plugged the newest hole and cleaned up users' walls.
"Earlier this week, we discovered a bug that made it possible for an application to bypass our normal CSRF [cross-site request forgery] protections through a complicated series of steps," said a company spokesman in an e-mailed statement. "We ... fixed it within hours of discovering it [but] for a short period of time before it was fixed, several applications that violated our policies were able to post content to people's profiles if those people first clicked on a link to the application."
"This is different than the photo upload bug," said Sullivan. "But be glad it's spammers doing this and not bot generators."
If malware makers had had this bug or last week's photo upload flaw, they might have been able to use them to attack Facebook's more than 500 million users with malformed images or auto-generated links to sites hosting a wide range of browser, operating system or application exploits, said Sullivan.
While Sullivan said a recent four-month analysis he's done on Facebook spam showed that the company has done a better job at curbing what he called "feature abuse" -- bogus accounts sending massive numbers of friend requests, for instance -- it's had a tougher job quashing bugs before scammers have used them.
"Clearly, there are bugs in Facebook and its application platform," said Sullivan. "There will be more to come. I certainly don't envy [Facebook]."
Both Facebook and Sullivan gave users the same advice about dealing with spam, bug-related or not.
"We're advising people to be wary of posts and messages with suspicious-looking links, even if they come from friends, and to report applications that might violate our policies," said the Facebook spokesman.
"This should be a wake-up call for people who are clicking on links," added Sullivan. "They should be thinking, 'Maybe I don't even need to look at this [link].' It's better to be safe than sorry."
Gregg Keizer covers Microsoft, security issues, Apple, Web browsers and general technology breaking news for Computerworld. Follow Gregg on Twitter at @gkeizer or subscribe to Gregg's RSS feed . His e-mail address is firstname.lastname@example.org.