WASHINGTON, DC (WUSA/AP) - Facebook says it is on top of a wave of spam appearing on users' pages with graphic pictures depicting sex and violence, but is asking people to remain vigilant in safeguarding their accounts.

According to a statement made by Facebook,the recent attack tricked users into pasting and executing malicious JavaScript in their browsers' URL bar, exploiting a vulnerability that caused them to unknowingly share the content.

Analtered picture of Justin Bieber was just one of the graphic images posted to Facebook profiles.

Part of the reason the photos remained up for so long-- is that many users couldn't see the images that were posted on their own news feeds.

Leslie Bradshaw with JESS3, a social media strategy company, says the only way Facebook would know there's problem is if it gets complaints.

She encourages people to flag their friends if they see something suspicious.

"Reporting it to Facebook doesn't get the user in trouble. What it does is allow Facebook to take action on the vulnerability that was exploited," said Bradshaw.

Facebook has now removed most of the sexually explicit and violent photos.

Facebook recommendsnot copying and pasting unknown code into the address bar and using up-to-date browsers.

Read or Share this story: http://on.wusa9.com/18wLrvg