All vulnerabilities
CRITICALAppSec

APPSEC-FACEBOOK-VIEWAS-2018

Web app · Facebook

Summary

On September 28, 2018 Facebook disclosed that attackers had stolen access tokens by exploiting its View As feature; an initial estimate of nearly 50 million affected accounts was revised on October 12, 2018 to about 30 million whose tokens were actually stolen (roughly 29 million had data accessed). The root cause was a business-logic flaw chaining three bugs in the read-only View As profile preview: a video-uploader composer added in July 2017 wrongly appeared in that view, it incorrectly minted an access token at all, and critically it minted the token for the user being viewed rather than the viewer, embedding that token in the page HTML. An attacker could therefore select View As a target and scrape a fully privileged token for the target account, then pivot through friend lists to harvest tokens outward from roughly 400,000 seed accounts. The flaw is an improper-authentication / business-logic failure where an auth credential was generated in the wrong context and scoped to the wrong principal.

How to avoid it in your code

  • Ensure read-only views and previews issue no session or access tokens; gate token minting to explicit authenticated actions only.
  • Always scope generated tokens to the requesting principal, never to an identity supplied by the client.
  • Never embed access tokens in rendered HTML or other client-readable response bodies.
  • Security-test feature interactions, not just features in isolation; combined flows create logic flaws unit tests miss.
  • Add anomaly detection on token issuance and friend-graph traversal to catch automated harvesting.

References

Related vulnerabilities

All AppSec →