A researcher has found a serious vulnerability in the Facebook platform that could allow hijacking anyone’s Facebook account. For discovering this OAuth Framework flaw, Facebook awarded a hefty bug bounty to the researcher.
Facebook OAuth Framework Flaw
Researcher Amol Baikar has found a serious OAuth Framework flaw affecting the Facebook platform.
Sharing his findings in a blog post, the researcher revealed that the bug existed in the “Login with Facebook” feature. Hence, it became possible for an adversary to hijack access tokens when a user would log in to other websites via Facebook. In turn, this would not only allow hacking Facebook accounts but would also give access to the respective third-party services.
While explaining the normal login flow the researcher stated,
/connect/ping” endpoint to issue a user_access token and redirect URL set to “
XD_Arbiter” which is whitelisted by default for all applications. In the background, on initialization SDK creates a proxy iframe for Cross-domain communication. Proxy frame sends back the token, code or not_authorized, unknown status via postMessage() API.
Though, the endpoint was secure enough to prevent known login bypass strategies two important points made it possible to exploit the page proxy which further exposed the cross-domain communication. As stated by the researcher, these were,
-Missing the “
X-Frame-Options” header. (completely framable flow)
-Additionally “window.parent” which itself saves the user interaction to zero. Wasn’t needed to bother with window.open or any button onClick event.
Hence, the access_token would ‘leak to any origin’, and an adversary could then set up a new phone number for recovery.
While Facebook initially addressed this matter, the researcher found that the OAuth’s core endpoint “
/dialog/oauth/” continued to redirect to page proxy.
Here is a demonstration of the exploit:
Facebook Awarded A Hefty $55,000 Bounty
Initially, when Baikar reached out to Facebook regarding the flaw, the tech giant quickly acknowledged the bug and developed a fix. At that time, they permanently revoked “/connect/ping endpoint” to generate access-token, and added __d(“JSSDKConfig”) line to the XD_Arbiter to prevent page proxy exploit.
The researcher deemed these steps inadequate as he could bypass the fix. Eventually, Facebook developed another fix that resolved this decade-old vulnerability.
The researcher was awarded with a bug bounty of $55,000 ( which is the maximum payout for a client-side account takeover).
Let us know your thoughts in the comments.