In a post on the social network's news site, Facebook vice president of product management Guy Rosen said: "On the afternoon of Tuesday September 25, our engineering team discovered a security issue affecting almost 50 million accounts.
"We're taking this incredibly seriously and wanted to let everyone know what's happened and the immediate action we've taken to protect people's security.
"Our investigation is still in its early stages. But it's clear that attackers exploited a vulnerability in Facebook's code that impacted 'View As', a feature that lets people see what their own profile looks like to someone else.
"This allowed them to steal Facebook access tokens which they could then use to take over people's accounts.
"Access tokens are the equivalent of digital keys that keep people logged in to Facebook so they don't need to re-enter their password every time they use the app."
It was unclear whether any UK users had been hit, but some reported getting a message when they tried to log in that said: "Recent activity may have affected your account's security, so we've locked it.
"We'll walk you through a few steps to confirm your identity and help you access your account."
Mr Rosen outlined the action Facebook had taken since the discovery, including fixing the issue and reporting it to law enforcement.
He said: "We have reset the access tokens of the almost 50 million accounts we know were affected to protect their security.
"We're also taking the precautionary step of resetting access tokens for another 40 million accounts that have been subject to a 'View As' look-up in the last year.
"As a result, around 90 million people will now have to log back in to Facebook, or any of their apps that use Facebook Login. After they have logged back in, people will get a notification at the top of their News Feed explaining what happened.
"Third, we're temporarily turning off the 'View As' feature while we conduct a thorough security review."