facebook - Facebook token 劫持的漏洞

标签 facebook api security facebook-access-token

根据 Facebook 开发人员手册 (https://developers.facebook.com/docs/facebook-login/security),您不必使用 access_token来自某种 Facebook SDK 客户端,但无法确保它是专门为您的 Facebook 应用程序生成的。

我想知道这里存在什么样的漏洞。如果我可以使用它来进行 API 调用并通过它获取用户数据,为什么我应该关心哪个应用收到了 token ?

Token Hijacking

To understand how this happens, imagine a native iOS app that wants to make API calls, but instead of doing it directly, communicates with a server owned by the same app and passes that server a token generated using the iOS SDK. The server would then use the token to make API calls.

The endpoint that the server uses to receive the token could be compromised and others could pass access tokens for completely different apps to it. This would be obviously insecure, but there is a way to protect against this - access tokens should never be assumed to be from the app that is using them, instead they should be checked using debugging endpoints.

最佳答案

这些类型的漏洞是特定于应用程序的——我能想到的一种情况是:

假设您将 Facebook 身份验证用作 SSO机制并创建了一个带有网络服务的应用程序,该网络服务将一些私有(private)信息返回给经过身份验证的用户。此 Web 服务称为 /secretdocuments/download,它将访问 token 作为参数。

如果网络服务只检查它收到的访问 token 是针对它在数据库中的用户(通过调用/me 然后进行数据库查找),那么恶意人员可以:

  1. 创建其他一些“诱饵”应用。
  2. 将指向该应用程序的链接发送给您的一位用户,并鼓励他们安装该应用程序。
  3. 该用户使用诱饵应用程序进行身份验证,并且访问 token 是 产生。诱饵应用将此访问 token 发送给恶意用户。
  4. 恶意用户获取该访问 token 并使用它调用您的 /secretdocuments/download 网络服务。
  5. 您的网络服务仅检查访问 token 是否适用于用户 它在数据库中并将私有(private)信息返回给 恶意用户。

在这种情况下,您的网络服务必须检查提供的访问 token 是否由您的应用程序生成。

关于facebook - Facebook token 劫持的漏洞,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21253272/

相关文章:

php - Facebook 炸毁了我的网页

swift - 从 Facebook 获取电话号码

css - Facebook 点赞按钮被剪掉

node.js - 我是否需要更改客户端代码以使用 HTTPS 代替我的 API 服务器上的 HTTP?

security - 除了访问控制列表 (ACL) 之外,还有什么 "better"吗?

.net - 当调用者不在域中时请求用户在 AD 中的角色

c# - FB.Logout() 在 Facebook UnitySDK 中不起作用

java - 在 Java 谷歌地图中遍历多级 JSON 对象

javascript - 加载结果后重定向到新页面

java - 在服务器上执行外部 Java 源代码 - 限制安全和资源?