Facebook has closed a potentially serious security flaw in its Instagram photo- and video-sharing platform that would have let an attacker potentially take over any Instagram account by resetting its password.
The flaw is the second major issue the company has had to address in its password-recovery mechanism in the past two months. In both instances, India-based bug hunter Laxman Muthiyah reported the issue to Facebook and collected a bounty for it.
Muthiyah's research was prompted by a recent Facebook decision to increase payouts to researchers who discover and report account-takeover flaws and similar critical vulnerabilities in Facebook and several of its other platforms, including Instagram.
"Instagram forgot password endpoint is the first thing that came to my mind while looking for an account takeover vulnerability," Muthiyah said in a blog last month describing the first of the two vulnerabilities he recently discovered.
Like most online services, Instagram allows users who have forgotten the password to their account to regain access via a password reset process. When a user submits a password change request from a mobile device, the person receives a six-digit code from Instagram that has to be entered in order for the password to be reset. The user has to enter the passcode within 10 minutes of receiving it or request another one.
With the first vulnerability, Muthiyah found an attacker could reset passwords to any Instagram account by triggering a password change request and then trying all 1 million possible combinations of the six-digit passcode until one of them worked.
The only hurdles Muthiyah discovered he had to get around were the 10-minute time limit and another Instagram control that blocked the number of tries a user could make after around 200 failed attempts.
He found that an attacker could bypass both by trying different passcodes from a large number of IPs at the same time. He figured that in a real scenario an attacker would need 5,000 IPs each making 200 requests to hack an account. "It sounds big, but that's actually easy if you use a cloud service provider like Amazon or Google," Muthiyah wrote. He estimated the cost of carrying out such an attack would be in the range of $150.
Facebook quickly remedied the issue and paid Muthiyah $30,000 for reporting it to the company.
But even after the fix, Muthiyah found he could still hijack Instagram accounts by exploiting another weakness in the password reset process.
In a blog this week, Muthiyah described the second vulnerability as involving a randomly generated device ID that is sent along with every password change request an Instagram user makes from his or her mobile device. The same device ID is then also used to verify the passcode.
Muthiyah said his research showed that one device ID could be used to request passcodes for different users. He found that by requesting passcodes of multiple users on the same device, he could linearly increase the probability of hacking accounts.
In total, there are 1 million possible combinations for a six-digit passcode. "If you request pass code of 100,000 users using same device ID, you can have 10 percent success rate since 100k codes are issued to the same device ID," he wrote. "If we request pass codes for 1 million users, we would be able to hack all the one million accounts easily by incrementing the pass code one by one."
Facebook paid Muthiyah $10,000 for reporting the latest bug, which it described as having to do with "insufficient protections on a recovery endpoint." The weakness, now fixed, allowed an attacker to try numerous, valid, one-time passcodes to attempt password recovery, the company said.
Eve Maler, vice president of innovation and emerging technology at ForgeRock, says the security researcher performed a white-hat function in disclosing the flaw to Facebook. "An attacker could have silently compromised untold numbers of accounts, misrepresented user content, spread misinformation, or demanded a hefty price for the return of the accounts," Maler says.
The hack involved generating mobile device passcodes dynamically in response to a challenge by Instagram during a password reset. Such account recovery processes can be the most vulnerable part of user-involved identity management, she says.
"This process is often treated as if it were similar to routine login," Maler says. In reality what needs to happen is identity proofing — or verifying that an identity credential is being issued to the correct individual, she said.
Check out The Edge, Dark Reading's new section for features, threat data, and in-depth perspectives. Today's top story: "The Right to Be Patched: How Sentient Robots Will Change InfoSec Management."